PDA

View Full Version : drawing a circle does not display anything...?



calvarado777
09-05-2012, 07:07 PM
Hello! I am doing a super quick crash course in OpenGL to prepare myself for some research in graphics that I am doing. I have been going through tutorials of drawing simple polygons and all was going great until I got to the circle :-( Everything seems to be compiling and I have googled a lot and everything looks ok...but when I build I just get a white screen. I was hoping to draw a unit circle..and I thought it might be a windowing issue but after searching some more I am not convinced anymore...can anyone help? Thanks!!


void myCircle()
{
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_LINE_LOOP);
const float PI = 3.1415926535;
double radius = 1.0;
int i;
int sides = 20;


for(i = 0; i < 360; i += 360/sides)
{
double angle = PI * i / 180;
glVertex2d(cos(angle), sin(angle));
}

glEnd();

}

I know all of the other pieces of my code are correct because I am able to display other polygons. I've tried window sizes ranging up to 1000 x 1000 and still no luck :-(

Any help would be greatly appreciated!!

calvarado777
09-05-2012, 07:28 PM
newbie mistake...I forgot my glFlush() at the end..works great!