Archived

This topic is now archived and is closed to further replies.

Cubes, gluLookAt, and, glTranslate

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all! I know that this has been asked, but the forum search function isn''t working again (it never does when I have a problem!). Anyways, I''m trying to create a room inside a cube, but I can''t get the camera inside the cube! I realize that I''m probably doing it all wrong, but this is the simplest way I could think of. I tried using gluLookAt, but I end up behind the cube. I tried glTranslate, but the view becomes black. Any suggestion would be great.

Share this post


Link to post
Share on other sites
Don't think of getting the camera inside of the room think of drawing the room around the camera. There is no "camera" in opengl only what you draw around the viewport. And GLlookat is very slow. Don't use it.

Draw the 6 walls around the camera.


Look at my cheap drawings.

_______A___
___|-------|
___|-------|
__B|---V---|D
___|-------|
___---------
_______C

v = viewport. 0,0, 0
a = wall 0,0,-5
b = wall -5,0, 0
c = wall 0,0, 5
d = wall 5,0, 0

A wall, "Triangle fan"

---A-------D
---|-------|
---|-------|
---B-------C

a = -5,5,-5
b = -5,0,-5
c = 5,0,-5
d = 5,5,-5

So translate to those wall positions and then draw the wall. If it is b or d translate first and then rotate. If you want to rotate the room rotate the scene first anf then do the translating. But remember the call glloadidentity before starting on a new wall.

[edited by - slashandburn on May 6, 2002 7:30:11 PM]

[edited by - slashandburn on May 6, 2002 7:31:24 PM]

[edited by - slashandburn on May 6, 2002 7:32:13 PM]

[edited by - slashandburn on May 6, 2002 7:32:46 PM]

Share this post


Link to post
Share on other sites