View Full Version : Floating point texture problems

05-11-2006, 03:23 AM
I'm having problems using 32 bits floating point textures in GLSL. All values stored in the texture reduce to zero in the shader. I'm using a GForce7800GTX so it shouldn't be a problem with lack of support for these textures.

In my program I create a texture with:

GLfloat tex[32*32][3] = {
#include "texture.txt"

where texture is a texfile which holds floating point numbers such on the form:

{ 0.54432f, 0.02342f, 0.01144f},
{ 0.52627f, 0.12613f, 0.12532f},
{ 0.32445f, 0.13551f, 0.23420f}, ...

then I try

glTexImage2D( GL_TEXTURE_2D, 0, GL_FLOAT_RGB32_NV, 32, 32, 0, GL_RGB, GL_FLOAT, tex );

But my shader never recieves any floating point numbers, only zeros. I have tried the same thing with normal 8 bit per channel textures and that works fine. Any suggestions what I might forget?

05-11-2006, 05:23 AM
Check if there occured a GL error when downloading the float texture.
There should, because GL_FLOAT_RGB32_NV requires a target type of GL_TEXTURE_RECTANGLE_NV.

You should use the ARB_texture_float extension and their enums GL_RGB32F_ARB, GL_RGB16F_ARB.

The board does not support linear filtering of FP32 internal formats in hardware. Switch texture filtering to GL_NEAREST for both minification and magnification.
If your float data range is fitting into FP16 floats and the precision is sufficient you could use that and these support filtering.

05-11-2006, 07:53 AM
http://developer.nvidia.com/object/using_vertex_textures.html shows how to load float textures