What better(faster):gluLookat or glTranslate/Rotate?

What better(faster):gluLookat or glTranslate/Rotate?

Since i bet you only will call it a few times per frame it doesnt matter… Put your energy on more practical optimizations.

and the correct answer : depends on the number of rotate/translate you have to do

/Mazy

If you are trying to make something like ‘camera’ take gluLookAt. It makes your code simpler and work good so many people use it (even in professional applications).

It also depends of what your are doing really. There are some uses where glTranslate/glRotate would be more suitable.

To make it fastest (IMHO) - if your camera is very simple you don’t have to use gluLookAt (it would work faster). In other case use it.

Orzech

As long as u guys use the GLU junk functions or use stuff like glTranslate/Rotate etc instead of own ma3x ops you will probably stay in the beginners forum

Originally posted by Mihail121:
As long as u guys use the GLU junk functions or use stuff like glTranslate/Rotate etc instead of own ma3x ops you will probably stay in the beginners forum

So why are you here if you are in ‘advanced forum’, my guru?

I think there is no need of writing your own matrix operations - of course you can do it that way but in many programs there is no need of complicating your code. OpenGL commands works ok and you can fell free to use them.

Originally posted by Mihail121:
As long as u guys use the GLU junk functions or use stuff like glTranslate/Rotate etc instead of own ma3x ops you will probably stay in the beginners forum

interesting… but i actually don’t see any reason why should i do transormation myself when driver does the job cool (and i think my routine as well as routine downloaded from some abandoned site will never employ some hardware acceleration - such as 3dnow!)…

Does gluLookAt is created with glTranslate and glRotate???

As long as u guys use the GLU junk functions or use stuff like glTranslate/Rotate etc instead of own ma3x ops you will probably stay in the beginners forum.

So why do you think your own matrix functions will be beter/faster? I think that you should use the gl functions because these could take advantage of a fast GPU while your functions will be done on the CPU.
I could be wrong here…

Unless you’re writing Cg shaders or something I think it’s a wast of time to write your own matrix functions since they will do the same thing the gl functins do and may even be slower…
If you write a Cg shader you must write your own matrix functions.
However, I don’t think it is a waste of effort to implement your own lighting model if opengl’s model does not cut it for you.
But, you should do this with hardware shaders if possible, because a GPU can do this alot faster than a CPU ever can.

Does gluLookAt is created with glTranslate and glRotate???

well, that’s … the first answer is “no”, but that might not be true. The way it computes rotations are almost certainly never done with glRotate: it probably exploits the trick of building an orthonormal matrix by computing directional vectors and building the rotation directly. It ~could~ use glTranslate to translate the camera, but since its building a 4x4 matrix and uploading it to opengl anyway, it may as well modify the 4th column itself, too.

so, the short answer is still “no”.

I think that if we use gluLookat we do next steps:

  1. Calculate position of camera
  2. Calculate position of target
  3. Calculate position of up vector
  4. Let OpenGL calculate matrix using previous data.

If we use glTranlate/Rotate we only let OpenGL calculate matrix. Doesn’t it faster?

Yeah i want to say sorry.I’m now respected and will go tell all gamedev companies to stop using own ma3x ops and start using glTranslate/glRotate etc.It’s just a bit intresting how they haven’t thought of that yet.Perhaps they’re dumm!

GluLookAt wont be accelerated by the gpu, neither by 3dnow and similar, since its a pretty old library, and since it doenst talk to the cards driver directly, only through the gl library the math involved in gluLookAt just creates a matrix with the CPU you wont benefit of the fact that some expensive cards might do glRotate and glTranslate in HW, but thats besides the point if youre just making a camera, since that probably never will affect the speed if your program ( unless you move the camera several thousands times per frame you can use for a easy camera implementation.

Mihail121 : just becourse own matrix routines are good for games, and servral other applications doesnt mean that glTranslate and glRotate are useless… i bet many proffesional programs uses them , especially if you show objects, not entire worlds, and you know that your target gfxcard implement the whole matrixpipeline in HW…

Originally posted by Mihail121:
As long as u guys use the GLU junk functions or use stuff like glTranslate/Rotate etc instead of own ma3x ops you will probably stay in the beginners forum

It’s attitudes like this that made me stop following the advanced forum, though I consider myself to having enough understanding of OpenGL to follow the threads there. Now I am content to just follow the beginner’s forum and help people out occasionally.

Yeah i want to say sorry.I’m now respected and will go tell all gamedev companies to stop using own ma3x ops and start using glTranslate/glRotate etc.It’s just a bit intresting how they haven’t thought of that yet.Perhaps they’re dumm!

This is even more of a dumb answer.
OK I’m a beginner, and I’m sertainly NOT afraid of admitting it. Maybe, (instead of telling us this crap) you could tell us why not to use glRotate etc. That would be alot more usefull to us. Else I suggest you just shutup and go over to the ‘advanced forum’ since we’re not good enough for ya’ll!!
Like you never where a beginner. Pfff… get a life.

“Originally posted by Mihail121:
As long as u guys use the GLU junk functions or use stuff like glTranslate/Rotate etc instead of own ma3x ops you will probably stay in the beginners forum”

Why stop at transformation matrices? Implement your own lighting, texture mapping, blending, etc. and you won’t need to rely on something as childish as OpenGL. And you’re not using a baby training wheel programming language like C or C++, are you? Real men use assembler. Anyone else is a rank beginner. But you probably already know this, right?

[This message has been edited by starman (edited 07-07-2003).]

Yeah starman is right! Why should we even bother learning OpenGL in the first place?
We should start reinventing the wheel and write our own graphics libraries because OpenGL’s old functions suck! Never ever use them or you will be a newbie for life! You will never get to post anything in the ‘advanced’ forum and yuo will never be respected. So, go to whatever online book store and look fore those hardcore computer graphics books, you’ll need them.
Of yeah, and while you’re doing that, don’t forget to contact nVidia and ATI to get documentation about how to writeyou own driver for these cards. You would want your library to be hardware accelerated right?
But I’m afraid nVidia or ATI won’t give you that information so you’re stuck here.
Wait maybe there is some hope left. Maybe you could convince some very very rich guy into investing into a new hardware company and design your own graphics processors!!!
Why didn’t I think of this earlier!

Sarcasm once in a while never hurts right :slight_smile:

Design your own graphics processor? You wimp! I suppose you’re going to re-use ready made silicon molecules instead of sythesizing your own. In my day…

Why shall we build our own graphics processor if we can build a whole computer! Good idea, isn’t it? And then, meaby, after writing our own system and graphics library we can call ourselfs ‘newbies in advanced forum’…

Using glRotate/Translate is fine until the point that you find yourself needing the matrix, and using glGet… For instance, camera look vector can be useful. Having the full transformation matrix may be useful if you do any collision detection (on the CPU). At this point you might as well keep your matrices and glLoad/Mult them.

“Using glRotate/Translate is fine until the point that you find yourself needing the matrix, and using glGet… For instance, camera look vector can be useful. Having the full transformation matrix may be useful if you do any collision detection (on the CPU). At this point you might as well keep your matrices and glLoad/Mult them.”

Agreed. We’re just reacting (over?) to Mihail’s condescending attitude.