Jump to content
  • Advertisement
Sign in to follow this  

Multiple Vertices and Texturing

This topic is 4134 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'm making the switch over to 3D from programming 2D (I was using D3D anyway) and was wondering what the best way to draw a cube with different textures was. Currently I'm drawing an untextured cube with a vertex buffer and an index buffer and I use 8 vertices to describe my cube. 8 is obviously the optimum number of vertices but what happens when each side requires a different texture? Each vertex can only hold one set of UV data but the vertex will be shared by 3 different faces which will probably each need different UV data. Do I need to describe 24 vertices (4 vertices * 6 faces)? The texture I will use will probably be a texture map so that the UV data for each face will read something like - FRONT (0,0,0.25,0.25), TOP (0.5,0.75,0.75,1.0) etc. The same problem of shared vertices still arises if I use 6 different textures as the orientation of the textures will need to be described also. I know that batching textures is important for D3D so I'll probably create a texture map as I know my program will only require a limited amount of textures - however a future expansion may require a lot of textures and so I need to know if describing each face is necessary within my VB. The program will eventually render a scene similar to the view seen in Dungeon Master - the map in my program will be a 'square' map with only 90 degree turns but an obvious expansion would be to better harness the 3D environment and have the camera move in a more realistic manner. I was just wondering whether filling my dynamic buffer with the vertex information for each face before rendering is the 'correct' way to render the scene. I can't help thinking its probably not.

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!