• Advertisement
Sign in to follow this  

Good or Bad Idea - Placing Texture2D inside class

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

There probably is a better way all together but here's what I've been doing. I've been keeping my textures inside several dictionaries and each polygon can hold a string to a texture. When I look up textures I use the polygon's string. I was thinking, wouldn't it be easier to just use a reference to the texture I'm using and avoid the lookup in general?

Share this post


Link to post
Share on other sites
Advertisement
Bah, nevermind silly question! If the mesh were to be saved the texture data would be lost.

Share this post


Link to post
Share on other sites
Here is how it's normally done:

the game has a collection of TextureResource's which hold the d3d/opengl texture & the textures name as a string.

the game also has a collection of Meshes which each have a Material and some materials reference a TextureResource and/or the texture directly using a pointer.

if you want to save a mesh, you can find out the texture name by looking for the texture in your resource collection.

Share this post


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

  • Advertisement