opengl window
How do I close the openGL window without closing my main window ?
if i create the opengl window like this :
int main ( int argc, char** argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize ( 640, 480 );
glutCreateWindow ( argv[0] );
init ( );
glutReshapeFunc ( reshape );
glutMouseFunc ( mouse );
glutMotionFunc ( motion );
glutKeyboardFunc ( keyboard );
glutSpecialFunc (vSpecial );
glutDisplayFunc ( display );
glutIdleFunc ( idle_func );
glutMainLoop ( );
return 0;
}
GLUT needs at least one window to works. If you are talking about the Win32 console window, you could do something like this:
int main ( int argc, char** argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize ( 640, 480 );
glutCreateWindow ( argv[0] );
init ( );
glutReshapeFunc ( reshape );
glutMouseFunc ( mouse );
glutMotionFunc ( motion );
glutKeyboardFunc ( keyboard );
glutSpecialFunc (vSpecial );
glutDisplayFunc ( display );
glutIdleFunc ( idle_func );
glutMainLoop ( );
//----------------------------------------------------------
// Do something else here before return to the system.
//----------------------------------------------------------
//...
return 0;
}
int main ( int argc, char** argv )
{
glutInit ( &argc, argv );
glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize ( 640, 480 );
glutCreateWindow ( argv[0] );
init ( );
glutReshapeFunc ( reshape );
glutMouseFunc ( mouse );
glutMotionFunc ( motion );
glutKeyboardFunc ( keyboard );
glutSpecialFunc (vSpecial );
glutDisplayFunc ( display );
glutIdleFunc ( idle_func );
glutMainLoop ( );
//----------------------------------------------------------
// Do something else here before return to the system.
//----------------------------------------------------------
//...
return 0;
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement