PDA

View Full Version : transformations of objects vs. transformations of viewport



08-30-2000, 04:49 AM
i got a really basic problem w/ opengl...
i dont know how to distinguish between transformations (glrotate/gltranslate/etc.) of the view and transformations of objects.
when i call a transformation function, how do i know whether if it will transform the object defined after it or if its going to transform my whole scene?

Bob
08-30-2000, 09:54 AM
You only have one modelview matrix (not counting the stack), and this matrix is applied to everything that has to do with coordinates. It is always going to transform everything you pass. You can't really say it applies to the whole scene, because changing the matrix wont change the objects already drawn. And you can't say it's applied to all objects, because the objects only exists in you structures. To OpenGL they are only a set of primitives, happening to form something that we can asociate with a car for example.

What you can say, is that you first use the modelview matrix to setup the way you look at the scene (using a homemade camera routine for example). Then, when you got the whole scene transformed, you push the matrix to the stack, and transform the first object to it's position in the world (and maybe rotating it some too), draw it, then pop the matrix from stack. And this is done with all objects.

So it will, as we see it on the screen, affect the objects separately and the whole scene at the same time.