Jump to content
  • Advertisement
Sign in to follow this  
ehmdjii

OpenGL getting all the texture-ids

This topic is 3730 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, is there a way in openGL to get all the ids (names) of all currently allocated texture-objects? if yes, how? thanks a lot!

Share this post


Link to post
Share on other sites
Advertisement
Well the best way to get those id-s are to save them in a vector in your texture class... or something like that. If however you want to get the current bound texture id you could use glGet(...).

Share this post


Link to post
Share on other sites
yeah i thought of that too, but the problem is, i am using a third-party library that creates the textures, so i can't really get the id when i create it.

thanks anyways.

Share this post


Link to post
Share on other sites
If a third party library allocates textures but don't give you a way to know the corresponding IDs, then there's probably a reason that you don't have to know them. For what reason do you have to know what IDs a third party library use?

There is no way to get it from OpenGL, other than looping through all possible names and ask if the number is a valid texture.

Share this post


Link to post
Share on other sites
i would like to know it just for debugging. i'd like to see which textures are allocated in VRAM.

and since it's just for debugging, the way you suggest is actually good enough. i guess all possible names are all possible GLint values?

Share this post


Link to post
Share on other sites
Quote:
Original post by ehmdjii
i would like to know it just for debugging. i'd like to see which textures are allocated in VRAM.
Use an external tool. I don't know what tools are available for OpenGL debugging under Windows, but under Mac you can use the OpenGL Profiler to get this information (and even look at the textures).
Quote:
i guess all possible names are all possible GLint values?
That would be GLuint (note the unsigned). Most drivers start with 1 and increment for each texture, reusing IDs as you delete textures, but some are less predictable.

Share this post


Link to post
Share on other sites
thanks for the information!

is there a way of getting the pixeldata of the texture down from the GPU to the code? thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by ehmdjii
is there a way of getting the pixeldata of the texture down from the GPU to the code? thanks!
glGetTexImage2D().

But if you need this level of debug information, you really need proper tools - for Windows or Linux you should try gDEBugger.

Share this post


Link to post
Share on other sites
thanks!

yeah i know about these tools! but i really want to do this myself! because i would like to learn how it is done and to do it on any computer where no such tool is installed.

Share this post


Link to post
Share on other sites
Quote:
Original post by ehmdjii
yeah i know about these tools! but i really want to do this myself! because i would like to learn how it is done and to do it on any computer where no such tool is installed.
People have said the same about GDB, malloc, and even the OS itself - in the end it really isn't worth it ;)

[Edited by - swiftcoder on August 1, 2008 11:36:20 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!