View Full Version : skydome texture questions
In my opengl prog i'm drawing a massive sphere in my scene and giving it a clouds texture to simulate the sky and then rotating the sphere to make it look like its moving.
I have a couple of questions:
1. On the sphere where the two ends of the texture meet there is a white line which looks stupid. I tried using glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ; but it didn't do anything. I had to add
#define GL_CLAMP_TO_EDGE 0x812F as well otherwise it wouldn't compile.
2. My sphere has a radius of 1000.0f and so i've set Z far in gluPerspective to 1001.0f. Is there a better way to do this?
btw i'm this is on winXP with a radeon 9200se
1: Get a copy of glext.h (http://oss.sgi.com/projects/ogl-sample/registry/) . It contains constants and function pointer typedefs for everything above OpenGL 1.1 and all extensions.
2: As long as the sphere is centered at the viewpoit, it doesn't matter what size the sphere is. Keep the far plane at whatever distance is needed to render everything except the sphere properly. Then draw the sphere first of all with no depth test, and then draw everything else. The size of the sphere doesn't matter then, so just keep it at a size so it fits within the view volume.
02-10-2005, 01:44 PM
Correct, the size of the sphere does not matter if you
are going to lcear the depth buffer before drawing
anything else. Setting the far plane to 1001 is what
I would do and avoid buffer clearing.
My question to you: How did you texture map the sphere
with the clouds texture? And by that I mean how did you
generate the texel coordinates. There are a few ways, some
are better than others and I have yet to find one that
I like... If you could tell us a bit about this, that
would be great.
Keep a copy of glext.h handy! And having said that,
keep a copy of the files in the "util" directory
of the MESA distribution too...
02-10-2005, 07:34 PM
Thanks for the advice,
I'm loading textures the way that is shown in the Nehe lesson 6 tutorial and this is what my texture loading code looks like:
textures = new GLuint[numtextures];
for( i = 0; i < numtextures; i++)
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[i]->sizeX, TextureImage[i]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[i]->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ;
02-12-2005, 05:58 PM
And how do you generate texels (per vertex texture
coordinates)? That is where you have to be smart in
order to make the skydome look good. What do you do?
02-12-2005, 06:27 PM
This is the dome drawing code, i'm not sure how it generates texels.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.