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


Arc by Delmierda
    // Arc at top of outline
    glBegin(GL_LINE_STRIP);    
        /* draw a circle from a bunch of short lines */
        float radius = 245;
        float originX = 305.0;
        float originY = 440.0;
        float vectorX = 0;
        float vectorY = 0;
        float vectorY1 = originY;
        float vectorX1 = originX+radius;
        
        for(float angle=(-3.14159/2); angle<=(3.14159/2); angle+=0.01f){        
            vectorX=originX+(radius*(float)sin((double)angle));
            vectorY=originY+(radius*(float)cos((double)angle));        
            glVertex2d(vectorX1,vectorY1);
            vectorY1=vectorY;
            vectorX1=vectorX;
        }
        glVertex2d(vectorX1,vectorY1);
    glEnd();