PDA

View Full Version : Floating point textures, negative numbers and value range



brianviz
05-01-2005, 12:51 PM
I'm trying to do GPGPU on Linux/NVidia/Cg using single channel floating point textures. I can initialize the texture just fine using glTexImage2D and then use a Cg fragment program to compute. However when I use glReadPixels the results are clamped to [0,1]. Is there a way to read negative and unclamped values from the framebuffer? If I use glCopySubImage2D will I get the unclamped values in the destination texture?

Most likely I could rescale these values by subtracting 0.5 and rescaling to some value range but this seems like a lot of extra computation.

Is there anyway around this, without using pbuffers or framebuffer objects?

Thanks

Java Cool Dude
05-01-2005, 09:31 PM
Head over to this thread (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=11;t=000712) where things are explained pretty nicely.
Nighty night

brianviz
05-01-2005, 10:51 PM
thanks JCD. unfortunately i don't have the glClampColorARB function extension available but i managed to get around the problem by keeping a packed format. can't wait until fbo in linux!