Jump to content
  • Advertisement
Sign in to follow this  
schupf

[DX10] VertexBuffer/IndexBuffer Problem

This topic is 3686 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, I have a little problem with VertexBuffer/Streams and Indexbuffer in DX10. To visualize the problem please look at this picture: I want to render the left grid (grid 0) with a triangle list, therefore I have a VB (VertexBuffer) with 25 vertices: VB = [v0, v1, v2, v3, v4, ..., v24] and an IB_0 = [0, 1, 6, 6, 6, 5, 0, 1, 2, 7, ... ] As you can see nothing special. Additionally I want to render the grid in a coarser resolution (the right grid in the picture - grid 1). To do this I don't need an another VB - I just use an another IB: IB_1 = [0, 2, 12, 12, 10, 0, 2, 4, 14, ...] Every vertex also has a normal and the "vertices" of the coarser grid (grid 1) have different normals. So I created 2 vertex buffer's for the normals of the 2 grids: NVB_0 (25 normals) = [nv0, nv1, nv2, nv3, nv4, ... , nv24] (for example nv2 means: normal for vertex 2) NVB_1 = (9 normals) [nv0, nv2, nv4, nv10, nv12, ... , nv24] (nv2 is NOT the same as nv2 in NVB_0) To render one of the grids I wanted to set the VB with the positions as stream0, the normal VB as stream1, set the approproate IB and call drawIndexed. This works for grid 0, because IB_0 fits to NVB_0, but it does NOT work for grid 1, because IB_1 does not fit to NVB_1. According to IB_1 the first 3 vertices have indices 0, 2, 12 (correct) and the first 3 normals have also indices 0,2,12 (incorrect. It should be: 0, 1, 4). Unfortunately I can't set individual IB's for each stream, so I am really lost here. Any idea how I could solve this? :/

Share this post


Link to post
Share on other sites
Advertisement
You can only have one index buffer, the vertex streams are expected to be coherent. You can either use the normal that is on the vertex, or you can apply a normal map instead.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!