I'm having some issues getting a simple triangle to render w/ Direct3D9. Culling is off and I'm using one backbuffer. I've checked over my code and read the debug info D3D is giving me and I can't seem to find anything wrong with my code so Im assuming something might be wrong with my FVF.
I've had issues in the past before where I've changed my FVF and all of a sudden something rendered, however this time, my setup isn't going to work correctly with a different FVF.
Anyways, my FVF:
typedef struct{
FLOAT x, y, z;
FLOAT nx,ny,nz;
DWORD color;
FLOAT tu, tv; // The texture coordinates
} CUSTOMVERTEX;
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1)
I've copied the data into a vertex buffer and just to make sure it copied correctly I've locked the VB and copied the data back into a CUSTOMVERTEX array and the values were fine.
CUSTOMVERTEX v;
v.x=150;
v.y=50;
v.z=1;
v.nx=0;
v.ny=0;
v.nz=-1;
v.color=0xffffffff;
v.tu=0;
v.tv=1;
CUSTOMVERTEX v2;
v2.x=250;
v2.y=250;
v2.z=1;
v2.nx=0;
v2.ny=0;
v2.nz=-1;
v2.color=0xffffffff;
v2.tu=1;
v2.tv=1;
CUSTOMVERTEX v3;
v3.x=50;
v3.y=250;
v3.z=1;
v3.nx=0;
v3.ny=0;
v3.nz=-1;
v3.color=0xffffffff;
v3.tu=1;
v3.tv=0;
CUSTOMVERTEX vx[3];
vx[0]=v;
vx[1]=v2;
vx[2]=v3;
void* pVertices;
vertexbuffers[currentface].vb->Lock( 0, 0, (void**)&pVertices, 0 );
//memcpy(pVertices, &vertices[currentface].vertices, sizeof(CUSTOMVERTEX)*face.polycount*3);
memcpy(pVertices, vx, sizeof(CUSTOMVERTEX)*face.polycount*3);
vertexbuffers[currentface].vb->Unlock();
// Double check the VB.
CUSTOMVERTEX vxx[3];
vertexbuffers[currentface].vb->Lock(0, 0, (void**)&pVertices,0);
memcpy(vxx,pVertices,sizeof(CUSTOMVERTEX)*3);
vertexbuffers[currentface].vb->Unlock();
Is there an obvious mistake here or is it more likely that the problem lies elsewhere?
Thanks!