tags:

views:

80

answers:

1
+2  Q: 

printf in GLSL ?

In C, I can debug code like:

fprintf(stderr, "blah: %f", some_var);

in GLSL ... is there anyway for me to just dump out a value in a Vertex or Fragment shader? I don't care if it's slow; I just want to dump out the value. Ideally, I want a setup like the following:

normal state = run GLSL shader normally I press key 'd' then next frame is generated in ULTRA slow mode, where the "printfs" in the Vertex/Fragment shader are executed and dumped out.

Is this feasible? (I don't care about performance; I just wnat to do this for one frame).

Thanks!

+1  A: 

Instead of printing values, have you thought of trying a GLSL debugger?

glslDevil seems like it would do what you need; let you step through your shader's execution and examine the variables.

zerocrates