   last step in rotation issue
  Thanks to the friends that answered my previous question.I attend the suggestion of them I get my square rotating in the window but there is a more little issue. How can I get the square stops rotating when I release the key (right or left arrow key in this case). I tried with SpecialKeyUpFunc() but it dosn't help, that part of code (see below) makes the square stay quiet.Some idea to accomplish this?: when the user hold the key pressed, the body must rotate BUT when the user release that key, the body must stop rotating.Please Help.#include <Gl/gl.h>#include <Gl/glu.h>#include <Gl/glut.h>#include <stdlib.h>float delta=0.0;static GLfloat spin=0.0;void init(void){glClearColor(0.0,0.0,0.0,0.0);glShadeModel(GL_FLAT);}void spinDisplay(void){spin=spin+delta;if (spin>360.0)spin=spin-360.0;glutPostRedisplay();}void display(void){ // draw an squareglClear(GL_COLOR_BUFFER_BIT);glPushMatrix();glRotatef(spin,0.0,0.0,1.0);glColor3f(1.0,1.0,1.0);glRectf(-5.0,-5.0,5.0,5.0);glPopMatrix();glutSwapBuffers();spinDisplay();}void reshape(int w, int h){glViewport(0,0,(GLsizei)w,(GLsizei)h);glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(-50.0,50.0,-50.0,50.0,-1.0,1.0);glMatrixMode(GL_MODELVIEW);glLoadIdentity();}GLvoid keyboard(int specialKey, int x, int y) {   switch(specialKey) {case GLUT_KEY_LEFT:  delta=0.05f;  break;   case GLUT_KEY_RIGHT:   delta=-0.05f;  break;    default: break;}}/* This part of code dosn't work as I expectedvoid SpecialKeyUpFunc(int key,int x,int y) {    switch(key){   case GLUT_KEY_LEFT:   delta=0.0;  break;   case GLUT_KEY_RIGHT:   delta=0.0;  break;    default: break;}}*///++++++++++++++++++++++++++++++++++++++++++++++int main (int argc, char** argv){    glutInit(&argc,argv);    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);    glutInitWindowSize(300,300);    glutInitWindowPosition(100,100);    glutCreateWindow("Rotation Keyboard Controlled");    init();    glutDisplayFunc(display);    glutReshapeFunc(reshape);    glutSpecialFunc(keyboard);//    glutSpecialFunc(SpecialKeyUpFunc);    glutMainLoop();    return 0;}   
 The commented line you have at the bottom that says glutSpecialFunc should actually be glutSpecialUpFunc. Then uncomment your keyup function itself and it should work fine. ;)   ;  If I were you I would go with a different approach. First make a global variable called spinIt and set it to false; In your display function, make a condition saying that if spinIt==true then spinDisplay(). And in your keyboardfunction make  it so that when the user presses right or left key then spinIt =true. And if the user releases it then spinIt = false;   ;  Thanks both of you buddies, I corrected my code as radioteeth said and works fine now. Tnutty, I think your approach will run ok also but what would be advantageous ? memory usage? cpu usage?.OK, anyway, I apreciate your help very much.   