• Advertisement
Sign in to follow this  

How to get float value in GPU?

This topic is 4259 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ^_^

Share this post


Link to post
Share on other sites
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 )

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement