Sign in to follow this  
Mattias Pettersson

Problem opening window in freeglut

Recommended Posts

Hi! I posted this on the newb forum but I didn't get any replies. So I will try my luck here too. I am new to linux and has recently installed ubuntu. I have installed freeglut dev and have been able to compile with gcc and run a window. For some reason I can see the window in front of me for a frame or so. Then it automatically disappear but is still visible in the taskbar. If I click it in the taskbar, it automatically hides itself again. Any ideas? Maybe I should post some code too. int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize (250, 250); glutInitWindowPosition (100, 100); glutCreateWindow (argv[0]); GL_Initialize(); glutDisplayFunc(GL_Display); glutMainLoop(); return 0; } void GL_Initialize(void) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); } void GL_Display(void) { glClear (GL_COLOR_BUFFER_BIT); glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_POLYGON); glVertex3f(0.25f, 0.25f, 0.0f); glVertex3f(0.75f, 0.25f, 0.0f); glVertex3f(0.75f, 0.75f, 0.0f); glVertex3f(0.25f, 0.75f, 0.0f); glEnd(); glutSwapBuffers(); glFlush(); } That's it! Thanks in advance.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this