PDA

View Full Version : ATI: "invalid operation" on glTexImage2D with depth-textures



Jan
07-06-2005, 01:38 PM
Hi there

This line

glTexImage2D (GL_TEXTURE_RECTANGLE_EXT, 0, GL_DEPTH_COMPONENT24_ARB, iSizeX, iSizeY, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);

gives me an "invalid operation" error. Although the texture i get seems to work just fine.

However, in the docs it's said, that "invalid operation" happens, if it is done between glBegin / glEnd, which is definitely not the case here.

Therefore i really don't know, why i get this error.

It seems to depend on the GL_DEPTH_COMPONENT stuff. If i call the same routine with GL_RGBA8 i get no errors.

This is on an ATI Radeon 9700 with Catalyst 5.6.

Any ideas?

Jan.

Jan
07-06-2005, 01:53 PM
Ok, if i set the format parameter to GL_DEPTH_COMPONENT it works. With all other formats i tried it gives me an error.

However,
1) it should generate a "invalid enum" error, instead of "invalid operation"
2) if i specify a NULL pointer it should accept any format. I don't want to put lots of "if internalformat = DEPTH16/24/32 then format = ..." into my code, if i specify a NULL pointer anyway.

Jan.

Humus
07-06-2005, 01:54 PM
GL_BGRA and GL_UNSIGNED_INT_8_8_8_8_REV on a depth texture?

Edit: You figured it out yourself ...

Edit2:
1) Nope, all enums are valid in this call, but you can't use them together.
2) The pixels parameter doesn't matter. The internalformat, format and type combination must still be valid.

arekkusu
07-06-2005, 07:31 PM
You have to use a valid combination of internal format and format, even if you pass a null pointer. Read the spec: http://oss.sgi.com/projects/ogl-sample/registry/ARB/depth_texture.txt

"Textures with a base internal format of DEPTH_COMPONENT require depth
component data; textures with other base internal formats require RGBA
component data. The error INVALID_OPERATION is generated if the base
internal format is DEPTH_COMPONENT and format is not DEPTH_COMPONENT,
or if the base internal format is not DEPTH_COMPONENT and format is
DEPTH_COMPONENT."