View Full Version : Drawing a circle in pixels

05-03-2006, 11:34 AM

I'm trying to draw a 50x50 circle (with a transparent background) using glDrawPixels(). There's nothing in the Red Book that shows how I can do this. Any ideas?


05-03-2006, 11:55 AM
With a fiew maths and an orthographic view simply apply the circle maths equation.

05-04-2006, 02:17 AM
Hmmm, why use glDrawPixels ? and if you are then I assume you already have your circle some where in a buffer and want to draw it ? then just have a look at the documentation for glDrawPixels.
glDrawPixels (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc01_6lbn.asp)

The alpha value in your buffer is used for transparent pixels.

If you need help with the actual circle I suggest that you dig up your old math book from school and have a peek, you might even find it in the documentation for cos() and sin() functions.

But I would suggest you render the circle with glBegin( GL_LINE_STRIP) instead.