在我的项目中,我希望为不同的对象使用一些纹理。
目前我有以下代码:
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);
将它绑定(bind)到对象,此时纹理被绑定(bind)到每个对象,这不是我想要的。
我假设有一种方法可以包含一个纹理列表,然后可以将其绑定(bind)到每个对象?只是想知道如何做到这一点,我尝试复制和编辑上面的代码,但它给我错误,所以我猜我做错了。
最佳答案
private Texture[] textures = new Texture[1+more];
//private int texture1 = 0;//使用哪个过滤器
private String textureFilename[1+more] = "src/data/image.jpg";
File textureFile = new File(textFile);
textures[any] = TextureIO.newTexture(textureFilename[any], true);
//绘制
gl.glEnable(GL.GL_TEXTURE_2D);
纹理[索引].bind();
纹理[Index].enable();
`...
关于java - JOGL - 多重纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14984938/