Changing MODELVIEW does not work with gl*Pointer

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:

  1. glMatrixMode(GL_MODELVIEW); and loading identity
  2. Applying tranformations using glRotate and glTranslate
  3. 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):wink: before and after using glTranslate.

Thanks for any ideas!

which buffers are u binding. It seems u r using vertex arrays then simply u just enable the client state for the particular vertex/normal/tex coord. array and simply pass in the pointer using gl[Vertex/Normal/TexCoord]Pointer functions.

I just wanted to post the shortened code, tried it again and it works now. I am not able to reproduce the previous state. I did something wrong before – don’t know what.

After spending hours, days searching errors, it helps just to send a message to a forum or mailing list. Happens so many times… RGRHMBL!

Sorry and thanks for the help!