Advertisement

Display static objects

Started by December 26, 2004 07:40 AM
2 comments, last by MENTAL 19 years, 8 months ago
Hello, I tried to implement some kind of static objects in my game, but the way I tried gave no success. My intention is to create an object like the moon in real life, always staying at the same position, as you are moving around. I think this should be almost the same as the skybox, but I did not get this to work. Do you have any hints on how to handle the world translations? Thanks in advance, Marco
Yea, what you need is a skybox.
It's the simplest thing to do relative the effect it creates, that is why even the original doom uses it.

all you have to do is to draw a cube(10x10x10 is a good size) with it's center around the camera position, the correct texture on each face and z-writing/z-testing turned off.

If you only need the moon, try drawing a plane(with the moon texture) that is facing the camera position and allso keeps itself at a constant distance from the camera.

Simple. :)
Advertisement
you may use multitexture to skybox. or making 2-3 skyboxes and make them trasparent/overlay. (like layers)
you dont need to handle world transformations..
+-+-+-+-+-STR
If you need to use 3D objects, then rotate the camera to wherever it needs to be looking, draw all the static objects normally (using calls to glTranslate and glRotatef - don't forget to Push and Pop). When you're finished, Translate the camera to it's position (the angle has already been set) and draw the rest of the game objects.

Voila. Static objects that rotate with the camera but are always at a fixed distance away.

This topic is closed to new replies.

Advertisement