Jump to content
  • Advertisement
Sign in to follow this  
bsh_aoa

About multiple vertex buffer

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

When I have multiple vertex buffer, how to invoke DrawPrimitive()? For example, I create 2 vertex-buffers(named as pVB1, pVB2). I want to draw 2 Triangles: //now in the render() function if( SUCCEEDED( g_pd3dDevice->BeginScene() ) ) { SetupMatrices(); g_pd3dDevice->SetStreamSource( 0, pVB1, 0, sizeof(CUSTOMVERTEX) ); g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX ); g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 1 ); g_pd3dDevice->SetStreamSource( 1, pVB2, 0, sizeof(CUSTOMVERTEX) ); g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX ); g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 1 ); g_pd3dDevice->EndScene(); } g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); But that does not work as I expect.

Share this post


Link to post
Share on other sites
Advertisement
g_pd3dDevice->SetStreamSource( 0, g_pVB1, 0, sizeof(CUSTOMVERTEX) );
...
g_pd3dDevice->SetStreamSource( 1, g_pVB2, 0, sizeof(CUSTOMVERTEX) );

That second line should be SetStreamSource( 0, not 1.

The 0/1 thing is used for splitting up data between streams. For example a particle system might change the XYZ of each particle per frame, so it is very dynamic. However each particle maintains the same texture coordinates, so it is very static. This could be split into two seperate streams, 0 and 1. You can set both streams and then DrawPrimitive.

I hope this helps.

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!