PDA

View Full Version : Matrix stacks



MaxFive
05-16-2003, 08:17 AM
Any one want to share your opinion about the use of the matrix stacks. As far as my app is concerned, all of stacks only have one element at any given time, but the stack size for the modelview matrix is acturally 32, why?

Korval
05-16-2003, 09:24 AM
That's how a stack works. You can only see the top element of the stack at any given time (or, in the case of GL, the concatonated matrices of all those below them). Does it really matter for you to be able to access the stack 3 matrices down from your current position? In general, when you use a matrix stack, you don't really care about what is below the top matrix.

MaxFive
05-16-2003, 09:36 AM
No. I don't need to access 3 elements below the top of the stack.

My qestion was, what do we need the matrix stack for? Designer of OpenGl sure didn't created those three different types of stacks for no purpose.

roffe
05-16-2003, 09:59 AM
Originally posted by MaxFive:
My qestion was, what do we need the matrix stack for?

The stack is an excellent data structure for un-/doing things in a hierarchical fashion. Consider rotating/moving parts of a human body,Body->Leg->Knee->Foot->Toe->Nail...

MaxFive
05-16-2003, 10:53 AM
Originally posted by roffe:
The stack is an excellent data structure for un-/doing things in a hierarchical fashion. Consider rotating/moving parts of a human body,Body->Leg->Knee->Foot->Toe->Nail...

Thnx. I have been keeping track of the matrix in my app.