Java examples for javax.media.opengl:GL
set opengl Draw Position
import java.awt.Color; import javax.media.opengl.GL; public class Main{ public static void setDrawPosition(GL gl, CanvasModel cm, int x, int y) { resetPosition(gl, cm);/*from w ww . j av a2 s.com*/ setDrawOffset(gl, x, y); } public static void resetPosition(GL gl, CanvasModel cm) { gl.glLoadIdentity(); gl.glScalef(1f, -1f, 0f); gl.glTranslatef(-cm.halfWidth, -cm.halfHeight, 0f); } public static void setDrawOffset(GL gl, int offsetX, int offsetY) { gl.glTranslatef((float) offsetX, (float) offsetY, 0f); } }