Results 1 to 6 of 6

Thread: drawing circles in opengl

  1. #1

    drawing circles in opengl

    i need to develop a simple drawing tool in opengl which will let me draw points, lines, circles and ellipses. these options must be availble by clicking the right mouse button. i can include a line and points but can't get circles to work.

    help please

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Dec 2007

    Re: drawing circles in opengl

    You'll need to "simulate" circles with lines.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Dunblane, Scotland

    Re: drawing circles in opengl

    You'll need to "simulate" circles with lines.

    try a for-next loop and rotate and then translate out the length of the radius.
    I did something like this before, allowing you to choose the number of lines is usefull so you can have anything from a pentagon to a pixel perfect circle.
    Reality is for idiots only the best over come it!

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Adelaide, South Australia, Australia

    Re: drawing circles in opengl

    Rotate and translate out of the radius? huh!? It's far easier just to zzap the verticies:

    for(int i=0; i<CIRCLE_RESOLUTION; i++) {
    float ang=((float)i/(foat)CIRCLE_RESOLUTION)*2.0*3.14159265;
    glVertex2f(cos(ang)*rad, sin(ang)*rad);


    I wanna be a nudist \ And live by the sea \ I wanna be a buisness man \ Drinking lots of coffee --- Regurgitator

  5. #5
    Member Contributor
    Join Date
    Aug 2000
    St. Andrews, Fife, Scotland

    Re: drawing circles in opengl

    It may be easier, but it isn't as nice and it isn't as fast.
    From the man with the
    mac and hence the
    mission POSSIBLE.

  6. #6

    Re: drawing circles in opengl

    simulating the circle is easiest done with sin and cos, it is useful to know that sin and cos are modelled on a circle, sin and cos of an angle will produce two new values which can represent proportional vertices of a circle.

Similar Threads

  1. Drawing multiple circles in OpenGL
    By jhodara in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-09-2018, 02:42 PM
  2. Help with drawing 30 circles going in a circle JOGL
    By Maatzu in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-13-2014, 07:36 AM
  3. Drawing Circles in OpenGL
    By imported_newToOpenGL in forum OpenGL: Windows
    Replies: 3
    Last Post: 10-28-2004, 02:21 AM
  4. Drawing Circles
    By bryonq in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 10-28-2002, 01:10 PM
  5. Drawing circles and up direction vectors
    By Bode in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-24-2002, 12:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean