• Advertisement
Sign in to follow this  

how to make a rect.

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

Advertisement
if u just need a colored 2d rectangle:
with two triangles, made of transformed vertices which include data for a diffuse color

Share this post


Link to post
Share on other sites
You're going to want a triangle strip. Take a look here for how to put two triangles together as a strip.

How much do you know about DX?

That's actaully a great tutorial all around, so if the code on that page doesn't make sense, take a look.

Share this post


Link to post
Share on other sites
Try to make use of the d3ddevice->clear() parameters and see if it fits your needs, but using vertices would be the way to go...

Share this post


Link to post
Share on other sites
cant i use

HRESULT ColorFill(
IDirect3DSurface9 * pSurface,
CONST RECT * pRect,
D3DCOLOR color
);

Share this post


Link to post
Share on other sites
ok i tried using colorfill and it didnt work right.

so, how would i make a box using vertices?


see, i am tring to make a progressbar.

Share this post


Link to post
Share on other sites
Quote:
Original post by kingnosis
You're going to want a triangle strip. Take a look here for how to put two triangles together as a strip.

How much do you know about DX?

That's actaully a great tutorial all around, so if the code on that page doesn't make sense, take a look.


Actually, a triangle strip is pretty much pointless for one quad.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dave
Quote:
Original post by kingnosis
You're going to want a triangle strip. Take a look here for how to put two triangles together as a strip.

How much do you know about DX?

That's actaully a great tutorial all around, so if the code on that page doesn't make sense, take a look.


Actually, a triangle strip is pretty much pointless for one quad.


ok, so how would i do it?

Share this post


Link to post
Share on other sites
As a start, create 6 vertices which form 2 primitives. Simple as heck. (you should have 2 duplicates).

If you're feeling more up to a challange, I guess using just 4 verts and an index buffer with 6 indices would be faster, by a bit.

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
As a start, create 6 vertices which form 2 primitives. Simple as heck. (you should have 2 duplicates).

If you're feeling more up to a challange, I guess using just 4 verts and an index buffer with 6 indices would be faster, by a bit.


will this make a 2d box

Share this post


Link to post
Share on other sites
Yeah, I think you need to have a look at the Forum FAQ. It has a LOT of beginner information, including how to draw a square.

Hope this helps.

Share this post


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

  • Advertisement