LPD3DXMESH pMesh;
if( FAILED(D3DXCreateMeshFVF(1, 3, D3DXMESH_WRITEONLY, D3DFVF_QUADFVF, pD3DDevice, &pMesh) ))
{
systemLog.WriteLog("Create FVF Mesh [FAILED]");
}
//fill vertex buffer with shiz
void* pVertices;
if( FAILED(pMesh->LockVertexBuffer( 0, (void**)pVertices) ))
{
systemLog.WriteLog("Lock Vertex Buffer QUAD [FAILED]");
}
//memcpy(pVertices, quad, sizeof(QUAD_VERTEX)*6 );
pMesh->UnlockVertexBuffer();
D3DXCreateMeshFVF, locking buffer
right, the first part of the code creates a vertex buffer, for
a LPD3DXMESH, which works fine,
how ever when i lock it to right in my data, it fails, i have also tryed using D3DLOCK_DISCARD as the first parameter of the lock buffer, but with no success.
any ideas?
Just a guess (and it''s probably wrong) but maybe you defined D3DFVF_QUADFVF worng. But it''s hard to tell with just this snippet of code.
this is what i have for my structure and fvf
#define D3DFVF_QUADFVF (D3DFVF_XYZ|D3DFVF_TEX1)//X,Y,Z & texture coords.struct QUAD_VERTEX{ float x, y, z; float tu,tv;};
hey,
I think you want to pass the address of your pVertices pointer.
change:
if( FAILED(pMesh->LockVertexBuffer( 0, (void**)pVertices) ))
To:
if( FAILED(pMesh->LockVertexBuffer( 0, (void**)&pVertices) ))
Maybe.
I think you want to pass the address of your pVertices pointer.
change:
if( FAILED(pMesh->LockVertexBuffer( 0, (void**)pVertices) ))
To:
if( FAILED(pMesh->LockVertexBuffer( 0, (void**)&pVertices) ))
Maybe.
quote:change:
if( FAILED(pMesh->LockVertexBuffer( 0, (void**)pVertices) ))
To:
if( FAILED(pMesh->LockVertexBuffer( 0, (void**)&pVertices) ))
Maybe.
There''s no reason to be hesitated here unless it''s a typo, then this is a bug.
Always use the debug runtime (with debug level set to the max) and always check the debug spew. It would''ve told you that you''re passing an invalid pointer.
Cheers,
Muhammad Haggag
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement