View Full Version : Texture mapping: Dice cube?
10-11-2001, 08:24 AM
I've had a lot of luck recently in my OpenGL programming experience but today I ran into another speed bump. As a demonstration on texture-mapping for my instructor, I will be attempting to create a dice cube but I will need different textures on each side of the cube. I realize you can't call glBindTexture between glBegin and glEnd calls, is there another way?
Use a glBegin/glEnd pair for each side of the cube, binding different textures for each pair.
draw one side here
draw another side here
... and so on, for each side.
10-11-2001, 09:02 AM
Thank you for your help...but now that I've seemed to have gotten around that I have another problem...
After I have loaded all of my textures by calling glBindTexture followed by glTexImage2d for each, only the final image loaded is the one that is displayed on the cube. The other faces of the cube are a blank white. Is there another command that I should be calling so that all 6 of my images are stored (and thus able to be recalled) properly?
A completely white texture either means no texture, or something is wrong with the texture.
Does all textures have a unique texture ID? Does the textures have the correct parameters? Are they correctly loaded from file (if that's what you do)?
To see whether there's anything wrong with the textures, upload only one texture, and assign it to all sides (as you did before). If all textures shows up OK (a total of siz tests needed with recompilation/execution), theres probably something wrong with the way you manage your textures.
Something that's not entirely clear to me, is whether you set additional glTexParameters, or if you upload a complete mipmap set. See, the default minification filter in OpenGL is GL_NEAREST_MIPMAP_LINEAR, which requires a while set of mipmaps to work correct. An uncomlete set results in a white texture. Either upload a complete set, or set minification to a non-mipmap one (GL_LINEAR or GL_NEAREST). Also remember that glTexParameter operates per trexture. Setting new texture parameters only affects the currently bound texture. You have to set the parameters for each texture separately.
If nothing of this works, post some of your code. It really helps a lot.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.