in C/C++ // Create the circle in the coordinates origin const int sides = 20; // The amount of segment to create the circle const double radius = 5; // The radius of the circle glBegin(GL_LINE_LOOP); for (int a = 0; a < 360; a += 360 / sides) { double heading = a * 3.1415926535897932384626433832795 / 180; glVertex2d(cos(heading) * radius, sin(heading) * radius); } glEnd(); --- in C# and TAO FrameWork
// Create the circle in the coordinates origin for (int a = 0; a < 360; a += 360 / sides) { heading = a * MathEx.deg2Rad; vertices.Add(new Vector3d(Math.Cos(heading) * this.radius, Math.Sin(heading) * this.radius, position.Z)); } Rendering
Gl.glBegin(Gl.GL_LINE_LOOP); for (int i = 0; i < vertices.Count; i++) Gl.glVertex3dv(vertices[i]); Gl.glEnd(); Reference: http://www.opengl.org/discussion_boards/showthread.php/169668-How-to-draw-circle
From: http://sitestree.com/?p=951
Categories:Web Development, Root, By Sayed Ahmed
Tags:
Post Data:2014-04-06 01:01:42