我有一个单一纹理的立方体 -
public class TextureDemo implements GLEventListener, KeyListener {
private Texture texture;
}
public void init(GLAutoDrawable gLDrawable) {
String filename="Picture1.jpg"; // the FileName to open
texture=TextureIO.newTexture(new File( filename ),true);
}
public void display(GLAutoDrawable gLDrawable) {
texture.bind();
gl.glBegin(GL.GL_QUADS);
// Front Face
gl.glTexCoord2f(0.0f, 0.0f);
gl.glVertex3f(-1.0f, -1.0f, 1.0f);
gl.glTexCoord2f(2f, 0.0f);
gl.glVertex3f(1.0f, -1.0f, 1.0f);
gl.glTexCoord2f(2f, 1.0f);
gl.glVertex3f(1.0f, 1.0f, 1.0f);
gl.glTexCoord2f(0.0f, 1.0f);
gl.glVertex3f(-1.0f, 1.0f, 1.0f);
// Back Face
...
}
我试图在上面的立方体上设置多个纹理,意味着在“正面”之后,替换为另一个将对另一个立方体面生效的纹理。
我怎么能做到这一点?