Original Post
when i use this flag for my vertices, everything is either one color like gray with no apparant shading, or flickering and one shade of color.
here''s the render part, assuming everything else, like the material is set properly, which i think it is since i took it straight from d3d''s help.
#define D3DFVF_CUSTOMVERTEX_TEX ( D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX2 | D3DFVF_NORMAL )
struct CUSTOMVERTEX_TEX {
FLOAT x, y, z; // The transformed position for a vertex
DWORD color; // The vertex color
float tu, tv; // texture coordinates
float nx, ny, nz;
};
// Set render state(s) lpDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); // Set the material lpDevice->SetMaterial( &mtrl ); // Set texture style(s) lpDevice->SetTexture( 0, m_pTexture ); // Prepare vertex buffer and then draw lpDevice->SetStreamSource( 0, m_pVB, sizeof(CUSTOMVERTEX_TEX) );// ) lpDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX_TEX ); lpDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 10 ); // Set render state(s) back to normal lpDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); // Set texture setting to NULL lpDevice->SetTexture( 0, NULL );