I'm using opengl with MFC for developing the 3d application.Here the problem is if I use glutKeyboardFunc(keyboard) both the objects(room and cube)are moving but I want to make move for onlly cube.Here I'm giving the code can anyone suggest how to make movement for only cube. Code: void MFCOpenGL:isplay(void) { glDrawBuffer(GL_FRONT_LEFT); //glColor3f(1, 1, 1); glClearColor(1,1,1,1);//set the background color to black glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glBegin(GL_QUADS); glColor3d(1.0, 0.0, 0.0); glVertex2d(0.0, 0.0); glVertex2d(2.4, -0.35); glVertex2d(2.45, 2.5); glVertex2d(0.0, 2.7); glEnd(); glBegin(GL_QUADS); glColor3d(0.0, 0.0, 1.0); glVertex2d(-2.5, -0.; glVertex2d(0.0, 0.0); glVertex2d(0.0, 2.7); glVertex2d(-2.5, 2.0); glEnd(); glBegin(GL_QUADS); glColor3d(0.0, 0.0, 0.0); glVertex2d(-2.5, -0.; glVertex2d(-0.3, -2.0); glVertex2d(2.4, -0.35); glVertex2d(0.0,0.0); glEnd(); glColor3f(0.0, 1.0, 1.0); glutSolidCube(0.5); glutSwapBuffers(); glutPostRedisplay();//end of insertion } void MFCOpenGL::Resize(int width,int height) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, (float)width / (float)height, 0.1, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // Set the viewing position and orientation gluLookAt( 0.0, 0.0,10.0, // eye location 0.0, 0.0, 1.0, // center location 0.0, 1.0, 0.0); // up vector } void MFCOpenGL::keyboard(int key, int x, int y) { switch (key) { case 'a': case 'A': glTranslatef(-1.0, 0.0, 0.0); break; case 'd': case 'D': glTranslatef(1.0, 0.0, 0.0); break; case 'w': case 'W': glTranslatef(0.0, 0.0, 1.0); break; case 's': case 'S': glTranslatef(0.0, 0.0, -1.0); break; } }