   handling key presses
  Hello, I am very new to OpenGL and SDL and I've been playing around with it. I have been able so far to change the background color by pressing different keys. Now I am wondering how I can move a shape up or down by hitting a key. For example:case SDLK_1:    glTranslatef( -1.5f, 0.0f, -6.0f );    break;This doesn't work. I expected it to move the shape in the drawGLScene but it didn't. Does anyone know another way of doing this?   
  It might be better to put the glTranslate in your draw code and use a variable to communicate the amount of translation.  In other words, your draw code (which is elsewhere) might look like this:glPushMatrix();glTranslatef(-1.5f, 0.0f, ztrans);DrawStuff();glPopMatrix();and then in your SDL code:case SDLK_1:ztrans=-6.0f;break;This way you don't have to wonder where in the OGL stream the translate comes.   ;  I tried doing that but since they are in different functions it says ztrans is undeclared. So how do I get the key handling into the draw function to change it.   ;  what about declaring ztans outside any function? =D   ;  What do you mean by that? You can't put it in the SDL code can you?   