Open GL

Hello, Im drawing a circle using open gl but the only thing that is being outputted is a transparent window. I thought GlFlush(); was missing but I added that and it didn't have an effect. Anybody have an idea what is going wrong?

#include <gl/glut.h>
#include <math.h>


int x;
int z;
int y;
int xc;
int yc;
int rad;


void display (void)
{
glBegin(GL_LINE_STRIP);
for (int angle=0; angle > 365; angle=angle+5)
{
float angle_radians = angle * (float)3.14159 / (float)180;
float x = xc + rad * (float)cos(angle_radians);
y = yc + rad * (float)sin(angle_radians);
glVertex3f(x,z,y);
}
glEnd();
glFlush();
}

void init(void)
{
glClearColor(0.95f, 0.95f, 0.95f, 0.0f);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 10.0, 0.0, 10.0);
}

void resize (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h);
}
//Runs the Functions
//Creates the window
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (350, 150);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(resize);
glutMainLoop();
return 0;
}
Hi.
in your function, void display (void)
 
for (int angle=0; angle > 365; angle=angle+5)

the loop condition may be reversed.

Topic archived. No new replies allowed.