Skip to main content
gamedev.net
🔒 Locked

GLSL debug!

Started by golgoth 6 replies 800+ views
Original Post
golgoth
golgoth
Hi all! what do u guys use as glsl debug? any usefull references on that matter? THX
WilyCoder
WilyCoder
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.
golgoth
golgoth
anyone can remember why we using glsl? feels like it is falling behind...?!
hplus0603
hplus0603
If you want to support multiple platforms, then writing GLSL and translating to HLSL is easier than writing for HLSL (or, worse, .fx) and translating to GLSL.
enum Bool { True, False, FileNotFound };
golgoth
golgoth
HSLS and CG mostly!

still looking for serious glsl web site...
WilyCoder
WilyCoder
Buy the orange book.

I've just started working with GLSL, but I would imagine that its capabilities are almost identical to HLSL and Cg.

Phantom, can you confirm that last statement?
_the_phantom_
_the_phantom_
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.