push and pull

Hello Forum,

I write for the first time in this forum and please excuse me if I make mistakes, I speak very little English.
My question is in regards to OpenGL hierarchies. They are implemented in OpenGL with push and pop, as far as I know. Now when I look at my learning materials to bounding volumes, there is always the talk of push and pull. What’s the difference? Does that push the same in both cases? What is the difference between pop and pull?

Thanks in advance!

That’s something completely different. It refers to pushing and pulling information down or up the hierarchy. That’s it basically, information propagation. Nothing specific to OpenGL.

Which materials are you referring to?

EDIT: Btw:

They are implemented in OpenGL with push and pop

Although one can understand what you mean, your statement doesn’t make much sense. Legacy OpenGL implementations offer(ed) several stacks. A stack is a data structure which, at least most of the times, has push and pop functions for manipulation. So if anything, OpenGL’s glPushMatrix() and glPopMatrix() (and some others) are the equivalent of these commonly specified interfaces. However, they could be named foo() and bar() and still do the same thing. They’re just descriptive names which that describe an abstract concept.

Furthermore, a stack and a hierarchy aren’t the same thing. You can realize hierarchical structures or algorithms such as character animation with the help of a stack, but what legacy OpenGL offers(ed) is(were) stacks - nothing more, nothing less.

Thanks for your answer.
Hope I can explain my question better with the materials:
… oh, ok, I can’t reply with an URL :frowning:
It’s about getting Bounding Volumes.

I thought I understood hierarchy and how to do it by stack (with push and pop).
But then the next topic was Bounding Volumes.
I thought, ok you pick up the transformation matrices along the “road” to the geometry nodes. Then you define a bounding box (an axis aligned boundig-box or something), and bring the results back into world coordinates by using the collected matrices? But isn’t it something you could do like you did hierarchy before? Why is it now “push-pull”.

But if I understand your posting, push-pull is a method or strategy. And push pop with a stack is one possibility to implemet this? Is that right?

push and pop are just naming conventions for parts of a stack’s interface. That’s it. “Push/Pull” is also just a name for an algorithm that passes information from one level of a hierarchy, e.g. a parent node, to another level, e.g. a child node. In the context of accumulating matrices: you push (i.e. pass the information) a matrix from the one node to another - for instance from parent to child. At the child node, you calculate the product of the matrices and push the result down to the child’s child. And so on. When you’re done, you got the object-to-world transformation matrix for the the child node at which you stopped. This is the matrix you pull up the hierarchy - at least conceptually. This is especially true when you implement hierarchy traversal in a recursive manner. You call a function recursively, pushing information from one invocation to another, and when you’re done, you pass the result up to the first invoking function. Ironically, this is actually realized using a stack in system memory. :slight_smile:

In essence, push/pull is a concept which simply refers to passing information from one place to another until you’re done and then pulling the result back to where you started.

:slight_smile: Thank you for your explanation!!