i add these pieces of code if it can help you :
void direct3dApp::init(){ void *vbContent; void *ibContent; myIDirect3DDevice9->CreateVertexBuffer(3*sizeof(vertexStruct), D3DUSAGE_WRITEONLY,//paramètre le plus performant myFVF, D3DPOOL_MANAGED, //"fond commun" &VBpointer, //pointer to vb NULL); VBpointer->Lock(0, 0, &vbContent, 0);//Locks a range of vertex data and obtains a pointer to the vertex buffer memory memcpy(vbContent, //Destination vertexData, //Source 3*sizeof(vertexStruct)); //Amount of data to copy VBpointer->Unlock() ; long int tabIndices[]={1, 2, 3}; myIDirect3DDevice9->CreateIndexBuffer(sizeof(tabIndices), D3DUSAGE_WRITEONLY, D3DFMT_INDEX32, D3DPOOL_MANAGED, &IBpointer, NULL) ; IBpointer->Lock(0, 0, &ibContent, 0); memcpy(ibContent, tabIndices, sizeof(tabIndices) ); IBpointer->Unlock() ; makeViewMatrix() ; makeProjectionMatrix() ; makeWorldMatrix() ;}
void direct3dApp::rendering(){ /*if(myIDirect3DDevice9 != NULL) { */ //MessageBox(NULL, "toto", NULL, NULL); //const void *data = vertexData; myIDirect3DDevice9->Clear(0, //Number of rectangles to clear, we're clearing everything so set it to 0 NULL, //Pointer to the rectangles to clear, NULL to clear whole display D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, //What to clear. We don't have a Z Buffer or Stencil Buffer D3DCOLOR_ARGB(0, 0, 0, 255), 1.0f, //Value to clear ZBuffer to, doesn't matter since we don't have one 0 ); myIDirect3DDevice9->BeginScene() ; myIDirect3DDevice9->SetStreamSource(0, //StreamNumber VBpointer, //StreamData 0, //OffsetInBytes sizeof(vertexStruct)); //Stride myIDirect3DDevice9->SetFVF(myFVF); myIDirect3DDevice9->SetIndices(IBpointer); myIDirect3DDevice9->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, //PrimitiveType 0, 0, 3, 0, 1); //PrimitiveCount /*myIDirect3DDevice9->DrawPrimitiveUP(D3DPT_TRIANGLELIST, //PrimitiveType 1, //PrimitiveCount data, //pVertexStreamZeroData sizeof(vertexStruct)); //VertexStreamZeroStride*/
myIDirect3DDevice9->EndScene() ;
myIDirect3DDevice9->Present(NULL, NULL, NULL, NULL);