• Advertisement
Sign in to follow this  

D3dfill_wireframe color?

This topic is 4763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know how to set render state so all my objects appear as wireframe but is there an easy way to set the color that all the edges in all the objects will be display in?

Share this post

Link to post
Share on other sites
the wireframe border colors are going to be the interpolated vertex colors.
set the vertices to have the colors you want.

your vertex format may want to look something like this:


D3DXVECTOR3 position;
DWORD color;

with world coords and a color.

then when you initialize the vertex buffer, just assign the colors you want for the vertices.

pDevice->CreateVertexBuffer ( NUM_VERTICES * sizeof(CUSTOMVERTEX),
&m_pVBMask );

pVB->Lock ( 0, 0, (BYTE**) &pVertices, 0 );

pVertices[0] = CUSTOMVERTEX ( D3DXVECTOR3 ( -1.0f, 1.0f, 0.0f ), 0xffffffff );
pVertices[1] = CUSTOMVERTEX ( D3DXVECTOR3 ( -1.0f, 1.0f, 0.0f ), 0xffff0000 );
pVertices[2] = CUSTOMVERTEX ( D3DXVECTOR3 ( -1.0f, 1.0f, 0.0f ), 0xff00ff00 );
pVertices[3] = CUSTOMVERTEX ( D3DXVECTOR3 ( -1.0f, 1.0f, 0.0f ), 0xff0000ff );


(with some error checking of course, but you see how i colored the vertices differently?) hope that helps.

Share this post

Link to post
Share on other sites
Actually, wireframe, lines, etc, all pay attention to your current texture stage states and textures. If you don't want textured, lit, and shaded lines, just tell D3D what you DO want.

TextureStageState's are like a little program that tells D3D what you want mixed (COLORARGn, ALPHAARGn), and how you want to mix it (COLOROP, ALPHAOP). Try something like this:

pDev->SetRenderState(D3DRS_TEXTUREFACTOR, 0xFF123456);
pDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
pDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);

pDev->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
pDev->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);

Which should make everything a nice blue.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement