Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

hello_there

Quick Texture question

This topic is 5327 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

I have a stucture that is used to load textures in my engine. it hold the data and everthing to do with the texture. i was wondering after the texture is loaded is it worth keeping the texture data or just store the number generated by glGenTextures(1, &Texture);

Share this post


Link to post
Share on other sites
Advertisement
I can''t come up with any reason to keep your copy of the data. As far as I know, it just wastes space. Once the texture object has been created, opengl has it''s own copy of the data to use. I suppose if you need to recreate the texture object for some reason, it would save you a little time reading it from disk again, but I don''t think there''s much need for that. I don''t keep my copies of textures in my project, but maybe someone with more experience knows of reasons to or situations that you would want to...

Share this post


Link to post
Share on other sites
You should probably keep your texture around if you want to do procedural or dynamic textures though. That way, all you have to do is reupload the texture once you have changed it. (unless you are doing everything on the pixelshader)

Share this post


Link to post
Share on other sites
Another reason you might want to keep the texture data around is if you allow your user to change from windowed to fullscreen mode and vice versa while in the game. When this happens on Windows, you will lose your rendering context (unless I''m doing something wrong). That means you lose all your textures. But it also means losing all your display lists, vertex arrays, VBO''s etc. Since you lose everything, you might as well load everything from disk again (how often will the user want to switch display modes? Not often.) So the answer is No, you do not need to keep the texture data in memory (unless you are doing procedural textures as FReY indicated).

Share this post


Link to post
Share on other sites
quote:
Original post by cyansoft
Another reason you might want to keep the texture data around is if you allow your user to change from windowed to fullscreen mode and vice versa while in the game. When this happens on Windows, you will lose your rendering context (unless I''m doing something wrong). That means you lose all your textures. But it also means losing all your display lists, vertex arrays, VBO''s etc. Since you lose everything, you might as well load everything from disk again (how often will the user want to switch display modes? Not often.) So the answer is No, you do not need to keep the texture data in memory (unless you are doing procedural textures as FReY indicated).
*cough*thisisnotdirectx*cough*

OpenGL handles all of that for you.

Share this post


Link to post
Share on other sites

  • 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!