Original Post
Hi Recently i created a vertex-,indexbuffer- and vertexbufferclass but for some reason my screen just rests empty. Before i started to write those classes i just used the usual Direct3D Buffers(which are now wrapped by my classes) and it worked without a problem. As i reworked that whole vertex,index part of my engine i also changed from calling mesh.render() to renderer.render(Mesh); and that is all i changed. I thought that somebody with my buffer classes is wrong BUT the D3DBuffers that my own Buffer classes pass to SetStreamSource are the same in memory. Btw. what is LPDIRECT3DVERTEXBUFFER9? is it just a pointer? but why can 2 vertexbuffer than point to the same buffer? does DirectX look if there's already a buffer with the exact same size? that would be a very rare case. So has anybody an idea where the problem could lie? When the buffers are exactly the same in memory does the error have to be caused by the change from mesh.render(); to renderer.render(mesh);?(because that's the only thing i changed apart from the vertex,index stuff) mesh.render(); renderer.render(mesh) PS: i also checked the FVF and the Prim Type which are identical in both cases regards, m4gnus
void ngMesh::render()
{
m_pEngine->g_pD3DDevice->SetFVF(FVF); m_pEngine->g_pD3DDevice->SetStreamSource(0,pVBuffer,0,sizeof(complVertex));
m_pEngine->g_pD3DDevice->SetIndices(pIBuffer);
int VertSize=complVertices.size();
int IndSize=Indices.size();
LPDIRECT3DVERTEXBUFFER9 ngVBuff;
LPDIRECT3DINDEXBUFFER9 ngIBuff;
ngVBuff=pVBuff->getD3DVBuffer();
ngIBuff=pIBuff->getD3DIBuffer();
int vsize=sizeof(pVBuffer);
int isize=sizeof(pVBuffer);
m_pEngine->g_pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,complVertices.size(),0,Indices.size()/3);
}
void Draw(ngVertexBuffer *pvbuffer,ngIndexBuffer *pibuffer)
{
int size=D3DXGetFVFVertexSize(pvbuffer->getFVF());
int size2=pvbuffer->getVertexsize();
D3DVERTEXBUFFER_DESC desc;
pvbuffer->getD3DVBuffer()->GetDesc(&desc);
ngEngine &engine=ngEngine::getInstance();
int triangleCount=pibuffer->getLength()/3;
DWORD fvf=pvbuffer->getFVF();
engine.g_pD3DDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
engine.g_pD3DDevice->SetFVF(pvbuffer->getFVF());
engine.g_pD3DDevice->SetStreamSource(0,pvbuffer->getD3DVBuffer(),0,pvbuffer->getVertexsize());
engine.g_pD3DDevice->SetIndices(pibuffer->getD3DIBuffer());
engine.g_pD3DDevice->DrawIndexedPrimitive(pvbuffer->getPrimType(),0,0,pvbuffer->getLength(),0,triangleCount);
}