GLUT Win32 port

Win32 port of GLUT

Nate Robins is the guy who ported GLUT to Win32. He's done a fantastic job, however, his port of GLUT 3.7.6 hasn't been updated since Nov 2001.

As a result, it doesn't do anything with the mouse scroll wheel. And it doesn't compile "quite right" under Visual C++ 5.0. So, I set out to fix it.

Since I first released a patch, I've had people emailing me more patches to fix other problems in GLUT/Win32, as Nate isn't accepting patches anymore.

I'm happy to accept patches and apply them to my source tree, just drop an email to

GLUT 3.7.6 Win32 Patch | GLUT 3.7.6 Binary (DLL+Lib)

Explainations follow...

Applying Patches

A couple of people have asked how to apply the patch:

Download the .patch file to your GLUT source tree. I'll assume it's in D:\Projects\glut-3.7.6:

D:\Projects\glut-3.7.6> patch -p1 < glut-3.7.6-3.patch
patching file `include\GL\glut.h'
patching file `lib\glut\win32_winproc.c'

And you're done! Go ahead and compile your new GLUT. Enjoy!

Mouse Scroll Wheel in GLUT/Win32

A big difference between Win32 and Linux is how each OS handles the Wouse Scroll Wheel. Linux treats it as two different buttons (4 and 5; or 3 and 4 under GLUT). Win32 just throws messages at the window.

All the development work we're doing utilisies GLUT, for maximum cross platform compatibility.

I wrote barely any of the code, most of it was shamelessly ripped from Hugh Fisher, but behaves differently.

The patch/binary below makes the scroll wheel look to GLUT applications just like they do under Linux. And the best part about it is it won't break other GLUT applications on your system, beacuse Nate's GLUT didn't do anything with the scroll wheel to start with.

Since releasing my patch, Ville Herva emailed me a patch which adds support for 5-button mice. It's all been merged into the patch above.

Renaud Blanch has based an OS/X patch for the mouse scroll wheel on my patch. Check it out here.

Multiple Monitors

In Nate's original GLUT port, you can't extend a GLUT window more than the width of your current resolution (e.g., 1200px, if running 1600x1200).

While this doesn't pose a problem for most users, some users have dual (or more!) monitor setups, and would like to extend the window across multiple monitors.

Ville Herva kindly emailed me a patch to rectify this (it's been merged into the patch above).

Ville claims it works for 1920x1440 on two monitors. I can confirm it works on 1600x1200 across two.