Direct3D to OpenGL

I was wondering if someone could help me understand the differents between OpenGL equivelants to device.Transform.World = Matrix.Translation(dx, dy, dz) and
device.Transform.World *= Matrix.Translation(dx, dy, dz)

Thanks in advance

Just basicly need to know where to put the:
glPushMatrix(); and glPopMatrix(); and
glLoadIdentity(); for the
= Matrix.Translation(dx, dy, dz) and the
*= Matrix.Translation(dx, dy, dz)

Thanks again

OpenGL doesn’t feature utility functions like this.
You have to construct your own transform matrices (no big deal, right?).

The (fixed function) OpenGL matrix commands operate directly on the matrix on top of the current “matrix stack”:

You can use glLoadMatrix() to assign a defined matrix directly to the top ModelView, Projection or Texture matrix.

If you want to set the top matrix to a particular translation matrix, you can set it to identity, and then multiply it by a translation matrix, like so:


If you want to multiply in an additional translation to the current matrix, all you need is this:


If you want to save and restore the current matrix so you can undo the matrix changes after some drawing, you can use Push/Pop matrix and the above two cases become:

  // draw some stuff
glPopMatrix // back to the matrix state before the push


  // draw some stuff.

But these OpenGL commands do not operate on “your” matrices. They operate on the OpenGL matrix stacks.

There are no OpenGL helper functions to provide generic manipulation of any matrices. Although you could read the resulting matrix off the top of the matrix stack with glGetFloatv, I suppose.

These matrix manipulation commands are more associated with the classic OpenGL fixed function pipeline, and I imagine they are rarely used with shaders (I believe they have been deprecated in recent GL specifications).