PDA

View Full Version : gluLookAt, glTranslates and glRotates



09-11-2000, 08:13 PM
hi everyone...

when glanced over almost of the terrain programs, i found that the developers prefer to use glRotates and glTranslates instead of gluLookAt to determine the 'camera' position.

i wonder why those two functions used, because in as far as i concerned, both funcs (gltranslates and glrotates) are for objects.

can anyone explain...?
thanks for anybody who are helping me...

rgdrs,
Ms Zack

Bob
09-12-2000, 04:12 AM
There are no such things as objects in OpenGL. Have you ever told OpenGL that you are drawing a certain object?

No? That's what I thought. You only draw primitives (points, line and triangles) that happens to form something our brain interpret as an object. Thats all.

There are only the whole scene, with a set of primitives forming different objects all over the place.

First you use glRotate and glTranslate to traslate all 'objects' (the whole scene), in other words, placing the viewpoint. Then you use glRotate and glTranslate to translate each 'object' to its place, and when you are done drawing, you restore the old matrix (using glPushMatrix and glPopMatrix is proper places).