Sign in to follow this  
someone2

drawing the world ouside as 6 textures

Recommended Posts

Hello, I am trying to give the illusion of a surrounding world by drawing a huge cube, with 6 textures of different parts of the world (carefully drawn to give the illusion of continuity). The problem is, however, it is not very well lit. I need to make it very bright independent of the lights in the scene. How can I do this? Also, i still seem to see the edges of the cube, which sometimes gets annoying. Is there a way to just make it seamlessly integrate? Thanks a lot in advance for all the help :)

Share this post


Link to post
Share on other sites
I don't know what you mean with that brightness problem, but remember to disable all the lights before rendering it. If you want to make it brighter you could just scale colors of the texture you read to display your box.
[edit: I mean - scale values in the buffer before creating your texture]

And as for that visible edges - try to set texture wrapping mode to GL_CLAMP_TO_EDGE. Should help.


greetz

Share this post


Link to post
Share on other sites
Quote:
Original post by Zmurf
Is a skybox what you're looking for? I thought OpenGL had an inbuilt function for this?


Nah, opengl tends to give you as little as possible, and you build it up for yourself. One of the things I like about it actually.

The typical way to do a skybox is to disable depth testing and draw a small cube around the view. That way it won't look distorted if you move around.

Share this post


Link to post
Share on other sites
To make your skybox so that it will never be reached do something like;
(Otherwise you can 'fly' towards it and the illusion is broken down)

void ShowSkyBox ( CAMERA CAM )
{
glDisable(GL_LIGHTING);
// DISABLE DEPTHTESTING
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
// GET NEW MATRIX
glPushMatrix();
glLoadIdentity ( );
// ROTATE SKYBOX ACCORDINGLY
glRotatef(CAM.xrotation,1,0,0);
glRotatef(CAM.yrotation,0,1,0);
glRotatef(CAM.zrotation,0,0,1);
// DRAW SKYBOX
glCallList(SKYBOX);
// RESTORE EVERYTHING
glPopMatrix();
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
}

to get rid of your edges to the folowing when loading your textures


if (i==SKY_DOWN||i==SKY_FRONT||i==SKY_BACK||i==SKY_LEFT||i==SKY_RIGHT)
{
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
else
{
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR );
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGB8, TextureImage[i]->sizeX, TextureImage[i]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[i]->data);
}

The make the brightness ok, maybe turn of the lights when projecting the box, and coloring the good color in photoshop or sumthing

Share this post


Link to post
Share on other sites
Quote:
Original post by RAZORUNREAL
Quote:
Original post by Zmurf
Is a skybox what you're looking for? I thought OpenGL had an inbuilt function for this?


Nah, opengl tends to give you as little as possible, and you build it up for yourself. One of the things I like about it actually.

The typical way to do a skybox is to disable depth testing and draw a small cube around the view. That way it won't look distorted if you move around.



I think Zmurf was thinking of cubemaps, which allow you to to store 6 square textures into a single texture and draw useing that, very commonly used for sky boxes/reflections and other niffty effects.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this