# OpenGL Working with glFfrustum and gluLookAt

This topic is 2029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello everybody!

I just started working with OpenGL and I have this problem with glFrustum and gluLookAt. I have to obtain the first image but the best I could get was the second.

As you can see I need to get a 1 point perspective, but no matter how I tried I can only get the 3-point perspective on that cube. I read quite a few tutorials and posts about frustum and gluLookAt but none would work for me and I've been stuck on this for 2 days now.

This is my code so far:

glMatrixMode(GL_PROJECTION);
glFrustum(-5, 5, -5, 5, 5, 100);
gluLookAt(7,7,10,0,0,0,0,1,0);

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
DisplayAxe();
DisplayObiect(); //displays the cube
glPopMatrix();


The cube is of side 5.

Now if anyone could help me or at least give me a hint on how to use glFrustum and gluLookAt to get that 1-point perspective it would be awesome.

Thank you!

##### Share on other sites

The view point has to look down the red axis, perpendicular to the plane formed by the greed and blue axes. Then the vanishing points along the green and blue axes are at infinity. Assuming that the red axis is the Z-axis:

gluLookAt(7,7,10,7,7,0,0,1,0);


The view point is now faced along the vector (7,7,0) - (7,7,10) = (0,0,-10), which is along the negative Z-axis.

Edited by Brother Bob

##### Share on other sites

The view point has to look down the red axis, perpendicular to the plane formed by the greed and blue axes. Then the vanishing points along the green and blue axes are at infinity. Assuming that the red axis is the Z-axis:

gluLookAt(7,7,10,7,7,0,0,1,0);


The view point is now faced along the vector (7,7,0) - (7,7,10) = (0,0,-10), which is along the negative Z-axis.

Thank you a billion. This totally helps, and I finally got how the gluLookAt function works. I had a pretty different idea about the whole thing. Thanx again.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633682
• Total Posts
3013311
×