Original Post
Hello all,
I must be making some newbie mistake here that I can''t see.
In the following example I setup the vertext to render a textured quad as a triangle list.
The first triangle gets rendered but the second one doesn''t. The problem appears to be with the lower right vertex because if I switch the order of the vertices then the first triangle doesn''t render and the second one does.
Thanks for the help.
Here is the code:
//Lock the VertexBuffer
SingleTexFVF *pVertBuffer;
m_pD3DVertexBuffer->Lock(0, VERTEX_PER_SPRITE * sizeof(SingleTexFVF), (void **)&pVertBuffer, D3DLOCK_DISCARD);
//Setup the first Vertex
pVertBuffer[0].x = x;
pVertBuffer[0].y = y;
pVertBuffer[0].z = z;
pVertBuffer[0].u = 0.0f;
pVertBuffer[0].v = 0.0f;
pVertBuffer[0].nx = x;
pVertBuffer[0].ny = y;
pVertBuffer[0].nz = -1;
//Setup the second & fourth Vertex
pVertBuffer[1].x = pVertBuffer[3].x = x + m_dwWidth;
pVertBuffer[1].y = pVertBuffer[3].y = y;
pVertBuffer[1].z = pVertBuffer[3].z = z;
pVertBuffer[1].u = pVertBuffer[3].u = 1.0f;
pVertBuffer[1].v = pVertBuffer[3].v = 0.0f;
pVertBuffer[1].nx = pVertBuffer[3].nx = x + m_dwWidth;
pVertBuffer[1].ny = pVertBuffer[3].ny = y;
pVertBuffer[1].nz = pVertBuffer[3].nz = -1;
//Setup the third & fifth Vertex
pVertBuffer[2].x = pVertBuffer[4].x = x;
pVertBuffer[2].y = pVertBuffer[4].y = y - m_dwHeight;
pVertBuffer[2].z = pVertBuffer[4].z = z;
pVertBuffer[2].u = pVertBuffer[4].u = 0.0f;
pVertBuffer[2].v = pVertBuffer[4].v = 1.0f;
pVertBuffer[2].nx = pVertBuffer[4].nx = x;
pVertBuffer[2].ny = pVertBuffer[4].ny = y - m_dwHeight;
pVertBuffer[2].nz = pVertBuffer[4].nz = -1;
//Setup the sixth Vertex
pVertBuffer[5].x = x + m_dwWidth;
pVertBuffer[5].y = y - m_dwHeight;
pVertBuffer[5].z = z;
pVertBuffer[5].u = 1.0f;
pVertBuffer[5].v = 1.0f;
pVertBuffer[5].nx = x + m_dwWidth;
pVertBuffer[5].ny = y - m_dwHeight;
pVertBuffer[5].nz = -1;
m_pD3DVertexBuffer->Unlock();
m_pD3DDevice->SetFVF(SINGLETEX_FVF);
m_pD3DDevice->SetStreamSource(0, m_pD3DVertexBuffer, 0, sizeof(SingleTexFVF));
m_pD3DDevice->SetTexture(0, m_pD3DTexture);
m_pD3DDevice->SetMaterial(m_pD3DMaterial);
m_pD3DDevice->DrawPrimitive(0, 2);