Skip to main content
gamedev.net
🔒 Locked

Texture binding

Started by jarod83 Jan 19, 2005 at 5:39 PM 1 replies 850+ views
Original Post
jarod83
jarod83
Hello! I'm doing some texture binding but I have a strange problem. The program is written in java, using JOGL for OpenGL. When I initialize the textures in a for loop, I do the following, an it works fine:

if (u == 1) {
    gl.glBindTexture(GL.GL_TEXTURE_2D, textures[1]);
}
else {
    gl.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
}

but... If I do the following, only textures[1] is working:

if (u == 1) {
    gl.glBindTexture(GL.GL_TEXTURE_2D, textures[0]);
}
else {
    gl.glBindTexture(GL.GL_TEXTURE_2D, textures[1]);
}

Notice that textures[0] and textures[1] are exchanged in if and else blocks... What is wrong ?!?
Zipster
Zipster
Hard to say what's wrong, because that's quite a small section of code to work with. But it's possible that the condition u != 1 is necessary for either textures[0] or gl to be valid.

Other than that, all I can do is shrug [dead]
jarod83
jarod83
Quote:
Original post by Zipster
Hard to say what's wrong, because that's quite a small section of code to work with. But it's possible that the condition u != 1 is necessary for either textures[0] or gl to be valid.

Other than that, all I can do is shrug [dead]


When I map textures in some order then all of them are mapped correctly, but if I map them in som other order then some textures are mapped and som are not(i get white texture)...
WTF ???

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.