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
1
vote
1 answer

gluLookAt glitch

I drew an object consisting of 2 tangent spheres, which is itself tangent to a wall (schema below). Using gluLookAt(), I set the camera in x point (first sphere center), looking to y point (second sphere center), so practically I see along the wall.…
kaspersky
  • 3,959
  • 4
  • 33
  • 50
1
vote
1 answer

Moving an object along a predefined path

A couple of friends and I are trying to code a small animated segment. So, we decided that a good and still somewhat simple proyect would be to make some kind of horror house tour, in which the "player" travels in a cart across an abandoned…
rubbyrubber
  • 567
  • 4
  • 19
1
vote
1 answer

gluLookAt vectors and FPS-style camera

I am attempting to implemented an FPS-style camera by updating three vectors: EYE, DIR, UP. These vectors are the same that are used by gluLookAt (since gluLookAt is specified by the position of the camera, the direction it is looking at, and an up…
user1257724
1
vote
2 answers

Android OpenGL works on emulator but not phone

I have the following code for the Renderer: package hello.project; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import…
rosu alin
  • 5,674
  • 11
  • 69
  • 150
1
vote
1 answer

LookAt Implementation Misbehaviors

I'm looking forward to implement a LookAt( forward, up ) method where: Vector3 forward = eyePosition - targetPosition; Vector3 up; I've seen some implementations over the web, but analizing the code, I've found potencial misbehaviors... I list them…
NIGO
  • 863
  • 2
  • 10
  • 16
1
vote
2 answers

OpenGL -- how to move the scene in response to mouse input using gluLookAt

I'm using OpenGL in Qt through the QGLWidget, and I'm trying to implement some basic mouse and keyboard-driven interaction. So for instance, the keyboard arrow keys will be used to "pan" the scene, the mouse wheel to zoom in the scene, and the mouse…
houbysoft
  • 32,532
  • 24
  • 103
  • 156
1
vote
2 answers

OpenGL in Qt doesn't draw red square

I'm trying to use the QGLWidget to use OpenGL in a Qt application. I made a subclass of QGLWidget etc., and thought I'd test if it works. However, the following code is not working as I expected it would: void MyGLWidget::paintGL() { …
houbysoft
  • 32,532
  • 24
  • 103
  • 156
1
vote
1 answer

How to get the projection plane in OpenGL

I use the gluPerspective and glLookAt to set my projection matrix and view matrix. If I want to get the coordinate of the eye, it's the first three arguments in the gluLookAt, right? However, now I need to get the projection plane, that is, the…
TonyLic
  • 647
  • 1
  • 13
  • 26
1
vote
2 answers

The LookAt target location doesn't matter if it is z = 0 or z = 1000 or -1000?

I am trying LookAt in OpenGL ES, gluLookAt(512, 384, 2000, 512, 384, 0, 0.0f, 1.0f, 0.0f); The second row is the Target's position... so I wonder, if I change the z from 0 to 1000 or -1000, shouldn't what is seen…
Jeremy L
  • 3,770
  • 6
  • 41
  • 62
1
vote
2 answers

setting up an opengl perspective projection

I am having an issue setting up the viewing projection. I am drawing a cube with the vertices (0, 0, 0) (0, 0, 1) (0, 1, 1) (0, 1, 0) (1, 0, 0) (1, 1, 0) (1, 1, 1) and (1, 0, 1). This is how I am initializing the view: void initGL(int x,int y, int…
Kris
  • 398
  • 4
  • 9
0
votes
1 answer

OpenGL using gluLookat()

I need help with gluLookAt(). I'm trying to use it after my call to glOrtho() (which I believe is correct) in an attempt to make a view down the z axis from a slightly elevated view on the y axis. From what I understand of gluLookAt() the first…
user969416
0
votes
1 answer

Discontinuity in gluLookAt

This is how I calculate my line of sight vector and the up vector. ly = sin(inclination); lx = cos(inclination)*sin(azimuth); lz = cos(inclination)*cos(azimuth); uy = sin(inclination + M_PI / 2.0); ux = cos(inclination + M_PI /…
user813182
0
votes
0 answers

Where to call gluLookAt() in OpenGL project?

I understand how the function itself works and I know it should work in principle, but for some reason I can't to seem to get it right. Here is my project so far: #include #include "glut.h" #include GLfloat p1[3] = { -0.5,…
MateMalte
  • 37
  • 4
0
votes
0 answers

About the lookat() function

This is the function: lookat(vec3 eye, vec3 at, vec3 up) As we all know, the up vector can be(0.0, 1.0, 0.0). It cannot be parallel to the observation vector n, or there will be somethingw wrong. My question is how to calculate the up vector so…
0
votes
0 answers

Move camera using glm::lookAt()?

this is my CAMERA class which makes viewMat uniform var in vertexshader. struct CAMERA { glm::vec3 EYE{ 0.0f,0.0f,150.0f }; glm::vec3 AT{ 0.0f,0.0f,0.0f }; glm::vec3 UP{ 0.0f,1.0f,0.0f }; glm::vec3 Dir() { return…
sunkue
  • 278
  • 1
  • 9