Drawing large polygons
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.
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
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
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.
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).
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).
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement