PDA

View Full Version : Mouse view changing



t3jem
06-13-2005, 09:45 AM
Hi I have a first person program where I can walk and look around, but I use the keys to do this right now, but what I want to do is make it so I can use the mouse instead. I know how to use glutPassiveFunc() and all, but when I run my program it jumps to much, I want it to be smooth, here is the code for my mouse.


void pmouse(int x, int y)
{
view.look += ((float)x/100-1)/2;
look();
}in my display function I have glutWarpPointer(100,100); to place the pointer back at 100,100. I would have liked to put in my passive function, but it didn't work there.

here is the code that does work for my keys.


if(button[LEFT])
{
view.look -= 0.05*m_elapsedTime;
look();
}
if(button[RIGHT])
{
view.look += 0.05*m_elapsedTime;
look();
}view is the variable for my camera and look() is the function that computes where I should be looking.

does anybody have any ideas?