Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RandomAxess

Drawing a set of lines in C++/D3D

This topic is 5731 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

ok, this is gonna sound silly to you guys, but i need help drawing lines in d3d. mind you, i don''t mean using DrawPrimative to render lines, i need to visibly see, say, yellow colored lines. I can make an array of CUSTOMVERTICIES, which is struct CUSTOMVERTICIES { float x, y, z; }; but i have no idea how to color and render them to screen

Share this post


Link to post
Share on other sites
Advertisement

    
struct CUSTOMVERTICIES
{
float x, y, z;
DWORD Color; //Diffuse color used to render

};

LPDIRECT3DVERTEXBUFFER8 pVB; // Vertex buffer that contains the line(s)


... //Create the VertexBuffer

... //Fill in the VertexBuffer using lock() and unlock()


DWORD NumLines = 1; // Number of lines to be rendered


p_D3Ddevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTICIES) );
p_D3Ddevice->SetVertexShader( D3DFVF_XYZ|D3DFVF_DIFFUSE );
p_D3Ddevice->DrawPrimitive( D3DPT_LINELIST, 0, NumLines );


Don't forget to set the world matrices or else you may not
see any line...

Hope that helps

Kamikaze

[edited by - Kamikaze15 on December 6, 2002 9:29:41 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!