[solved] Texture mapping for a cube turning out white.

So I’m trying to swap from a single texture on a cube to a mapped texture that will cover the whole cube based off different textures for the top and bottom and the same for the sides. I had the textures working with the last way of setting textures but now when i try to create the cubes they just turn out plain white. Any idea why this is happening?

Here is my code:

http://www.java-gaming.org/?action=pastebin&id=1069

Thanks guys.

I’ve never worked with cube maps, but does [icode]glEnable(GL_TEXTURE_CUBE_MAP);[/icode] before binding your texture help?

Maybe you need to activate the texture whenever you bind it (when uploading texture images and rendering)?


glActiveTexture( GL_TEXTURE0 + unit );
glBindTexture( GL_TEXTURE_CUBE_MAP, tmp );

where unit is the texture unit (probably zero if you’re just using one texture unit).

Also the values passed into the upload class seems incorrect, e.g.


glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGBA, decoderTop.getWidth(), decoderTop.getHeight(), 0,
               GL_RGBA, GL_UNSIGNED_BYTE, bufSide);

mixes the side texture buffer image and the width/height of the top image, though I doubt that’s the main problem, would probably just cause odd results rather than all white.

You could also try GL11.glGetError() after each of the main steps to verify the code.

  • stride

[quote]glEnable(GL_TEXTURE_CUBE_MAP);
[/quote]
this line worked to bring the textures onto the cubes, however it now looks incredibly messed up.

http://picpaste.com/Capture-XmxKkRi2.PNG