I am drawing a scene containing several objects using buffers and pointers, all is working perfectly fine.
The steps I do on (re-)drawing the scene are:
- glMatrixMode(GL_MODELVIEW); and loading identity
- Applying tranformations using glRotate and glTranslate
- Drawing the scene (each object), with
3.1. glEnableClientState with all three arrays
3.2. Binding the buffers and creating pointer to it (vertex, normals, texcoords and indices)
3.3. Drawing with glDrawElements
3.4. releasing the buffer
Now, if I want to translate one of the objects on the fly modifying the modelview matrix before drawing it, I try to glPushMatrix() before loading the matrix, translating it now, for example with glTranslatef(100.0, 100.0, 0.0); and glPopMatrix() afterwards again.
This works perfectly if I debug it using glVertex with GL_POINTs. But it does not seem to have any effects on drawing the coordinates of the bound buffers.
Do I have to do this in a specific order? Binding first, then translating or vice versa? I tried different ways, but without success.
The transformation of the modelview matrix itself works, I verified this checking the matrix (glGetFloatv(GL_MODELVIEW_MATRIX, mat) before and after using glTranslate.
Thanks for any ideas!