# Landscape as a scene background

Hi,

I’m designing a scene with glut. I want to have a textured background for the scene but have no clue on what I could map the background texture.

I have a camera with which I can move all over the scene. In the best case, the background should be wrapped seemlessly around the scene. Could you help me?

Thanks!

I think what you are talking about is you want a Skybox. Imagine you are standing inside a giant cube and the inside of each face has an image drawn in such a way that the seems aren’t seen. So as you look around the world you see the different sides of the cube.

Your textured background will need changed into 6 images. There are various ways to do this. Google for “How to create a skybox” and similar things.

To render it what I do is have a 1x1x1 Cube scaled up so that the distance from the middle of the cube to corner is my maxZ (ie. the max view distance). I then set the camera to 0,0,0, but with the orientation of the “real” camera (the player).

Therefore the cube is not drawn relative to the player and so does not move as they move. I also turn off depth test and render it first, I guess if lots of things are going to obscure the sky then rendering it last (with depth test on) maybe quicker.

So, in summary, I render from a fixed position (0,0,0) which is the middle a giant (maxZ*2 from diagonal) cube which has a different texture on each face which fit seamlessly together.

Creating the image is the hard part. The guide I eventually used was

Skybox.pdf

BTW I’m no expert on this and it took me a few days to get it going, it works for me, but may not be “the proper way”.

Oh, forgot to say. If you don’t mean a skybox and just mean you want a flat image that doesn’t move as you look around i.e. looking up/down/N/S/E/W still shows the same flat image.

To do this you can just draw a textured quad from 0,0,0 using a fixed orientation e.g. put the quad at maxZ distance away and draw looking down the Z axis.

Hopefully that makes sense

Hey Stuart,

thank you very much for your tips. I found it out myself, that skyboxes are appropriate to my problem, but your tips where very helpful!

Greez,

alex