Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to get float value in GPU?

Started by ARB1130 May 22, 2006 at 9:13 PM 3 replies 1.1k views
Original Post
ARB1130
ARB1130
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 ^_^
zedzeek
zedzeek
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 )
MARS_999
MARS_999
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
Sepultang
Sepultang
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
taby
taby
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?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.