PDA

View Full Version : glutWarpPointer issue



coredump
07-23-2001, 12:59 PM
i'm testing a glut app on windows and using glutWarpPointer in my main loop before enteing gutMainLoop works great. but when i move it into my passive mouse func my app comes up blank. actually, not blank. it comes up empty (desktop visible behind).

...
void passive(int x, int y)
{
cursor_pos.x = x;
cursor_pos.y = y;
cursor_pos.x -= 400;
cursor_pos.y -= 300;
glutWarpPointer(cursor_pos.x, cursor_pos.y);
glutPostRedisplay();
}

any thoughts?!? thx in advance.

b

zed
07-23-2001, 01:17 PM
u prolly want to stick this ->glutPostRedisplay elsewhere cause you want the window to be drawn every frame.
at it stands now its only get called when the passive function gets called (ie when u move the mouse) the rest of the time nothing will get drawn. so stick it back in the main loop

07-23-2001, 02:35 PM
My guess is that the error is somewhere else than in glutWarpPointer. Does it really works if you comment out that line?

A quote from the manpage (as a sidenote) :
" The following is good advice that applies to glutWarpPointer: ``There is seldom any reason for calling this
function. The pointer should normally be left to the user.'' (from Xlib's XWarpPointer man page.)"

zed
07-23-2001, 04:58 PM
i think i misread the original post

does s/he want to do
pos.x -= 400
or
pos.x = 400 (more normal)