Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6545001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:32:00+00:00 2026-05-25T11:32:00+00:00

I am pretty new to OpenGL and have run into a problem trying to

  • 0

I am pretty new to OpenGL and have run into a problem trying to render a skybox.
This picture illustrates the issue fairly well.

The sides of the skybox do not show up, and when I view an edge (like in the pic),
it just looks like the images are rendered right next to each other, instead of as
different sides of a cube.

void display ( void )   // Create The Display Function
{
glPushMatrix();
glDepthMask(0);
/* replace this code with your height field implementation */
/* you may also want to precede it with your rotation/translation/scaling */
/* Clear buffers */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt( 0.0, 0.0, 0.0,  // eye position
           0.1, 0.0, 0.1,  // camera direction
           0.0, 1.0, 0.0); // up direction

glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_BLEND);

glColor4f(1.0, 1.0, 1.0, 1.0);

/*!!!!!!!!!!!!!! FRONT FACE !!!!!!!!!!!!!!!*/

glBindTexture(GL_TEXTURE_2D,frontTextureId); // select which texture to use
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex3f(  0.5f,  0.5f, -0.5f );
    glTexCoord2f(1, 0); glVertex3f( -0.5f,  0.5f, -0.5f );
    glTexCoord2f(1, 1); glVertex3f( -0.5f, -0.5f, -0.5f );
    glTexCoord2f(0, 1); glVertex3f(  0.5f, -0.5f, -0.5f );
glEnd();

/*!!!!!!!!!!!!!! LEFT FACE !!!!!!!!!!!!!!!*/
glBindTexture(GL_TEXTURE_2D, leftTextureId); // select which texture to use
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex3f(  0.5f,  0.5f,  0.5f );
    glTexCoord2f(1, 0); glVertex3f(  0.5f,  0.5f, -0.5f );
    glTexCoord2f(1, 1); glVertex3f(  0.5f, -0.5f, -0.5f );
    glTexCoord2f(0, 1); glVertex3f(  0.5f, -0.5f,  0.5f );
glEnd();

/*!!!!!!!!!!!!!! RIGHT FACE !!!!!!!!!!!!!!!*/
glBindTexture(GL_TEXTURE_2D, rightTextureId); // select which texture to use
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex3f( -0.5f,  0.5f, -0.5f );
    glTexCoord2f(1, 0); glVertex3f( -0.5f,  0.5f,  0.5f );
    glTexCoord2f(1, 1); glVertex3f( -0.5f, -0.5f,  0.5f );
    glTexCoord2f(0, 1); glVertex3f( -0.5f, -0.5f, -0.5f );
glEnd();

/*!!!!!!!!!!!!!! BACK FACE !!!!!!!!!!!!!!!*/
glBindTexture(GL_TEXTURE_2D, backTextureId); // select which texture to use
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex3f( -0.5f,  0.5f,  0.5f );
    glTexCoord2f(1, 0); glVertex3f(  0.5f,  0.5f,  0.5f );
    glTexCoord2f(1, 1); glVertex3f(  0.5f, -0.5f,  0.5f );
    glTexCoord2f(0, 1); glVertex3f( -0.5f, -0.5f,  0.5f );

glEnd();

/*!!!!!!!!!!!!!! TOP FACE !!!!!!!!!!!!!!!*/
glBindTexture(GL_TEXTURE_2D, upTextureId); // select which texture to use
glBegin(GL_QUADS);
    glTexCoord2f(0, 1); glVertex3f( -0.5f,  0.5f, -0.5f );
    glTexCoord2f(0, 0); glVertex3f( -0.5f,  0.5f,  0.5f );
    glTexCoord2f(1, 0); glVertex3f(  0.5f,  0.5f,  0.5f );
    glTexCoord2f(1, 1); glVertex3f(  0.5f,  0.5f, -0.5f );
glEnd();

/*!!!!!!!!!!!!!! BOTTOM FACE !!!!!!!!!!!!!!!*/
glBindTexture(GL_TEXTURE_2D, downTextureId); // select which texture to use
glBegin(GL_QUADS);
    glTexCoord2f(0, 0); glVertex3f( -0.5f, -0.5f, -0.5f );
    glTexCoord2f(0, 1); glVertex3f( -0.5f, -0.5f,  0.5f );
    glTexCoord2f(1, 1); glVertex3f(  0.5f, -0.5f,  0.5f );
    glTexCoord2f(1, 0); glVertex3f(  0.5f, -0.5f, -0.5f );
glEnd();

/*!!!!!!!!!!!!!! end of drawing of a textured quad !!!!!!!!!!!!!!!*/
glPopAttrib();
glPopMatrix();

/* Swap buffers, so one we just drew is displayed */
glutSwapBuffers();
}

I feel like I am missing something basic here, but I am not sure what. The code is
more or less verbatim from the tutorial site (http://sidvind.com/wiki/Skybox_tutorial).
The code was compiled with g++ 4.5.2 on Ubuntu Linux, but the same problem arises under
visual studio as well.

I should state, as well, that the numbers used in the code above are the values that
produced the linked picture.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:32:00+00:00Added an answer on May 25, 2026 at 11:32 am

    Your textures need to form a seamless join across cube edges. In the screenshot you’ve supplied, these images don’t form a seamless join (look at the sky).

    Also check your projection matrix – are you setting a perspective transform?

    To set up a perspective projection (the most common for 3D apps):

    glMatrixMode(GL_PROJECTION);  // switch to projection matrix
    glLoadIdentity();  // reset projection
    gluPerspective(90.0,4.0/3.0,0.01,10.0);   // 90deg FOV, 4:3 aspect ratio, 0.01 near clip plane, 10.0 far clip plane
    glMatrixMode(GL_MODELVIEW);  // back to model matrix
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty new to ASP.NET and trying to figure out how to have the code
Pretty new to threading and I have this QList that the threads share between
Pretty new to Qt and I ran into this behavior in an app I
I am fairly new to DirectX 10 programming, and I have been trying to
Pretty new to MVC and the like. I have a class the looks like
I am pretty new to PHP and MySQL and I just can't figure this
I am pretty new to buddypress. I am trying to do something pretty simple
pretty new to HTML and I was wondering why this snippet of code doesn't
Pretty new to all this, so if I am going about my puzzle in
Im pretty new to coding, heres my problem. Results->Text = G55 > Y +

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.