Results 1 to 9 of 9

Thread: "Unload" OpenGL textures

  1. #1

    "Unload" OpenGL textures

    May be a very simple question.

    I know, there's the glDeleteTextures procedure that does the work, so I can create a "texture manager" that loads and unloads the textures, but is there a way to delete all textures in a simple call?
    No signature provided yet.

  2. #2
    No, i don't think there are other ways. Possibly you can reinitialize the whole rendering context and OpenGL, but that's a little overkill compared to just going through each texture and deleting them 1 by 1.

  3. #3
    glDeleteTextures does the work and also can delete all your textures at once if you store all of them in a single Array.

  4. #4
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    I make my own procedures that will delete those loaded for specific purposes. You can load all your textures into any array like Jimmy states and then simply plug that number into glDeleteTextures yes, but if you want better management be sure to keep those that are needed only at specific times (level specific or splash screens) seperate from those needed all the time. (main menu and in-game menu graphics)
    Jason McMillen
    Pascal Game Development
    Co-Founder





  5. #5
    Ok. Then I should use a "texture manager".

    Thank you.
    No signature provided yet.

  6. #6
    This is obvious, but maybe you can use tlist as it is a general purpouse list manager with add, insert and delete metods for any kind of objects.

  7. #7
    I was concerned about load/unload textures to the OpenGL library, but your suggestion of using TList makes me think about load and unload the bitmaps from disk. Thank you, fitflend.
    No signature provided yet.

  8. #8
    Obviously you always want to load the textures straight from disk. But another thing you need to pay attention to is how many textures you use. Each call of glBindTexture() is a slow operation. So for example a tile map, being split each in its own texture would be a huge performance loss.

  9. #9
    Quote Originally Posted by User137 View Post
    Obviously you always want to load the textures straight from disk. But another thing you need to pay attention to is how many textures you use. Each call of glBindTexture() is a slow operation. So for example a tile map, being split each in its own texture would be a huge performance loss.
    That's why loading/setup/init sequence exists in every game before you can actually play. It's no secret, isn't it?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •