SkyBox and camera

Hi!
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

Well you can either move the skybox with the camera or transform it seperately so that only rotations are applied to it.

-Ilkka

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.
So,

glTranslate( my_position );
DrawSKyBox();

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:

glClear( GL_COLOR_BUFFER_BIT );

with:

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

Thanks.
Can you give me a sample code to do this?
It will help me a great.

:slight_smile: