printf in GLSL?

Viewed 34031

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
  • press key 'd' = 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 want to do this for one frame).

Thanks!

4 Answers
Related