Jitendra
Jitendra

Reputation: 53

How to Set Camera View using gluLookAt() function?

I have used glOrtho(500, 600, 600, 700, -100, 100) projection with this i want to use camera view settings with gluLookAt() method what should be the parameters for gluLookAt function on this projection..

Upvotes: 1

Views: 4216

Answers (1)

jameswilddev
jameswilddev

Reputation: 612

glOrtho builds a matrix that forms the "lens" of your virtual camera. gluLookAt moves that virtual camera.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd368663%28v=vs.85%29.aspx

eyeX/Y/Z are where the camera is. centerX/Y/Z are the spot at which the camera is looking. upX/Y/Z is which way up the camera is.

An example use might be:

gluLookAt
( 

    0.0f, 2.0f, -16.0f,
    0.0f, 0.5f, 0.0f,
    0.0f, 1.0f, 0.0f

);

This will put the camera 16 units backwards, raise it slightly, point slightly above 0, 0, 0, with the top of the screen pointing along Y+.

You could change the first value to move the camera. Change the second to change which part of the scene it's pointed at. Change the third to roll/bank the camera.

The important question, however, is what do you want to do with it?

Upvotes: 1

Related Questions