Questions tagged [glulookat]

gluLookAt is a function in the OpenGL Utility Library (GLU) that defines a view transformation

The gluLookAt() function is a commonly used routine that defines a view transform and applies it to the OpenGL matrix stack. gluLookAt alloed the view to be specified in terms of an eye (or camera) coordinate and a center (or subject) coordinate that the camera should 'look at'.

The term gluLookAt may also refer to the underlying technique of defining a view matrix in terms of eye and center coordinates and an up vector.

The technique works by constructing a matrix equals to the product of an orthonormal basis matrix (a rotation matrix) and the eye coordinate. The orthonormal basis is defined in terms of the 'forward' vector between the eye and center coordinates, and the two vectors orthogonal to it, 'up' and 'side'.

http://www.opengl.org/archives/resources/faq/technical/viewing.htm

97 questions
25
votes
4 answers

What exactly is the UP vector in OpenGL's LookAt function?

this is related to The LookAt target location doesn't matter if it is z = 0 or z = 1000 or -1000? I tried gluLookAt(512, 384, 2000, 512, 384, 0, 0.0f, 1.0f, 0.0f); and things work fine, and now I change the 3rd row…
Jeremy L
  • 3,770
  • 6
  • 41
  • 62
9
votes
3 answers

gluLookAt() best usage, on GL_PROJECTION matrix or on GL_MODELVIEW matrix

The OpenGL documentation say that the gluLookAt() calls should be done on the GL_MODELVIEW matrix: http://www.opengl.org/resources/faq/technical/viewing.htm In fact the docs link to an article which say that using gluLookAt() on the GL_PROJECTION…
Shivan Dragon
  • 15,004
  • 9
  • 62
  • 103
9
votes
1 answer

LookAt function: I'm going crazy

I must do a homework and I try to implement a lookAt function. I tried in many ways but the only result I got is a blue screen. The rest of my program works greatly, infact if I use glm::lookAt all is good. This is my code: mat4…
Domenico Maiuri
  • 191
  • 1
  • 1
  • 10
8
votes
1 answer

gluPerspective, glViewport, gluLookAt and the GL_PROJECTION and GL_MODELVIEW Matricies

Original Question I want to use 'gluPerspective', 'glViewport' and 'gluLookAt' to manipulate my camera and screen. Which functions to I apply to which matrix mode? And in what order should I / must I use them? For example, I am trying to set up my…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
6
votes
1 answer

OpenGL 3 (LWJGL) LookAt Matrix Confusion

I'm learning OpenGL 3 using LWJGL. I have tried to implement an equivalent to gluLookAt(), and although it works am I somewhat confused as to why. I confess to just copying this code from various sources on the web, but after much study I think…
Zutty
  • 5,357
  • 26
  • 31
6
votes
3 answers

How does gluLookAt work?

From my understanding, gluLookAt( eye_x, eye_y, eye_z, center_x, center_y, center_z, up_x, up_y, up_z ); is equivalent to: glRotatef(B, 0.0, 0.0, 1.0); glRotatef(A, wx, wy, wz); glTranslatef(-eye_x, -eye_y,…
roxrook
  • 13,511
  • 40
  • 107
  • 156
5
votes
4 answers

OpenGL gluLookAt() not working as intended

I am making a rollercoaster inside of a skybox in OpenGL, and without much background on it's functions or computer graphics it is proving to be very difficult. I drew a rollercoaster using Catmull-Rom spline interpolation, and drew each point with…
Logan Serman
  • 29,447
  • 27
  • 102
  • 141
4
votes
1 answer

Clarification regarding use of OpenGL modelview matrix and matrix transformation

I've been able to use modelview matrix and functions like glTranslatef() and gluLookAt() to transform an object or the perspective of the entire scene, but when I try to do both I run into problems. It seems that regardless of the parameters I use…
user1986358
  • 81
  • 2
  • 9
4
votes
3 answers

OpenGL Camera - Move the camera without it snapping back when using SetCursorPos(x,y);?

I have a problem when I try to update my camera. I want to change the pitch and yaw of the the camera (where its looking) via the mouse But I want the mouse to stay positioned to the center of the window. //where MouseP.x .y is the mouse position…
Russell Cargill
  • 270
  • 1
  • 6
  • 19
3
votes
1 answer

OpenGL FPS Camera using gluLookAt()

So, I'm attempting to create an FPS style camera to explore my scene with, and it seems to be working fine. There is no way of changing the pitch of the camera at the moment. I am trying to create a function that allows me to set the camera to some…
fanatic
  • 143
  • 2
  • 9
2
votes
1 answer

How to determine the normal vector to the plane of sight in OpenGL?

I'm working on a kind of camera orbiting function for an application and I need to know the normal vector to the plane of sight. I think it might be the same as the line of sight vector, is it? I didn't know how to explain, so i did a little…
Samssonart
  • 3,443
  • 3
  • 31
  • 41
2
votes
1 answer

How to implement the Roll angle together with Yaw and Pitch in glm::lookAt function?

From this page https://learnopengl.com/Getting-started/Camera I learned how to implement the Yaw and Pitch angle to a glm::lookAt function. But sadly I could not find any reference of how to add also the Roll angle to the funcion. When I try to…
2
votes
1 answer

Why use glm::LookAt in OpenGL?

After reading on the coordinate systems in OpenGL, I figured to move the camera around the world I just need to translate the view coordinates. If I say use view = glm::translate(view, glm::vec3(0, 0, -50));, I'm translating the camera 50 units back…
John Smith
  • 33
  • 5
2
votes
1 answer

How to use gluLookAt in PyOpenGL?

I'm trying to learn PyOpenGL, but I'm not sure how to use gluLookAt to move the camera. I've got an image displaying, but I think I might be missing something that allows me to use gluLookAt? Incoming wall o'text, I'm not sure where the problem…
Matthew Fournier
  • 1,077
  • 2
  • 17
  • 32
2
votes
1 answer

Opengl mouse Camera issue (gluLookAt)

Hello i am having a strange issue with my mouse movement in openGL. Here is my code for moving the camera with my mouse void camera(int x, int y) { GLfloat xoff = x- lastX; GLfloat yoff = lastY - y; // Reversed since y-coordinates range from…
Fotis
  • 97
  • 2
  • 13
1
2 3 4 5 6 7