PDA

View Full Version : How to findout texture Dimensionality



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

T101
04-08-2005, 01: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)

serg920814
04-08-2005, 02: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");

...
}

Overmind
04-08-2005, 03: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, 12:03 AM
For level 0

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