glut vs. Win32 vs. MFC

I have some experience with openGL under glut, MFC, and vanilla Win32 and I was wondering if anyone had strong opinions about the pro’s and con’s of the different approaches to windowing.

I am about to start a fairly large OpenGL project which will entail doing some interactive virtual worlds sort of stuff with lots of wacky, off-the-beaten-path input/output devices.

Oh yeah, I guess I should add that my application will probably spend most or all of its time in a full-screen mode, which means I’m not needing to use any Windows GUI widgets.
I’m kind of leaning towards glut, but I thought I’d see if anyone had compelling arguments to the contrary.

I wouldn’t bother with MFC in this case; it doesn’t gain you anything and it creates a hell of a mess.

GLUT is pretty good in most respects, but a couple of points to bear in mind:

  1. Although you can run fullscreen in glut 3.7, you can’t actually change screenmode (i.e. resolution or colour depth).

  2. glut’s support for input controllers is a bit limited (only recognizes 2 joystick axes, and I think buttons are quite limited as well). You may be able to use input device APIs alongside glut though - anybody tried this?

  3. You can’t get at the message pump. Some performance impact, but not a huge one.

If these are OK, go with glut. Otherwise, you’re probably better off with vanilla Win32.

Totally agree with MikeC except on 1. You can change resolution with GLUT 3.7. Although I haven’t found any docs on it, but after looking in the source… try this:

void glutGameModeString(const char *string);
int glutEnterGameMode(void);
void glutLeaveGameMode(void);

The format for the mode string, for example:

Instead of glutCreateWindow you call glutEnterGameMode, but before that you should ofcourse specify resolution with glutGameModeString. At exit call glutLeaveGameMode.

Well, thats it. Although I had have little success with this on voodoo cards it works on all other cards I tested.

The only documentation I found on this is the man pages that comes with the source and source itself, doh.


about mode changing, when i was using glut i usually set the new screen reolution with a call to ChangeDisplaySettings() BEFORE calling the first glut function (glutInit() or something like that)

however, i’ve found no way to freerly make it change when the application was running…


You can check the asteroid demo in the Glut distribution for an example of GlutGameMode.