PDA

View Full Version : Please help! Can't create HALF_FLOAT_ARB texture



playmesumch00ns
09-24-2005, 01:01 AM
I need to display a 2048x1556 image and run fragment programs on it. I can't reliably create a 32-bit float image, so I'd like to use half-float.

This is my sequence of calls to generate the texture:

GLuint id;
glGenTextures( 1, &id );

glBindTexture( GL_TEXTURE_RECTANGLE_ARB, id );
HlBase::checkGlError();
glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
HlBase::checkGlError();
glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP );

glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB16F_ARB, w, h, 0, GL_RGB, GL_HALF_FLOAT_ARB, pixeldata );

HlBase::checkGlError(); HlBase::checkGlError() just prints out the gluErrorString if there's an error on the stack.

The code fails with an INVALID_ENUMERANT just after the glTexImage2D call.

Any ideas?

playmesumch00ns
09-24-2005, 01:24 AM
The same code works using

glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, GL_FLOAT_RGB_NV, w, h, 0, GL_RGB, GL_FLOAT, pixeldata );For a full float image (if GL has the memory to give me the texture ), but


glTexImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB32F_ARB, w, h, 0, GL_RGB, GL_FLOAT, pixeldata );gives me another INVALID_ENUMERANT. I'm using the 71.67 nVidia drivers on linux, which GLEW tells me gives me GL2.0, and ARB_half_float is available.

It seems that none of the GL_RGB??F_ARB enumerants want to work. What am I doing wrong? Do I have to enable something?

Overmind
09-24-2005, 03:13 AM
Perhaps the ARB float formats don't work with the rectancle texture target. I'm not sure why this should be the case, but if you're using an OpenGL 2.0 capable board, it would be better anyway to just use GL_TEXTURE_2D.

playmesumch00ns
09-24-2005, 03:35 AM
TEXTURE_2D gives me just the same result.

In any case, I have to use TEXTURE_RECTANGLE as my image is 2048x1556.

Overmind
09-24-2005, 04:43 AM
The limitation with power of two sizes was dropped in OpenGL 2.0, and before that with the extension ARB_texture_non_power_of_two. If this extension is exposed, you can use any texture size you like with any texture target. These features are supported on nVidia cards since the 6xxx series.

Back to the problem:
What's your graphic card? Does it support ARB_texture_float? For example, my GFFX supports ARB_half_float_pixel but not ARB_texture_float.

playmesumch00ns
09-25-2005, 11:16 PM
Aha! That's it. According to GLEW, ARB_texture_float is missing on my Quadro FX 1100.

Thanks for pointing that out. The equivalent NV extensions work just fine.

Now that there are ARB extensions for this sort of stuff, does anyone know if the nVidia extensions will be deprecated at any point?

Overmind
09-26-2005, 01:10 AM
The reason why the FX series does not support the ARB float extensions is that the NV extensions only allow the float formats to be used with the RECTANGLE texture target, while the ARB extensions allow any target. And that's beyond the capability of FX cards.

From the 6xxx series on, the ARB extensions are supported, so starting from these cards the NV extension is already deprecated, but it's still needed for the FX series.