public void displayInit(Point pickPoint) { gl.glShadeModel(GL.GL_SMOOTH); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); if (pickPoint != null) { int[] vp = new int[4]; gl.glGetIntegerv(GL.GL_VIEWPORT, vp, 0); GLU glu = new GLU(); int px = (int) pickPoint.getX(); int py = (int) (vp[3] - pickPoint.getY()); glu.gluPickMatrix(px, py, 1e-2, 1e-2, vp, 0); } gl.glOrtho(0, bounds.getWidth(), 0, bounds.getHeight(), .1, depth); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt(0, 0, depth - 0.1, 0, 0, 0, 0, 1, 0); gl.glInitNames(); gl.glPushName(-1); }
public void reshape(Rectangle bounds) { gl.glViewport( (int) bounds.getX(), (int) bounds.getY(), (int) bounds.getWidth(), (int) bounds.getHeight()); this.bounds = bounds; }