Package javax.media.opengl

Examples of javax.media.opengl.GL2.glMatrixMode()


    // coordinate system origin at lower left with width and height same as the window
    GLU glu = new GLU();
    glu.gluOrtho2D(0.0f, getWidth(), 0.0f, getHeight());

    gl2.glMatrixMode(GL2.GL_MODELVIEW);
    gl2.glLoadIdentity();

    gl2.glViewport(0, 0, getWidth(), getHeight());

    controller.updateExtents(arg3 / 2, arg4 / 2);
View Full Code Here


    delegate.init();
  }
 
  private void initGLViewPort() {
    GL2 gl = delegate.getGL();
      gl.glMatrixMode(GL2.GL_PROJECTION);
      gl.glLoadIdentity();
     
      GLU glu = new GLU();
      float factorX = (float)delegate.getContext().getGLDrawable().getWidth() / (float)image.getWidth();
      float factorY = (float)delegate.getContext().getGLDrawable().getHeight() / (float)image.getHeight();
View Full Code Here

     
      GLU glu = new GLU();
      float factorX = (float)delegate.getContext().getGLDrawable().getWidth() / (float)image.getWidth();
      float factorY = (float)delegate.getContext().getGLDrawable().getHeight() / (float)image.getHeight();
      glu.gluOrtho2D(0, view.getWidth() * factorX, 0, view.getHeight() * factorY);
      gl.glMatrixMode(GL2.GL_MODELVIEW);
  }

  public void clear() {
    delegate.clear();
  }
View Full Code Here

    delegate.init();
  }

  private void initGLViewPort() {
    GL2 gl = delegate.getGL();
      gl.glMatrixMode(GL2.GL_PROJECTION);
      gl.glLoadIdentity();
     
      GLU glu = new GLU();
      glu.gluOrtho2D(-view.getWidth() / 2, view.getWidth() / 2, -view.getHeight() / 2, view.getHeight() / 2);
      gl.glMatrixMode(GL2.GL_MODELVIEW);
View Full Code Here

      gl.glMatrixMode(GL2.GL_PROJECTION);
      gl.glLoadIdentity();
     
      GLU glu = new GLU();
      glu.gluOrtho2D(-view.getWidth() / 2, view.getWidth() / 2, -view.getHeight() / 2, view.getHeight() / 2);
      gl.glMatrixMode(GL2.GL_MODELVIEW);
  }
 
  public void viewSizeChanged() {
    initGLViewPort();
  }
View Full Code Here

        final GL2 gl = drawable.getGL().getGL2();

        if (ortho) {
            gl.glDisable(GL_DEPTH_TEST);
            //gl.glDisable(GL_LIGHTING);
            gl.glMatrixMode(GL_PROJECTION);
            gl.glPushMatrix();
            gl.glLoadIdentity();
            // Object's longest dimension is 1, make window slightly larger.
            gl.glOrtho(-0.51*this.aspectRatio,0.51*this.aspectRatio,-0.51,0.51,-10,10);
            gl.glMatrixMode(GL_MODELVIEW);
View Full Code Here

            gl.glMatrixMode(GL_PROJECTION);
            gl.glPushMatrix();
            gl.glLoadIdentity();
            // Object's longest dimension is 1, make window slightly larger.
            gl.glOrtho(-0.51*this.aspectRatio,0.51*this.aspectRatio,-0.51,0.51,-10,10);
            gl.glMatrixMode(GL_MODELVIEW);
            gl.glPushMatrix();
            gl.glLoadIdentity();
        } else {
            gl.glEnable(GL.GL_DEPTH_TEST);

View Full Code Here

            gl.glLoadIdentity();
        } else {
            gl.glEnable(GL.GL_DEPTH_TEST);

            // Setup perspective projection, with aspect ratio matches viewport
            gl.glMatrixMode(GL_PROJECTION)// choose projection matrix
            gl.glLoadIdentity();             // reset projection matrix

            glu.gluPerspective(45.0, this.aspectRatio, 0.1, 100.0); // fovy, aspect, zNear, zFar
            // Move camera out and point it at the origin
            glu.gluLookAt(this.eye.x,  this.eye.y,  this.eye.z,
View Full Code Here

            glu.gluLookAt(this.eye.x,  this.eye.y,  this.eye.z,
                          0, 0, 0,
                          0, 1, 0);
           
            // Enable the model-view transform
            gl.glMatrixMode(GL_MODELVIEW);
            gl.glLoadIdentity(); // reset

        }
    }
   
View Full Code Here

  public void reshape(final GLAutoDrawable drawable, final int x, final int y,
      final int width, final int height) {
    // change viewport dimensions
    final GL2 gl = (GL2) drawable.getGL();
    gl.glViewport(0, 0, width, height);
    gl.glMatrixMode(GL2.GL_PROJECTION);
    gl.glLoadIdentity();
    this.glu.gluOrtho2D(0, width, height, 0);
    gl.glMatrixMode(GL2.GL_MODELVIEW);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.