damn the matrices!!

I’ve read alot about how it is better to rotate etc. your matrices using OpenGL because it is optimized in your drivers if you have hardware T&L. So you’ll actually be off-loading the math to your GPU instead of bogging down your CPU with it. If you have information to the contrary, please post it as it will probably be pivotal to the decision of many of us OpenGL programmers.

See this thread to see info to the contrary: http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/001519.html

And just in case you haven’t learned about who mcraighead is, he is part of NVIDIA’s OpenGL driver development team. For in the linked thread, he provides the answer you seek.

But we still seem to be at a dead-lock. you said “To rotate the view vector, I would definately use a math library” and you also said “To rotate the model, I would use OpenGL.”, My question is why don’t you use the same routines to manipulate both the camera (or view) and the model, heck they both move the same way (yaw/pitch/roll/move).
This is all getting very confusing, would you mind posting some source code on what you’re talking about.
PS: I’m not disputing the fact that glGet is slow, which is what mcraighead is saying, what I am inquiring about is: what is the best way to the matrix/view (or what ever you want to call it) manipulation

Rotating a single vector and rotating a model are in fact different things. When you rotate a model, you don’t really care where any particular vertex gets transformed to as long as the transformation is consistent and as desired. When you transform a vector, you are doing so for the express purpose of finding the result. The best way to set the modelview matrix is dependent upon your needs.

But who’s talking about rotating the whole model, we’re talking about the stage before that? we’re only interested in the entity that holds information like model origin, heading, local axis, basically the matrix that holds this information. The matrix that you use to project the model.
SO, just like for each model you hold a matrix (which has the origin, and the model’s local x,y,z axis), why not hold a matrix for the view? the only way you would hold the view as a vector is when you’re thinking 2D graphics, or Doom style games (not Quake, no looking up and down), if you want to have 6 DOF, the view should be held as a matrix, so you can do Yaw/Pitch/Roll/move operations. Allow me to demonstrate:
Let’s say you wanna change the pitch on your camera (look up/down) then you rotate about the local X-axis which is the 1st column in the camera matrix (we’re talking about OpenGL matrices, column dominant), however if you hold the camera as a vector (as you say) you would have to hold 3 vectors (for the local axises) + the camera origin, which is the same as the matrix (remember we’re talking about 6 DOF).
SO, if the camera is a matrix, and the models have matrices (for their heading) then why would you use 2 different methods to calculate matrices that are layed out identically?
REMEMBER, we’re only interested in manipulating the heading of the object (camera or model), i.e, we’re only talking about the camera or model matrix and what is the best way to do yaw/pitch/roll/move operations on that matrix.

[This message has been edited by The Wolf (edited 02-07-2001).]

I’m not using two different methods. All matrices and vectors that I calculate, I do so with a math library. I do not use OpenGL as a math library. I give OpenGL the matrix I calculate rather than get the matrix from OpenGL only to give it back again. Period.

the only way you would hold the view as a vector is when you’re thinking 2D graphics, or Doom style games (not Quake, no looking up and down)

Sorry, but you couldn’t be more wrong. You can very easily use a vector to specify any point you want to look at, and another to specify where you want the position of the camera to be. See the view vector is relative to some other vector (the position). So when I say view vector, that automatically implies AT LEAST 2 vectors. Not one vector as you seem to think I thought, which if you reread my post you’ll clearly see I spoke of two vectors for the view. In 6 DOF you would need at least 3 vectors (view heirarchies can require many more). I’m also perfectly aware that vectors are not the only constructs for camera systems. Some people like to use quaternions as well afterall. Of course in the end, since OpenGL only uses matrices, all constructs must eventually be converted to matrices before they are of any use. gluLookAt is one such function for converting a set of vectors into an appropriate view matrix. You don’t have to hold my hand when it comes to matrix math, I am a classicly trained physicist. I’m far too intimate with such things. Take a look at my web page and you’ll see the model viewer I wrote. For that program, I calculated all the matrices (that model in the screenshot has 4 independent parts each with its own rotation matrix and relative position).

[This message has been edited by DFrey (edited 02-07-2001).]

with all due respect, we seem to be going in circles most of the time saying the same thing, and for some reason you keep going back and contradicting yourself, which might be because you misunderstood what we were talking about or vice versa. Anyways no biggy , but in the interest of world peace and this forum PLEASE NO MORE REPLIES ON THIS THREAD. no offence to anyone but this conversation could go on forever, maybe the question can be posted differently in a new light and in a new thread. Thanks

[This message has been edited by The Wolf (edited 02-07-2001).]

I’m sorry, but could you please concisely point out one point on which I contradicted myself? If I did, I’d like to correct the mistake.

[This message has been edited by DFrey (edited 02-07-2001).]

Dfrey wrote : “classicly trained physicist”.

That explains it!

It all boils down to E=mc^2

All kidding aside, Dfrey seems to be correct, I don’t see what you mean wolf, and I suppose we will never find out, since you want this thread to die.

Okay, I can’t resist… DFrey, you are correct when you say that you’d need at least 3 vectors for 6DOF. But why in the world would you preffer to maintain 3 seperate vectors to describe ONE orientation? I’d MUCH rather use a matrix for this. Especially considering you needn’t do much more than to simply use the same matrix as you’re using for whatever object you’re viewing from. If you’re viewing freely from no particular object, GREAT! But if you’re wanting to see something from the perspective of, say, an object in the world such as another player or ship or whatever, then there’s not much more to it than simply grabbing that object’s matrix and using it for your camera (sending those values to gluLookAt or whatever you like). At any rate, I think we all know enough to get done what we want done by now… let’s just leave it at that until we find that we don’t. At which point, we’ll come crawling back to eachother begging for advice. :wink:

Whoa there. At no point did I say I preferred using view vectors over a view matrix. Each different construct has its uses in which it makes more sense. For a heirarchical system I much more prefer matrices over view vectors. For sequencing, I’d prefer quaternions or axis-angle systems.
And yes, even Euler angles are quite ok for most circumstances (when full 6 DOF is not needed). One should use the tool that best makes sense for the job, and different jobs require different tools. But no tool should be misused. Using OpenGL as a math library, is tantamount to using a hammer to drive a screw - it’ll work, but it’s not very efficient or readable. That’s the main message I was trying to get across in virtually all of my posts in this thread.

Whatever…