Jump to content
  • Advertisement


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


Storing Texture Coordinates in D3D IM

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

Hello there Im working on my 3d engine with direct 3d and I have a little problem. My vertices are stored in a vertex Buffer and drawn using DrawPrimitiveIndexedVB. So I have a master list of all the vertices. In my CFace class, I have the index list of the vertices it contains. All of the polys are grouped by texture so I do my texture change and render all of the polys that are associated with it in one call to DrawPrimitiveIndexedVB. The problem is when I want to put texture or color in my vertices. Those informations have to be stored in the D3DVERTEX structure. For example if I have a vertex that is connected to 4 polygons, I''m stuck because I can''t put all of those informations in just one point. I have searched and I dont know what to do now. It would be inefficient to create one Vertex at the same position for each polygon that it is connected to. And if I want to transform my model, I would have to move all of those four vertices. Finaly, I have looked in my OpenGl book and the solution that they have adopted in the vertex array is to make multiple arrays. One Array for the point''s location and other arrays for all of the other properties. This solution seams very simple and logical because when the time to render my polys will come, I will just have to load the appropriate array for each texture list I will encounter. Does a similar approach exists in D3D? And what is a usual approach when creating a 3dEngine? Thanks a lot.

Share this post

Link to post
Share on other sites
Today the usual approach is to have four different vertices. But with DX8 you will be able to divide the properties into multiple arrays like you are suggesting.

It can be done with DX7 as well but then you loose TnL. If you use ProcessVertices() on a vertex buffer, you can then lock the transformed vertices and exchange the texture coordinates to reflect the current texture.

- WitchLord

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!