FreeGLUT GameMode

Started by
3 comments, last by H3g3m0n 12 years, 6 months ago
I recently started a thread about creating my own API agnostic code for handling window and context creation for my game. I've since decided it wasn't worth it, and that I will only be using OpenGL 4.1 and have decided to use GLUT to handle this part of my game.

My issue with FreeGLUT is that if I try to use glutEnterGameMode to go full screen, it totally messes up my display. I am using Linux, and X becomes totally unresponsive (other than mouse) and I have to restart it. This is obviously a problem for me. :/

I'm not particularly interested in other libraries like SDL, Allegro or SFML. They all include functionality that I don't need/want and would be a large dependency to pick up solely for window/context creation and user input.
Advertisement

My issue with FreeGLUT is that if I try to use glutEnterGameMode to go full screen, it totally messes up my display. I am using Linux, and X becomes totally unresponsive (other than mouse) and I have to restart it. This is obviously a problem for me. :/

Submit a bug report?
I've submitted a bug report. Unfortunately I haven't had much luck in the past with bug reports being responded to.

Edit: It seems that the unresponsiveness of X came from the fact I wasn't using glutEnterGameMode properly. However, it still doesn't work.

glutEnterGameMode will create a window in the top left corner and will trap the mouse inside of it, but it does not change the monitor resolution. I can do something like this in Linux, which is obviously a hideous hack.


glutGameModeString("640x480:24@60");
system("xrandr -s 640x480 -r 60");
glutEnterGameMode();


Any better suggestions?
OK, I think I will use glutFullScreen in combination with libXrandr on linux to create a full screen OpenGL window. I register a function with atexit to restore the original screen resolution, but if the program crashed for any reason, you are left with your screen resolution altered. What is the best way to handle this?
The GLUT API is quite dated. And FreeGLUT hasn't seen much work (the last update was 2009) and it's only real goal is to implement GLUT so it's not likely to see much in the way of improvements.

Might I suggest trying out GLFW, it's basically an alternative GLUT, no extra stuff (and their actually planning on removing some stuff for the 3.0 version).

It might also be worth looking at learning the native API's for opening a OpenGL window on your target platform(s) (ie GLX, Wiggle, whatever OSX uses). Then you would really be cutting down. You would probably want to use an input library like OIS or LibGII.

This topic is closed to new replies.

Advertisement