Jump to content
  • Advertisement

Archived

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

LeLe

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.

If you intended to correct an error in the post then please contact us.

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


Link to post
Share on other sites
Advertisement
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
Thank you very much. And I have to add a RHW to the format since I only want to draw at screen plan.

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!