Mouse wheel scrolling with GLUT on Mac OS X

In order to use wheel scrolling event with GLUT on Mac, you should patch the GLUT source code and compile it. The Mac-version GLUT source code is available here on Apple’s developer website. After unzipping, modify or patch the source code appropriately referring to this page. In my MacBook Pro running Lion, I had to use the old Xcode 3 to compile the code. I modified the project settings so that it uses GCC 4.0 as the C/C++ compiler instead of the default GCC 4.2, and rolls back the base SDK to the old Mac OS X 10.5. Then I release built the code and replaced the resulting framework with the existing /System/Library/Frameworks/GLUT.framework after making a backup of course ;).

Now it should send the mouse *up* events having button values of 3 or 4, respectively for wheel up and down.

Mouse wheel scrolling with GLUT on Mac OS X

Notes on Multiple OpenGL windows using GLUT

Call glutCreateWindow for each window. Window size and position can be specified with glutWindowSize and glutWindowPosition prior to glutCreateWindow. Calling glutCreateWindow multiple times effectively creates multiple OpenGL contexts, meaning that you need to properly initialize each context after calling glutCreateWindow. In particular, take care of buffer objects and textures. Those created with a context cannot be used with other contexts.

OpenCL context created with an OpenGL context bound for the inter-operation can neither be used with other OpenGL context which are not bound to OpenCL context (need to be proven).

Notes on Multiple OpenGL windows using GLUT