Trouble initializing D3D
Hello everyone,
I''ve recently started learning Direct3D (Been using OpenGL for almost a year now). I''m having trouble setting up the vertices for a triangle. I''ve posted the code I''m using below, it''s almost cut and paste from the D3D tutorials in the DX7 Docs, yet it doesn''t compile worth a damn.
//// Code ////
int InitScene(void)
{
D3DVECTOR p1( 0.0f, 3.0f, 0.0f );
D3DVECTOR p2( 3.0f,-3.0f, 0.0f );
D3DVECTOR p3(-3.0f,-3.0f, 0.0f );
D3DVECTOR vNormal( 0.0f, 0.0f, 1.0f );
// Initialize the 3 vertices for the front of the triangle
d3dvTriangle[0] = D3DVERTEX( p1, vNormal, 0, 0 );
d3dvTriangle[1] = D3DVERTEX( p2, vNormal, 0, 0 );
d3dvTriangle[2] = D3DVERTEX( p3, vNormal, 0, 0 );
// Initialize the 3 vertices for the back of the triangle
d3dvTriangle[3] = D3DVERTEX( p1, -vNormal, 0, 0 );
d3dvTriangle[4] = D3DVERTEX( p3, -vNormal, 0, 0 );
d3dvTriangle[5] = D3DVERTEX( p2, -vNormal, 0, 0 );
return(1);
}
Presumably you are using the DX7 SDK and not DX8? That code won''t compile with the DX8 SDK. Plus I presume the d3dvTriangle[] array does exist? Plus you could check the vertex format matches with the primitive drawing calls and the d3dvTriangle[] array (x,y,z,ny,nz,tu,tv = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 in DX7).
( Sorry for the patronizing questions )
If it''s none of those things then what compiler errors are you getting?
( Sorry for the patronizing questions )
If it''s none of those things then what compiler errors are you getting?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement