Exemple #1
0
 public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
   GL2 gl = drawable.getGL().getGL2();
   //
   gl.glViewport(0, 0, w, h);
   gl.glMatrixMode(GL2.GL_PROJECTION);
   gl.glLoadIdentity();
   if (w <= (h * 3))
     gl.glOrtho(
         -6.0,
         6.0,
         -2.0 * ((float) h * 3) / (float) w,
         2.0 * ((float) h * 3) / (float) w,
         0.0,
         10.0);
   else
     gl.glOrtho(
         -6.0 * (float) w / ((float) h * 3), //
         6.0 * (float) w / ((float) h * 3),
         -2.0,
         2.0,
         0.0,
         10.0);
   gl.glMatrixMode(GL2.GL_MODELVIEW);
   gl.glLoadIdentity();
 }
Exemple #2
0
 public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
   GL2 gl = drawable.getGL().getGL2();
   //
   gl.glViewport(0, 0, w, h);
   gl.glMatrixMode(GL2.GL_PROJECTION);
   gl.glLoadIdentity();
   if (w <= h)
     gl.glOrtho(-2.5, 2.5, -2.5 * (float) h / (float) w, 2.5 * (float) h / (float) w, -10.0, 10.0);
   else
     gl.glOrtho(-2.5 * (float) w / (float) h, 2.5 * (float) w / (float) h, -2.5, 2.5, -10.0, 10.0);
   gl.glMatrixMode(GL2.GL_MODELVIEW);
 }