How to get float value in GPU?

Started by
3 comments, last by taby 17 years, 11 months ago
Hi everyone! I try to get the float values that are bigger than 1.0 by using glReadPixels() so my code is as follow: gl_FragColor.x =12.123; My texture parameters set as glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE32F_ARB, _iWidth, _iHeight, 0,GL_RED, GL_FLOAT, 0); I chaged the interformat to GL_LUMINANCE_FLOAT32_ATI,GL_INTENSITY_FLOAT32_ATI GL_LUMINANCE32F_ARB But I got the values that were 1.0. So,how can I do to get 12.123 ? Finally, thanks for everyone ^_^
Advertisement
i believe the final values displayed to the screen are clamped 0->1 thus if u read back something youve drawn there the max value is 1.0
if u wanna get a textures values try glGetImage(..) or something
disclaimer (ive never used FP textures )
AFAIK you will need to setup to use FP buffers with your PFD setup code so you have the ability to go above 1 e.g. HDR rendering
You should use FBOs instead of ReadPixels. FBOs does not clamp the values.

specs:
http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt
Allocate from CPU RAM a float-type buffer representing a texture of a certain # of channels/type, and through OpenGL, an FBO of the same # of channels/type.

Then call glReadPixels after the FBO has been drawn to using a GLSL fragment shader.

The data type parameter should be good old GL_FLOAT for OpenGL function calls when dealing with colour output textures. GL_RGBA, GL_RGB or GL_ALPHA (and other colour formats) work as the texture format.

4 channels per render target, 4 render targets. 16 unclamped outputs. This works on the 6800GT in GLSL.

Are you certain that the luminance format is clamped unconditionally and others are not?

This topic is closed to new replies.

Advertisement