Results 1 to 6 of 6

Thread: skydome texture questions

  1. #1
    Guest

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: skydome texture questions

    1: Get a copy of glext.h . 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.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    Minneapolis, USA
    Posts
    100

    Re: skydome texture questions

    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...

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2003
    Posts
    9

    Re: skydome texture questions

    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:

    Code :
          AUX_RGBImageRec *TextureImage[MAX_TEXS];                                
        	textures = new GLuint[numtextures];												
     
            memset(TextureImage,0,sizeof(void *)*1);                                
     
            for( i = 0; i < numtextures; i++)										
            { 
     
                    if (TextureImage[i]=LoadBMP(imagefilename))								
                    { 
                            Status=TRUE;                                                    
                            glGenTextures(1, &amp;textures[i]);                                  
     
                            glBindTexture(GL_TEXTURE_2D, textures[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_MIN_FILTER,GL_LINEAR); 
                            glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);  
    						glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ;
     
                    } 
     
                    if (TextureImage[i])                                                    
                    { 
                            if (TextureImage[i]->data)                                       
                            { 
                                    free(TextureImage[i]->data);                            
     
                            } 
     
                            free(TextureImage[i]);                                           
                    } 
            }

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jun 2004
    Location
    Minneapolis, USA
    Posts
    100

    Re: skydome texture questions

    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?

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2003
    Posts
    9

    Re: skydome texture questions

    This is the dome drawing code, i'm not sure how it generates texels.

    Code :
    GLUquadricObj *quadratic;
    glBindTexture(GL_TEXTURE_2D, textures[iTexNum]);
    quadratic=gluNewQuadric();			
    gluQuadricNormals(quadratic, GLU_SMOOTH);	
    gluQuadricTexture(quadratic, GL_TRUE);  
    gluSphere(quadratic,radius,32,32);

Similar Threads

  1. texture mapping skydome
    By Adrian Hooper in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-15-2009, 01:27 AM
  2. Skybox to Skydome
    By Rodrix in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-22-2007, 12:32 PM
  3. Skydome techniques
    By Ozz in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-03-2001, 01:07 PM
  4. Skydome and clouds...
    By shoot in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 11-09-2000, 04:15 PM
  5. Skydome effect?
    By Khasius in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 06-18-2000, 07:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean