# The Industry's Foundation for High Performance Graphics

1. ## Help with gluLookAt()

Hi,

I am starting my first 'real' OpenGL program after having produced several demo/test programs, and would like to get it running as fast as possible [doesn't everyone ]. I remember reading one person's comments (cannot remember where) who indicated that using gluLookAt() to move the camera around the scene produced a great speed impovement when compared to the simpler method of rotating and translating all the primitives to be drawn (the method that all basic tutorials seem to use - probably for a reason) Is this true? If so, how is the above function used? I'm not sure what the 'up' vector is there for...

Sorry if this is a bit of a no-brainer , but, as I said, I am new to OpenGL...

Cheers for any info,

Ghee

2. ## Re: Help with gluLookAt()

gluLookAt is not faster than usual glRotatef/glTranslatef, nor is it slower. They are more or less equal in speed.

Concerning the up-vector, you can think of it as the vector telling gluLookAt where the camera's up is pointing. Placing the camera at a specific point, pointing it in a direction doesn't tell you how the camera is rotated about it's own look-at vector. It can be placed upside down, it can be placed with the upside to the left or so.

If you use the standard coordinate system (x=right, y=up, z=into the screen), you can always set the upvector to {0, 1, 0}. As long as you only look left/right, and not too much up/down that is.

3. ## Re: Help with gluLookAt()

hi...

I don't know very well OpenGL... and english too! But I try to help you!

Code :
```void [B]gluLookAt[/B] (GLdouble eyex, GLdouble eyey,GLdouble eyez,GLdouble centerx,GLdouble centery,GLdouble centerz,GLdouble upx,GLdouble upy,GLdouble upz)
Defines a viewing matrix and multiplies it to the right of the current matrix. The desired viewpoint is specified by eyex,eyey and eyez. The centerx, centery and centerz arguments specify any point along the desired line of sight, but typically they specify somme point int he center of the scene being looked at. The upx, upy and upz arguments indicate which direction is up (that is, the direction from the bottom to the top of the viewwing volume).```
If you give me your e-mail, I give you an image of gluLookAt... and a exemple for turn around a scene!

Best regards

Jérôme

4. ## Re: Help with gluLookAt()

Cheers Bob!

As I was exiting from posting my message, I noticed the feature section had an entry about a developer FAQ, which has a section all about gluLookAt()! (http://www.opengl.org/developers/faq...al/viewing.htm)

Thanks again,

Ghee

5. ## Re: Help with gluLookAt()

Thanks Jérôme.

I would be interested in some code showing how gluLookAt()is used. I will try to mail you later on. If you speak French, feel free to reply as you feel - my wife is French.

I think that my real problem at the moment is a poor understanding of Matrixes, and how they are used in OpenGL. I have always avoided them before when dealing with geometry.

I'm very impressed by the speed of your answer, by the way.

Thanks,

Ghee

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•