Jump to content
  • Advertisement

Archived

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

ed091maf

How to render

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

It depends on you're API. I assume you mean GL or Direct3D. Also, you don't say whether the poly is convex or concave. Convex polys are quite easy, especially in GL:

glBegin(GL_POLYGON);
glVertex(...); // first point
...
glVertex(...); // last point
glEnd();

In D3DIM, its not quite that simple because you have to split the poly up into triangles yourself - triangulation. This is straightforward for convex polys. Draw some convex ploygons and see how easy it is to turn them into triangle-strips for yourself! Then:

device->Begin(D3DPT_TRIANGLESTRIP,
D3DFVF_VERTEX, 0);
device->Vertex(...); // first point
...
device->Vertex(...); // last point
device->End(0);

Note that there are MUCH more efficient ways of doing this in both GL and D3D when you know what you're doing!

Concave polys are a MUCH more complicated!

Share this post


Link to post
Share on other sites
Advertisement
I want to render n-point polygon. Is it neccessary to triangulate it before rendering, and then render all triangles, or is it better to render without triangulating, and then how to do that?

Share this post


Link to post
Share on other sites
Sorry, for not mentioning the API. Actually i am doing (just for interest) my own rasterizer, and i want to render a convex polygon. And i want to do it in a fast way, so i want to know that fast way.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!