Sign in to follow this  
AntiGuy

Good or Bad Idea - Placing Texture2D inside class

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this