PDA

View Full Version : Empty display window(issue urgent)



marysowdha
11-06-2001, 03:20 PM
Hi
I am trying to run a simple program
I have gl.h,glut.h,glu.h [compiler]\include\gl
Opengl32.lib,glut32.lib,glu32.lib [compiler]\lib
Opengl32.dll,glut32.dll,glu32.dll [system]
I save my source code in C:\Program Files\Microsoft Visual Studio\MyProjects.

It is displaying an empty window.(I tried up the options of 1).setting the vertices CCW,2)as I am not using any Projection/modelview matrices I hope that is not a problem)
Actually the same program and other couple of programs were working fine and I am facing the problem of empty display window today only.Can somebody suggest why is it happening so?.


The source code
#include<GL\glut.h>

void display()
{

glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5,-0.5);
glVertex2f(-0.5,0.5);
glVertex2f(0.5,0.5);
glVertex2f(0.5,-0.5);

glEnd();
glFlush();
}

int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutCreateWindow("simple");
glutDisplayFunc(display);
glutMainLoop();

}

Please help me in solving this issue.
Mary

dorbie
11-06-2001, 06:03 PM
Try

glutSwapBuffers();

instead of your flush call. I think you have a double buffered visual and are drawing to the invisible backbuffer.