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.
Ok, if i set the format parameter to GL_DEPTH_COMPONENT it works. With all other formats i tried it gives me an error.
- it should generate a “invalid enum” error, instead of “invalid operation”
- 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.
GL_BGRA and GL_UNSIGNED_INT_8_8_8_8_REV on a depth texture?
Edit: You figured it out yourself …
- Nope, all enums are valid in this call, but you can’t use them together.
- The pixels parameter doesn’t matter. The internalformat, format and type combination must still be valid.
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