[resolved] Opengl, texturing

I have created a cube which is textured, and I am calling this function to create different cubes.

One of these is a skybox, so the player sees the inside of the cube, this works perfectly.

Others are buildings and things, these end up looking like this: (the sky is the skybox)

Image

The second texture is supposed to appear as a checkerboard - and it does when applied to the skybox:

Image

But remember, the skybox is just the same cube drawn larger so the player only sees the inside...

I'm wondering if anyone knows why, is there something obvious I'm missing as to why it only works on the inside of boxes?

This is the code for my cube:

  1.  
  2. //snip
Expand to see the code.


Is there a flag or something I need to change to specify whether it's drawn on the inside or outside of the box? That's the only difference I can think of.

The skybox is drawn by:

drawBox(80, texName[2]);


The other boxes:

drawBox(1, texName[2]);
I feel stupid, but in case anybody else gets this problem, this is the solution:


In your draw method:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);



In your init method:

glEnable(GL_DEPTH_TEST);


Google GL_DEPTH_TEST for settings you can apply to it.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=76464