Jump to content
  • Advertisement
Sign in to follow this  
ProjectOlle

XNA Multi texture problem

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

Hey guys!

I have yet another small and hopefully easy to fix problem! :D

I have different instances of the same class in a 3D game, these instances are three different types of towers, each tower got different textures depending on how upgraded and damaged they are.

I figured out how to swap the texture from one to another with the effect.Texture BUT! when I have say two different towers of same type (so they use same model) and I change the texture of one of them at runtime, the texture for both of them will change :S .. Any way to avoid this? .. I really want to avoid using different models just to change the texture of a single tower :o

Share this post


Link to post
Share on other sites
Advertisement
The texture for both of them changes because you are only referencing one actual instance of the model data. If you load 2, you just get a reference to the first one. Use a different data structure that will reference the model and the different textures you need for them while you are rendering, and it won't be a problem.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!