オブジェクトを使用してJOGLで画像をレンダリングしていTexture
ますが、逆さまにレンダリングされています(画像: http://puu.sh/Q2QT )。コードは次のとおりです。
private void renderImage(GL2 gl, String filename, int width, int height) {
Texture texture = null;
try {
texture = TextureIO.newTexture(new File(this.getClass().getResource(filename).toURI()), true);
}
catch (URISyntaxException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
int left = 0;
int top = 0;
texture.enable(gl);
texture.bind(gl);
gl.glBegin(GL2.GL_POLYGON);
gl.glTexCoord2d(0, 0);
gl.glVertex2d(left, top);
gl.glTexCoord2d(1, 0);
gl.glVertex2d(left + width, top);
gl.glTexCoord2d(1, 1);
gl.glVertex2d(left + width, top + height);
gl.glTexCoord2d(0, 1);
gl.glVertex2d(left, top + height);
gl.glEnd();
gl.glFlush();
texture.disable(gl);
texture.destroy(gl);
}