Original Post
🔒 Locked
GLSL debug!
Advertisement
To debug GLSL, use the function glGetInfoLogARB().
Note this is only to detect shader compilation/linkage errors. There is no way to debug a shader as it is running. Debugging a shader in real time can only be done with HLSL right now.
One technique used to "debug" GLSL shaders is to set gl_FragColor to a set value if something is wrong.
For instance, lets say you never want a variable in your shader greater than 5.0
So in the shader, you do
if(variable > 5.0)
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
Then if your output is red, you know you have a problem....
Hope that helps.
Note this is only to detect shader compilation/linkage errors. There is no way to debug a shader as it is running. Debugging a shader in real time can only be done with HLSL right now.
One technique used to "debug" GLSL shaders is to set gl_FragColor to a set value if something is wrong.
For instance, lets say you never want a variable in your shader greater than 5.0
So in the shader, you do
if(variable > 5.0)
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
Then if your output is red, you know you have a problem....
Hope that helps.
falling behind what?
Well, i'm not all that up on Cg or HLSL, however they can both only do as much as the hardware allows so I very much doubt you'll get more out of one than the other (infact, with Cg on anything other than NV hardware you could be more limited)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement