Print Cg shader output

Hello!

I have a fragment shader and I would like to print the interpolated u,v coordinates to the console.
How can I do this?

thx

Create a 32 bit per channel floating point pbuffer, render the values you want into it as fragment color and do a read pixels of the buffer as GL_FLOAT.

do you know any tutorial site for this?

or do I just need to create a float array. and then use Cg function to write the color to this array?

thx
nicolas

Check developer.nvidia.com esp. the link below.
I think the zip contains all code you need as startup.

http://download.nvidia.com/developer/SDK/Individual_Samples/samples.html

http://download.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/simple_float_pbuffer.zip

You need to use the WGL_ARB_pixel_format extension to allocate a floating point pbuffer and render into it from your Cg fragment shader.
There is no other output possible (except for the depth).
Your “float array” is the pbuffer. Use glReadPixels with GL_FLOAT type to readback the date into your system memory.

No fear, it’s not too difficult. The project contains more than necessary, but you need to add your Cg environment.