I'm in the process of debugging GLSL vertex shaders and I can't shake the feeling that I'm doing it wrong.

In general I have two strategies to make up for the lack of tracing

  • I stuff values into a debug color varying that I pass to the fragment shader and then try to interpret the colors.
  • I change the vertex shader code and see what happens.

I'm thinking that ideally I could make up for the lack of tracing by writing values to a texture somehow, reading the texture from the GPU and printed the values stuffed in the texture.

My guess is that there might be way better ways. Any suggestions?


A friend of mine has used glslDevil for this, and said it was okay.

If you're not tied to GLSL, Microsoft has an incredible tool for DirectX called PIX, but I don't think there's anything equivalent for OpenGL.

  • \$\begingroup\$ I've downloaded glslDevil but I can't get most of the features to work. The tracing works, and the stepping through shaders but I can't see the values of variables. \$\endgroup\$ – Jonathan Fischoff Nov 10 '10 at 16:31

nVidia has an awesome shader debugger. You can find it, and its specs, HERE

Update 2016: There is also a Visual Studio plugin, which most probably is their newer effort in helping developers, here: https://developer.nvidia.com/nvidia-nsight-visual-studio-edition

  • \$\begingroup\$ typo: its specs \$\endgroup\$ – o0'. Nov 10 '10 at 14:20
  • \$\begingroup\$ thx. =) I get those right 70% of the time. I blame DainBramage. \$\endgroup\$ – Nailer Nov 10 '10 at 15:35
  • \$\begingroup\$ no GLSL support though :(, but it looks like I can convert cg shaders to glsl automatically, might give that a try. \$\endgroup\$ – Jonathan Fischoff Nov 10 '10 at 16:30
  • \$\begingroup\$ You're right about that, but I think the advantages outweights the disadvantages. Besides, FX composer is a pretty nifty app. \$\endgroup\$ – Nailer Nov 10 '10 at 19:53
  • \$\begingroup\$ Broken link.... \$\endgroup\$ – UpTheCreek Jan 13 '17 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.