View Full Version : debugging a shader?

01-09-2007, 03:11 PM
I believe this forum is for glsl, but I thought there might be some OpenGL CG users that could answer this.

Can anyone give me any tips for debugging a CG fragment shader under OpenGL? I'm trying to get a floating point scalar quantity out of a shader and I don't see an obvious way of doing it. Are there any debuggers or tricks I can employ? A free or commercial tool perhaps? I see that there is a debugger for HLSL if you're using DirectX and there is the OpenGL Shader Designer from TyphoonLabs for glsl, but I haven't seen anything for CG.

I thought about returning the float as a 32-bit color and reading that value from the frame buffer using glReadPixels, but that seems really kludgy. Is there any other way?