[DX9] DrawPrimitiveUP not taking Tranform and Color into account

Started by
0 comments, last by Buckeye 13 years ago
Hi,

Im drawing everything in my scene using effects (ID3DXEffect) and ID3DXMesh::DrawSubset.

There are only one type of object (MeasurementLines) that Im rendering using IDirect3DDevice9::DrawPrimitiveUP. Im drawing these MeasurementLine objects after Im rendering all the others, but I cant seem to set the IDirect3DDevice9::SetTransform and the device does not draw these lines the color that I set them when I create their FVF.

Im probably missing something fundamental, but dont know what it is.


D3DVertexColor l_aVertexPositionData[2];

l_aVertexPositionData[0].position.x = this->m_pStartPoint->GetWorldTransform()->GetPosition().x;
l_aVertexPositionData[0].position.y = this->m_pStartPoint->GetWorldTransform()->GetPosition().y;
l_aVertexPositionData[0].position.z = this->m_pStartPoint->GetWorldTransform()->GetPosition().z;

l_aVertexPositionData[1].position.x = this->m_pEndPoint->GetWorldTransform()->GetPosition().x;
l_aVertexPositionData[1].position.y = this->m_pEndPoint->GetWorldTransform()->GetPosition().y;
l_aVertexPositionData[1].position.z = this->m_pEndPoint->GetWorldTransform()->GetPosition().z;

l_aVertexPositionData[0].color = 0xff000000;

l_aVertexPositionData[1].color = 0xff000000;

D3DXMATRIX l_d3dmIdentity;

D3DXMatrixIdentity( &l_d3dmIdentity );

HRESULT hr;

ENGINEMANAGER->GetGraphicsDevice()->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE );

hr = ENGINEMANAGER->GetGraphicsDevice()->SetTransform( D3DTS_WORLD, &l_d3dmIdentity );

hr = ENGINEMANAGER->GetGraphicsDevice()->SetTransform( D3DTS_VIEW, &D3DCAMERAMANAGER->GetActiveCamera()->GetProjectionMatrix() );

hr = ENGINEMANAGER->GetGraphicsDevice()->SetTransform( D3DTS_PROJECTION, &D3DCAMERAMANAGER->GetActiveCamera()->GetViewMatrix() );

ENGINEMANAGER->GetGraphicsDevice()->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );

hr = ENGINEMANAGER->GetGraphicsDevice()->DrawPrimitiveUP( D3DPT_LINESTRIP, 1, (void *)l_aVertexPositionData, sizeof( D3DVertexColor ) );


So in summary, it draws the line primitive, but does not take the color I specify or the Word transform into account. How do I fix this?
Advertisement
Does the Debug Runtime provide any information?

What problem are you having setting the world transform?

How do you have your lighting set up?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement