GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


trig'd by godecho
    GLfloat r                    =  5.0f;
    GLfloat depth                = -5.0f;
    unsigned int subdivisions    =  1000;
    GLfloat angle                =  360.0f/(float)subdivisions;
    GLfloat rads                =  GLfloat(PI / 180.0f);

    GLfloat theta;
    
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    
    glBegin(GL_TRIANGLE_FAN);

        glVertex3f(0.0f, 0.0f, depth);
        
        for(unsigned int x = 0; x < subdivisions+1; ++x)
        {
            theta = (x * angle * rads);
            glVertex3f(    r*sin(theta),
                        r*cos(theta),
                        depth);
        }

    glEnd();