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:: No Line Numbers


circle by cxmac
1
 
//#include <GL/gl.h>
#include <GL/glut.h>
#include <stdlib.h>
#include <math.h>

#define PI 3.1415926535898
void display (void)
{    

//to first clear all the pixels
    glClear (GL_COLOR_BUFFER_BIT);
    
    float angle = 0.0;
    GLint circle_points = 100;
    glBegin(GL_POINTS);
        glColor3s(1, 1, 1);
        for ( int i = 0; i < circle_points; i++ ) {
            angle = ( 2 * PI * i ) / circle_points;
            glVertex2f( cos(angle), sin(angle) );
        }
    glEnd();