View Full Version : SkyBox and camera

01-23-2003, 12:38 AM
I got a problem with my skybox program.
I have made a skybox and a platform in it.
I want to move around the platform while the skybox is in my viewvolume. I use gluLookAt to move the camera.

But my problem is i want to roate the platform and skybox in the same time. But i want to move using the up and down arrow key along the platform. While moving forward and backward...the skybox should be in the fixed place. so the sky box shud only hae the effect of rotation not the forward backeard movement. How can i implement that. I uses the Digiben camera class for this program.

Any help?? Please

01-23-2003, 12:50 AM
Well you can either move the skybox with the camera or transform it seperately so that only rotations are applied to it.


01-23-2003, 04:28 AM
I am not sure if this is an advanced question, but in any case...
You might want to make a call to glTranslate with your position.

glTranslate( my_position );

01-23-2003, 02:57 PM
A typical scene graph ("rendering engine") will set up the modelview transform for each object it renders. It will do this by multiplying the object's transform (position and orientation) with the inverse of the cameras transform (position and orientation), convert that to a matrix, and load that matrix into modelview.

When you draw the sky box, your scene graph ("rendering engine") should just take into account the inverse of the camera's orientation, and nothing else. As you typically draw the sky box instead of calling glClear on the color buffer, this typically falls outside the main traversal of the scene graph, and thus it should be simple to replace:



Mat44 m; (-camOri_).toMat44(&m);
glLoadMatrix( &m.e00 );
mySkyBox_->drawOn( this );

01-23-2003, 10:37 PM
Can you give me a sample code to do this?
It will help me a great.