PDA

View Full Version : Keypress problem



gl92038
01-16-2012, 06:53 AM
Hello, I have a small problem.
in main function I declared
keyboard function by using this
glutKeyboardFunc(&KeyboardFunc);
at my KeyboardFunc
I have some key actions like this:
case 'x':
Camera.RotateX(5.0);
Display();// display function
break;

I took camera class from the tutorial where everything works perfectly.
http://www.codecolony.de/docs/camera.htm
So there is no problem in my camera part.

And here goes my Display function
void DisplayFunc(void)
{

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode( GL_PROJECTION );
DrawNet(2,30,30);//draws some lines
Camera.Render();
glutSwapBuffers();
glutPostRedisplay();

}

And when I press my "x" key the camera rotates without stopping. Not the way it does in the tutorial. So I think the problem is somewhere in my code, but I can't figure where.
I appreciate any help :)