Retrieving Texture Info using it's ID

Started by
4 comments, last by CyberSlag5k 19 years, 1 month ago
This has slipped my mind if it is possible. It seems like it should be. Say I generate a texture ID, bind the ID, assign a texture to the ID. Later, if I want to query the information (height, width, etc) about the texture assigned to this particular ID, how would I do that?
Advertisement
You have to save it somehow. I don't believe there's a way to get that information out of OpenGL later.
Yeah, as MichaelMook said, just store the information in an array to parallel your texture array, or make a structure to store both.
Without order nothing can exist - without chaos nothing can evolve.
glGetTexLevelParameter

But yeah, it's better to store whatever basic stuff you would need such as width and height instead of asking for it all the time.
Thanks for the replies.

Yea, I knew about glGetTexLevelParameter, but that only gives you info about the currently set texture. I was thinking more along the lines of giving it a specific ID (although it is just as easy to set a texture, then call the previous function, I guess). You're all right, though. It seems a lot more natural to just store the info when I load the texture, in some array in my texture manager class.

Thanks again.
Quote:Original post by Doggan
Thanks for the replies.

Yea, I knew about glGetTexLevelParameter, but that only gives you info about the currently set texture. I was thinking more along the lines of giving it a specific ID (although it is just as easy to set a texture, then call the previous function, I guess). You're all right, though. It seems a lot more natural to just store the info when I load the texture, in some array in my texture manager class.

Thanks again.


Yeah, or you could just store the present index (if you use an array), call glBindTexture with the desired texture, glGetTexLevelParameter (sorry I didn't know that existed), and then re-bind the old texture. It's costly but it should work.

Good Luck!
Without order nothing can exist - without chaos nothing can evolve.

This topic is closed to new replies.

Advertisement