Ejemplo n.º 1
0
 public void pushTextureIdentity(GL2 gl)
 {
     gl.MatrixMode(GL2.GL_TEXTURE);
     this.texturePushed = true;
     gl.PushMatrix();
     gl.LoadIdentity();
 }
Ejemplo n.º 2
0
 public void pushProjectionIdentity(GL2 gl)
 {
     gl.MatrixMode(GL2.GL_PROJECTION);
     this.projectionPushed = true;
     gl.PushMatrix();
     gl.LoadIdentity();
 }
Ejemplo n.º 3
0
 public void pushModelviewIdentity(GL2 gl)
 {
     gl.MatrixMode(GL2.GL_MODELVIEW);
     this.modelviewPushed = true;
     gl.PushMatrix();
     gl.LoadIdentity();
 }
Ejemplo n.º 4
0
        public Matrix pushReferenceCenter(DrawContext dc, Vec4 referenceCenter)
        {
            if (dc == null)
            {
                String message = Logging.getMessage("nullValue.DrawContextIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }
            if (dc.getGL() == null)
            {
                String message = Logging.getMessage("nullValue.DrawingContextGLIsNull");
                Logging.logger().severe(message);
                throw new IllegalStateException(message);
            }
            if (referenceCenter == null)
            {
                String message = Logging.getMessage("nullValue.PointIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            Matrix modelview = getModelviewMatrix();

            // Compute a new model-view matrix with origin at referenceCenter.
            Matrix matrix = null;

            if (modelview != null)
            {
                matrix = modelview.multiply(Matrix.fromTranslation(referenceCenter));
            }

            GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

            // Store the current matrix-mode state.
            OGLStackHandler ogsh = new OGLStackHandler();

            try
            {
                ogsh.pushAttrib(gl, GL2.GL_TRANSFORM_BIT);

                gl.MatrixMode(GL2.GL_MODELVIEW);

                // Push and load a new model-view matrix to the current OpenGL context held by 'dc'.
                gl.PushMatrix();
                if (matrix != null)
                {
                    double[] matrixArray = new double[16];
                    matrix.toArray(matrixArray, 0, false);
                    gl.LoadMatrix(matrixArray);
                }
            }
            finally
            {
                ogsh.pop(gl);
            }

            return(matrix);
        }
Ejemplo n.º 5
0
 public void pushTexture(GL2 gl)
 {
     gl.MatrixMode(GL2.GL_TEXTURE);
     gl.PushMatrix();
     this.texturePushed = true;
 }
Ejemplo n.º 6
0
 public void pushProjection(GL2 gl)
 {
     gl.MatrixMode(GL2.GL_PROJECTION);
     gl.PushMatrix();
     this.projectionPushed = true;
 }
Ejemplo n.º 7
0
 public void pushModelview(GL2 gl)
 {
     gl.MatrixMode(GL2.GL_MODELVIEW);
     gl.PushMatrix();
     this.modelviewPushed = true;
 }