Glslviewer shader debug

From openharmonyinsight/openharmony-skills · View interactive version

Glslviewer shader debug is an AI agent skill from the GitHub repository openharmonyinsight/openharmony-skills. Adapt fragment shaders or runtime-shader snippets into standard GLSL, render them with glslViewer in headless mode, and inspect PNG output for shader debugging. Use when Codex needs to validate SDFs, gradients, masks, edge contours, or intermediate shader math by producing reproducible preview image

How to use this skill

Skill file

glslViewer Shader Debug

Use this skill to turn shader math into repeatable headless previews.

Workflow

  1. Confirm glslViewer is available with command -v glslViewer || command -v glslviewer.
  2. Create a scratch .frag file, usually by copying CODE1.
  3. Translate the source shader into standard GLSL.
  4. Render the shader with CODE0.
  5. Inspect the generated PNGs and compare the contour or mask shape against expectations.

Translation Rules

void main()
{
    vec2 fragCoord = gl_FragCoord.xy;
    fragColor = ...;
}

Rendering

Render one or more fragment shaders like this:

/root/.codex/skills/glslviewer-shader-debug/scripts/render_headless.sh path/to/a.frag path/to/b.frag

Useful options:

The script writes one PNG per input shader plus a frame directory that contains the original exported frame.

Validation Heuristics

Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.