//
you're reading...
Tech

How To Create A Skybox Using OpenGL

This tutorial offers a nearly perfect guide of creating a skybox using OpenGL. I propose, for example, in C++, creating a class which contains two modules:

1. Loading texture images, the details of which can also be found in the tutorial. We need to load 6 texture images.

2. Creating the box, elaborated in the tutorial. It is about rendering a cube and attached the texture to each face.

However, it does not seem so easy. There are 2 tricky things.

1. We need to determine which image to attach to each face. Typically the 6 skybox images used to be a  seamless *image* describing a view of the environment. So the order is unique to reconstruct the original environment. Make sure the front, back, left, right, top and bottom images are correct.

2. Normally after you are done you will see a very disturbing *white lines* on the edges of the faces, making the environment unreal. To eliminate the *white lines*, configure the texture thing as follows:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);    // to eliminate *white edge* effect
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

And the *white lines* would go away.

Advertisements

About Xiang 'Anthony' Chen

Making an Impact in Your Life

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Twitter Updates

%d bloggers like this: