• Advertisement

Luna Inverse

Member
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Luna Inverse

  • Rank
    Newbie
  1. Geometry instancing?

    Hello. I have a little question about the geometry instancing in Direct3D9. I understand it should be useful for drawing a lot of objects using the same vertex data, like trees, and limiting the number of calls to the drawing routine. On the [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb173349(v=vs.85).aspx"]http://msdn.microsof...9(v=vs.85).aspx[/url] page it is shown in the examples: [CODE] if( SUCCEEDED( pd3dDevice->BeginScene() ) ) { for(int i=0; i < g_numObjects; i++) { pd3dDevice->SetStreamSource(0, g_VB_Geometry, 0, D3DXGetDeclVertexSize( g_VBDecl_Geometry, 0 )); pd3dDevice->SetVertexDeclaration( ... ); pd3dDevice->SetVertexShader( ... ); pd3dDevice->SetIndices( ... ); pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, g_dwNumVertices, 0, g_dwNumIndices/3 ); } pd3dDevice->EndScene(); } [/CODE] Which is a contrast to a geometry instancing example. My question is, is the SetStreamSource method required to be called everytime for each object or it is not enough if it is called before the loop? Would this change the rendering performance for the objects or geometry instancing is a must in such cases?
  • Advertisement