OpenGL: Matrix Stack Manipulation

Hello everyone, I’m an Italian student, so you have to excuse me if my English is not perfect.
I have some problems using the matrix stack in an application for an exam. In particular, the application implements a model viewer and i have to modify it:

  1. positioning just 3 different geometric models in the scene using OpenGl function: glPushMatrix() and glPopMatrix().
  2. Permit translation, rotation of the single object respect of the WCS, OCS, VCS reference system. The single objects must be selected by means of ‘1’ ‘2’ ‘3’ key. The trasformations of translation or rotation must me applied by means of key ‘x’ ‘X’ ‘y’ ‘Y’ ‘z’ ‘Z’. The selection of the type of the transformation (translation/rotation) and the reference system must be done with:
  • ‘o’ translation respect OCS
  • ‘O’ rotation respect OCS
  • ‘w’ translation respect WCS
  • ‘W’ rotation respect WCS
  • ‘v’ translation respect VCS
  • ‘V’ rotation respect VCS (with the direction of the rotation axis same of the VCS and pass through the Origin of the VCS).

I ask you some help. I can’t do it and maybe you can provide me some suggestions.

Thank you everyone

I assume OCS, WCS and VCS mean object world and view coordinate systems.

In OpenGL fixed function (which you’re using because you have pushmatrix and popmatrix) you have the modelview matrix and the projection matrix.

The whole OCS WCS and VCS is kinda bullshit because these are spaces between matrices not the matrices themselves. But it invites a treatment of pre vs post multiplication on modle and viewing matrices I guess.

Your basic setup is:

object vertices -> [model] -> world vertices -> [view] -> eyespace vertices

So you have an object and it’s matrix I assume, you also have a viewing orientation.

model and view matrices and concatenated into a single matrix for the OpenGL modelview.

You can apply an additional transformation matrix by concatenating before between or after the matrices.

But I think this question or the way you’ve presented it is a bit if a screwed up exercise IMHO, because practically you want to have matrices and then apply edits to them then keep them in some concatenates space. So typically you edit the model matrix or view matrix, and have a hierarchy of these.

There’s also view space stuff you might do that gets transformed into the object space and orients the model matrix without adjusting the view matrix.

What you can’t really do is edit the eyespace orientation for one object without moving the viewer for the other objects unless you’re doing eyespace manipulations of the model matrix.

So I think it’s a little bit ill-defined IMHO.

Do not crosspost to multiple forums.