View Full Version : How to findout texture Dimensionality

04-07-2005, 11:21 PM
How can I programmaticaLly find out wether the texture is for example a TEXTURE_2D or TEXTURE_3D?

04-08-2005, 02:50 AM
What do you mean? Texture objects in graphics memory or before uploading?
(not that I know the answer to either - but I'd say it depends on the person making the artwork)

04-08-2005, 03:41 AM
I want something like glIsTexture2D or glIsTextureCube

for example:
void render (int name)
if (glIsTexture2D(name))
printf("you are using 2d texture");
if (glIsTexture3D(name))
printf("you are using 3d texture");


04-08-2005, 04:10 AM
Afaik, there is only one possibility:
Try to bind the texture, and check the error status...

For example: glBindTexture(GL_TEXTURE_2D, texture) will give an INVALID_OPERATION error if "texture" is not actually a 2D texture object.

04-09-2005, 01:03 AM
For level 0

glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, params);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, params);