Jump to content
  • Advertisement

Archived

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

kevlur

How to draw a rectangle with DX9?

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

Hi, can somebody tell me how can i draw a rectangle empty in the 3D environment of Direct3D, with C++/DX9, having only two vectors(x,y,z), one for the left-up corner, the other for right-down corner, possibly a rectangle that stay on the XZ plane? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Hi

First, you should probably post DX-specific things in the DX forum.

Secondly, there''s a tutorial in the SDK docs on rendering a single triangle which is pretty detailed. You can also try the tutorials over at www.triplebuffer.com, as they start with some very basic stuff.

Share this post


Link to post
Share on other sites
I''m sorry if i should have posted this in the directx forum, but i just wanted to ask how to draw an empty 2D rectangle in Direct3D environment, like those used for selecting multiple objects; and i was wondering if i need to use a function that draws a line, repeating it 4 times or if there is a function that could draw it, using two vectors as parameters, for example (i mean the two opposite angles as a diagonal). Thanks

Share this post


Link to post
Share on other sites
You''d probably just want to draw a line list for something like that.

Share this post


Link to post
Share on other sites
Well, I''m assuming that if you''ve already gotten into DirectX, that you''ve looked into the DrawPrimitive() function and it''s associated usage.

If not, you probably should start with the first tutorial I referred you to to get a hang of the API.

Share this post


Link to post
Share on other sites
I know Drawprimitive() but i thought that it is used only for triangles, or something more complex of a line, thank you, i''ll read MSDN about DrawPrimitive().
Thanks

Share this post


Link to post
Share on other sites
He already gave the answer, use DrawPrimitive with D3DPT_LINELIST. You are right that it usually draws triangles with D3DPT_TRIANGLELIST but it''s not only for triangles, it draws lines as well.

Share this post


Link to post
Share on other sites
And i also believe you need 5 not 4 lines to draw a full square. I have a function somewhere, i could probably post it later but im not at home!

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!