Determining target from texture name?

Is there a simple query to do this? I couldn’t find it after spending close to an hour searching the red book, blue book, and the 1.5 spec.

Basically, I have the texture name (ie. a GLint) and I want to get the target associated with that texture (eg. GL_TEXTURE_2D, GL_TEXTURE_3D, etc.). The reason I’m doing this is because I want to be able to enumerate all the textures and their types in a debug function.

Currently, what I’m trying is taking the texture and binding it all the various targets and checking for glGetError() after, until I find the target to which it binds without errors.

Hi Stephen_H

You can easily use gDEBugger to view the textures that your application uses:
[ul][li]gDEBugger texture viewer displays each render context textures (textures data as an image, texture parameters, etc).[*]gDEBugger calls log displays the textures associated with OpenGL commands.[/ul][/li]Have a look at:

We hope that gDEBugger will save you the time needed to implement your debug tool.

The gDEBugger team