PDA

View Full Version : Glut Game mode is not working



pmatos
02-02-2004, 11:38 AM
Hi all,

I have this in my main():
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_ACCUM | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("EcoSim");

glutGameModeString("");
// enter full screen
if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE))
glutEnterGameMode();
else {
cout << "The select mode is not available." << endl;
exit(1);
}

glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
glutKeyboardUpFunc(keyboardUp);
glutSpecialFunc(keyboardSpecial);
glutSpecialUpFunc(keyboardSpecialUp);
glutIgnoreKeyRepeat(1);

//This is just to call the game constructor for the 1st time.
game *state = game::Instance();

glutMainLoop();

return 0;


However, I always get:
The select mode is not available.

I've tried 1024x768, 1400x1050, 800x600... almost everything and nothing works. Why? Any ideas?

best regards,

Paulo Matos

vongart
02-11-2004, 06:11 AM
Hi, I have the next sequence in the main function.

int main(int argc,char **argv) {
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
glutGameModeString("800x600:16@60");
glutEnterGameMode();
glutSetCursor(GLUT_CURSOR_NONE);
init();
glutDisplayFunc(display);
glutIdleFunc(idle);
glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
glutMotionFunc(motion);
glutPassiveMotionFunc(motion);
glutMainLoop();
return 0;
}

As you can see, there is a difference in the way the window is initialized.

By the way, as I remeber game mode was introduced on glut 3.7, you may also check you glut version.

Note:
I ran this code on 2 computers running windows 2000, with differents video cards, one of them displayed a error when I double click on the exe, however if I used a .bat to run the program it worked.

Regards.
Jack

[This message has been edited by vongart (edited 02-11-2004).]

chemdog
02-16-2004, 05:23 AM
Also, gamemode isn't officially supported till version 4.