i know this fragment program produce a result and then pass it to COLOR0.I want to know where COLOR0 is ?and if i want to use glreadPixels to
transform it to main memory,what should i do?

thanks for your concerning !

Zengar

08-28-2006, 02:50 AM

Color0 is the color output to the framebuffer (your window, pbuffer or texture - whatever you use). To get the data back to the memory you should use glReadPixels. Usually you will create a floating-point rendering target ans use it as a framebuffer via the FBO (framebuffer object) extension.

Louvie

09-05-2006, 12:13 AM

Thanks to Zengar.
Now i can get the data back to the memory from pbuffer use glReadPixels.The new problem is the data were truncated to [0,1].

In fact,there is only one float-point result i need,not 4 (rgba),just like this:

fragment program:

float main(...)
{
...
float result = 9999.999;
return result;
}

you know if i use glReadPixels as usual,i get 1.0 not 9999.999.so what can i do? I read some materials said transform the data to depth buffer would be ok,but how to do it or would you like to give some other better suggestion?

thanks to all of you!

Komat

09-05-2006, 12:39 AM

Originally posted by Louvie:
you know if i use glReadPixels as usual,i get 1.0 not 9999.999.so what can i do?As Zengar told you, you need to create floating point framebuffer. Additionally there are some vendor specific extensions that allows you to specify framebuffers with less than four channels.