glutWarpPointer issue

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);

any thoughts?!? thx in advance.


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

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.)"

i think i misread the original post

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