【发布时间】:2016-08-04 18:09:43
【问题描述】:
我正在尝试显示窗口的纹理(在 3d 中) 这是我的代码
try {
texture = TextureLoader.getTexture("PNG", new FileInputStream(new File("res\\window.png")));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex3f(0, 0, 0);
GL11.glTexCoord2f(1, 0);
GL11.glVertex3f(10, 0, 0);
GL11.glTexCoord2f(1, 1);
GL11.glVertex3f(10, 10, 0);
GL11.glTexCoord2f(0, 1);
GL11.glVertex3f(0, 10, 0);
GL11.glEnd();
GL11.glDisable(GL11.GL_TEXTURE_2D);
这是真实的图像:
现在问题来了:lwjgl 或曾经做过什么,完全改变了纹理的颜色? 这就是图像的显示方式:
没有错误,什么都没有。
【问题讨论】:
-
这是不推荐使用的OpenGL,你应该避免它
标签: java textures lwjgl game-engine