Jump to content
  • Advertisement


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


Clearing a texture...

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

Hi, Simple question... what''s an easy way to clear a texture from the screen. For example, during collision detection. Also, what''s the proper way to "destroy" a texture. For instance, if it moves off the screen and has no need to be in memory any longer. - JS

Share this post

Link to post
Share on other sites
Say that texture A (player) collides with texture B (enemy). How would you clear/erase A, so it can be replaced with an animation or another texture. This, I''d assume, would be done prior to my second question.
Thanks for your response.
- JS

Share this post

Link to post
Share on other sites
I personally would load the data for the model (texcoords and vertices) only once and use a resource manager to parcel out the data as needed by different objects. As for swapping textures, I would keep everything resident and just switch to a different texcoord set (and possibly a different texture) when a change needed to occur. In general, your graphics card will do better with prioritizing textures (by caching often- and recently-used textures) than you will (by constantly loading/unloading what you need).


//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[edited by - zealouselixir on August 30, 2002 12:15:11 AM]

Share this post

Link to post
Share on other sites
Well, generally one has either a list of textures used for animation. If you want to have a special animation for the player colliding with an enemy, you just load a second texture and do something like

glBindTexture(GL_TEXTURE_2D, Player.CollidingFrame);
glBindTexture(GL_TEXTURE_2D, Player.NormalFrame);
<draw code here>

or something similar.

Next: Generally, the only time you want to load and unload textures is on a level change or when starting or closing the game. Even if an object using texture B moves off screen, it could come back, or maybe a new object using texture B will be created somewhere on the screen and you would need the texture again. But, when you need to unload the texture, what ZealousElixir said is correct.

"The Requested Information Is Unknown Or Classified" -Anonymous

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!