View Full Version : using WINAPI procedures with opengl

01-30-2011, 07:56 AM
My glutMouseFunc() doesn't handle the mouse scrolling.
So in order to handle it Im forced to use some alternative way apart from Glut. I've read about it in msdn but I didn't figure out where and how to get control over the received mouse event messages. Any idea?

01-30-2011, 11:19 AM
Getting hold of mouse input has always been lacking in Windows. The by Microsoft recommended way to handle this is with DirectInput, but this is a terrible solution as it drags in a large number of dependencies and is outdated as well.

However I've found SDL to be a good alternative. I haven't FreeGLUT or other more recent GLUT clones, but I suspect they also have more complete input support. The original GLUT is so old, scroll wheels didn't even exist back then. :)

01-30-2011, 03:13 PM
GLFW supports scroll wheel too.

02-04-2011, 02:08 AM
Thanx for the answares guys, but I have another question. Do I need to synchronise the threads of callbacks of those functions?

glutMouseFunc( void (* callback)( int, int, int, int ) );
glutMotionFunc( void (* callback)( int, int ) );
glutDisplayFunc( void (* callback)( void ) );

02-04-2011, 05:35 AM
Callback are not threads. Pretty much the opposite, in fact. So no, no need to synchronize anything (unless you add your own threads, but you should not).

02-07-2011, 06:42 AM
Two callbacks called from two paralel distinct treads are still treads. If they are called one after another in the same tread then there's no need for tread synchronisation. So are you sure that the synchronisation is not necessary?

Rosario Leonardi
02-17-2011, 02:30 PM
All glut callbacks are called in the event proc from the same function. No synchronization is needed.
The single thread nature of glut is another reason to switch to another framework.