   How do I make object appear and move depending on key pressed and released
  In opengl, glutI want an object to appear and it doesnt move when a key is pressed and moves when released. I know using case in keyboard function.For example void special_keys(int key, int x, int y){  switch(key){  case GLUT_KEY_RIGHT:    if(cam_angle>-80) cam_angle-=5;    break;  default:Is there any other formula?   
  I dont know much about glut, but you should check if you pass the right parameters to your special_keys function (why is this function called special_keys?). Does your function work when you make other things with it which can obviously be recognized (like pop up a message box when pressing a key). In this case, your input function works but you dont move the camera correctly.There is an indication that this might be your problem because you seem to change the camera angle and not the camera position.If your function doesnt recognize pressed keys corretly, you could also use the Windows Message System to look for WM_KEYDOWN Messages, which are sent every time a user presses a button, and WM_KEYUP Messages, which are sent every time a user releases a button.A good place for opengl beginner tutorials is NeHe.This Nehe Tutorial is about rotating simple objects, for example.Quote:Is there any other formula?It seems like you are doing it correctly, but it might be helpful to organize your data in structures and classes. Instead of having a dozen of global variables like camera_x, camera_y, camera_angle etc, it is way cooler to have a class named camera which includes all camera information and one global variable called camera.Additionally, your camera movement is not time based. This is not really important for simple fun applications but recommended especially when you are going to use your programm on other computers which might have a different speed. If you have ever played old DOS games on up-to-date computers, you know what I am talking about [smile]. Passing a variable to your imput function which tells how much time has been passed since the last drawing of the scene and evaluating the degree of the camera movement according to this value is the easiest solution.   