Archived

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

Draw A Circle?

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

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 this post


Link to post
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 this post


Link to post
Share on other sites