2013-02-20 55 views
2

在我的项目即时通讯寻找使用一些纹理为不同的对象。JOGL - 多纹理

在分钟,我有以下代码:

private Texture[] textures = new Texture[1]; 
private int texture1 = 0; // Which Filter To Use 
private String textureFilename = "src/data/image.jpg"; 

而且还textures[texture1].bind(gl);将其绑定的对象,在一分钟的纹理被绑定到每一个对象,这心不是我想要的。

我假设一个方法来包含一个纹理列表,然后可以绑定到每个对象?只是想知道如何做到这一点,我试图复制和编辑上面的代码,但它给了我错误,所以即时猜测我做错了。

回答

0

private Texture[] textures = new Texture[1+more];
//private int texture1 = 0; // Which Filter To Use
private String textureFilename[1+more] = "src/data/image.jpg";

File textureFile = new File(textFile);
textures[any] = TextureIO.newTexture(textureFilename[any], true);

// draw
gl.glEnable(GL.GL_TEXTURE_2D);
texture[Index].bind();
texture[Index].enable();
`...