Mousebutton Down State

Hi, how can I find out if the mouse button is down without using the Win32 API (WM_LBUTTONDOWN).

I want the whole program to be portable so I’d like the glut state.

I know of glutMotionFunc, but that is only called if you move the mouse while pressing the button.

Thx

Here is the spec’s on glutMouseFunc http://www.opengl.org/developers/documentation/Specs/glutspec3/node50.html?glutMouseFunc#first_hit

glutMouseFunc(int button, int state, int x, int y)

state is button up GLUT_UP or down GLUT_DOWN.

example:

mouse(int button, int state, int x, int y)
{

if ((button == GLUT_LEFT_BUTTON ) && (state == GLUT_DOWN))
{
Do something when the left button is pressed!
called only on state change.
}

if ((button == GLUT_LEFT_BUTTON ) && (state == GLUT_UP))
{
Do something when the left button is released.
}
Hope this helps…

Originally posted by elimin8tor:
[b]Hi, how can I find out if the mouse button is down without using the Win32 API (WM_LBUTTONDOWN).

I want the whole program to be portable so I’d like the glut state.

I know of glutMotionFunc, but that is only called if you move the mouse while pressing the button.

Thx[/b]