PDA

View Full Version : Drawing a circle in pixels



glguy
05-03-2006, 12:34 PM
Hello,

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?


thanks.

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

mikael_aronsson
05-04-2006, 03: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.

Mikael