【问题标题】:JOGL - Multiple texturesJOGL - 多种纹理
【发布时间】:2013-02-20 16:29:10
【问题描述】:

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

此刻我有以下代码:

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); 将其绑定到对象,此时纹理正在绑定到每个对象,这不是我想要的。

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

【问题讨论】:

    标签: java opengl jogl


    【解决方案1】:

    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();
    `...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多