Sign in to follow this  
lpcstr

FreeGLUT GameMode

Recommended Posts

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.

Share this post


Link to post
Share on other sites
[quote name='lpcstr' timestamp='1317280172' post='4867085']
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. :/[/quote]
Submit a bug [url="http://sourceforge.net/tracker/?atid=101032&group_id=1032&func=browse"]report[/url]?

Share this post


Link to post
Share on other sites
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.

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

Any better suggestions?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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 [url="http://www.glfw.org/"]GLFW[/url], 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 [url="http://www.wreckedgames.com/"]OIS[/url] or [url="http://www.ggi-project.org/packages/libgii.html"]LibGII[/url].

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