# OpenGL question

• 11-06-2004
rayrayj52
OpenGL question
Would this forum be the correct place to ask questions about OpenGL or computer graphics in general?
• 11-06-2004
Sang-drax
Yes.
• 11-06-2004
Thantos
Yes it is.
• 11-06-2004
Shakti
Yes OpenGL questions and other graphic questions can go in this forum, as long as its not windows api you want to ask about, then you should try the windows forum.

Edit: Damn! Beaten!
• 11-06-2004
jverkoey
*points and laughs at all three of you posting at the same time*

:p :p :D :D :D :rolleyes: :rolleyes:
• 11-07-2004
rayrayj52
Ok great, I recently bought a few books on computer graphics and openGL. I am attempting to self teach myself a lot of the material before I take a class next semester. However, I am a little rusty on my matrix math and this question has to do with model-view matrix. I believe this question has to do with taking a translation and rotation matrix and multiplying them together, anyway here is the question provided in the book:

You have a satellite rotating around the earth. Its position is above the earth and stated in polar coordinates. I need to find a model-view matrix that keeps the viewer looking at earth.

I also have noted that the matrix could be used to show the earth as it rotates.
• 11-07-2004
skorman00
Just remember that when dealing with matricies: A * B != B * A

let's take your planet Earth example, and give you a roation matrix that rotates 90 degrees on the y, and a translation matrix that translates <0, -10, 0> (remember, right handed system). Let's also say that the Earth model with no translation or rotation has the North pole pointing along the positive Z axis.

Rotation * Translation = Earth infront of you and a little to the left, and the North pole still pointing at the viewer.

Translation * Rotation = Earth directly in front of you, and the North pole pointing somewhere to your right.

You don't need to keep the Translation and Rotation matricies seperate, but you'll get the same results. There are several ways you can get the correct matrix, so just try some different operations and see which one seems most intuitive to you. It sounds like you'll be dealing with multiple objects as well, so might want to check out glPushMatrix and glPopMatrix instead of always loading the identity. Or, if you're really interested in the math part of it, you can multiply the current model view matrix by it's inverse to get back to the origin for sheer kicks and giggles.