Jump to content
  • Advertisement

Archived

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

plessing

Drawing large polygons

This topic is 5323 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 I have polygons in my app that may potentially contain 1000s of points. I would like to use DX9 to connect & draw the points. I have tried using Managed DX9''s vertex buffer & it works fine for drawing the outer lines but the problem is I''d like to fill them as well. My polygons are just one point after the other and thus not triangles. Do I have to split them up into triangles first or is there a better way. If I do have to split them up, can anyone please tell me how. I would appreciate any help received. Oh, and examples in C++/VB are also welcome. p.

Share this post


Link to post
Share on other sites
Advertisement
I think he means that the vertices only connect with the next point, and don''t link back to any others, thus not forming a triangle, so it''s only rendered as a line.

How are you creating these polygons? Is it some runtime algorithm? If the polygons are the same every time, I would recommend modelling a mesh that would automatically connect them together for you. Connecting all of those vertices by hand could get tedious


Dustin Franklin
Mircrosoft DirectX MVP

Share this post


Link to post
Share on other sites
quote:
Original post by circlesoft
I think he means that the vertices only connect with the next point, and don''t link back to any others, thus not forming a triangle, so it''s only rendered as a line.



yes, thats pretty much what I meant (like connect the dots played by kids). The data is read from file. It''ll be rendered in 2D but I''d like to use D3D for the speed.

would u mind giving me a quick intro to meshes and how I can add all these points to it. And also, how would I fill the polygons? Wont I have to add materials and lights?

thanks for the replies so far.

kind regards,
p.

Share this post


Link to post
Share on other sites
Basically, a mesh is a collection of vertices that form polygons. For a more accurate and substantial description (and implementation), check out the mesh tutorial that comes with the DirectX SDK. It will solve your lighting and material questions, too.

I''m thinking that what you''ll have to do is:
- Model the large polygon in a 3D editor
- Export the model
- Load the model into your program
- Render it

You probably won''t just be able to add the vertices to a mesh, because you don''t have them forming faces. Somehow, you''re going to need to have that (the method I presented should solve that).

Share this post


Link to post
Share on other sites
if the polygon is convex, you can pick one of the points and simply make triangles going around the circle. if it is ''mostly'' convex (take the average of the points positions. if the angle between each point gets bigger every time or smaller every time, that means its not looping around) then do the same, but using the center as the first vertex of every triangle.

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!