gpt4 book ai didi

java - JOGL - 多重纹理

转载 作者:行者123 更新时间:2023-11-30 11:35:40 25 4
gpt4 key购买 nike

在我的项目中,我希望为不同的对象使用一些纹理。

目前我有以下代码:

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com