How can I programmaticaLly find out wether the texture is for example a TEXTURE_2D or TEXTURE_3D?
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)
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”);
…
}
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.
For level 0
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, params);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, params);