Sign in to follow this  
SouthernMunk

DirectX troubles???

Recommended Posts

I'm having trouble with the DrawPrimitive() method. All I'm trying to do is draw a single diffused triangle, but the triangle just appears black. I don't know if this is because of my failing video card or because I'm doing something wrong programatically. Can anyone help me out? EDIT: You can grab the source here: http://members.optusnet.com.au/~smains/ocau/DirectXSetup.zip

Share this post


Link to post
Share on other sites
Your not telling the device what type of FVF to use. It doesn't know that your vertices are colored and what not.

Example:

struct COLORVERTEX
{
D3DXVECTOR3 v;
D3DCOLOR color;
FLOAT tu;
FLOAT tv;

static const DWORD FVF;
};
const DWORD COLORVERTEX::FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1;
device->SetFVF( COLORVERTEX::FVF );
device->SetStreamSource( 0, m_pGroundVB, 0, sizeof(COLORVERTEX) );
device->SetIndices( m_pGroundIB );
device->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, m_dwNumGroundVertices, 0, m_dwNumGroundIndices/3 );


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this