Archived

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

Draw A Circle?

This topic is 6092 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I want to draw a circle on the screen. How can I do in D3D. Have I to caculate these vertices on a circle?

Share on other sites
I don''t mean to be pedantic but do you mean a circle or a sphere? Either way, if you want to manipulate it and do different things with it (transformations and texturing etc.) you would probably have to calculate all the vertices.

If it''s just for show you could probably get away with a bitmap?

It all depends on what you are doing with it.

Share on other sites
if you can, use a texture. if you wanted a sphere D3DXCreateSphere, if you want a circle, just make a trinagle fan with the origin at the center and the rest of the vertices:
  vertex = new vertexType [numberSegments + 1]float theta = 0.0f;vertex[0].x = vertex[0].y = vertex[0].z =0.0f;for (int i=1; i < numberSegments+1; i++){ vertex[i].x = cos (theta); vertex[i].y = sin (theta); vertex[i].z = 0.0f; theta += 2.0f*PI/numberSegments;}

That is a unit circle of course. You need to apply any necessary transforms.

Edited by - invective on November 15, 2001 7:10:23 AM

Share on other sites
Thank you very much. And I have to add a RHW to the format since I only want to draw at screen plan.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
19
5. 5

• 14
• 26
• 11
• 11
• 9
• Forum Statistics

• Total Topics
631771
• Total Posts
3002253
×