oglstackhandler.java

来自「world wind java sdk 源码」· Java 代码 · 共 116 行

JAVA
116
字号
/*Copyright (C) 2001, 2009 United States Governmentas represented by the Administrator of theNational Aeronautics and Space Administration.All Rights Reserved.*/package gov.nasa.worldwind.util;import javax.media.opengl.GL;/** * @author tag * @version $Id: OGLStackHandler.java 9323 2009-03-12 04:53:44Z dcollins $ */public class OGLStackHandler{    private boolean attribsPushed;    private boolean clientAttribsPushed;    private boolean modelviewPushed;    private boolean projectionPushed;    private boolean texturePushed;    public void pushAttrib(GL gl, int mask)    {        gl.glPushAttrib(mask);        this.attribsPushed = true;    }    public void pushClientAttrib(GL gl, int mask)    {        gl.glPushClientAttrib(mask);        this.clientAttribsPushed = true;    }    public void pushModelview(GL gl)    {        gl.glMatrixMode(GL.GL_MODELVIEW);        gl.glPushMatrix();        this.modelviewPushed = true;    }    public void pushProjection(GL gl)    {        gl.glMatrixMode(GL.GL_PROJECTION);        gl.glPushMatrix();        this.projectionPushed = true;    }    public void pushTexture(GL gl)    {        gl.glMatrixMode(GL.GL_TEXTURE);        gl.glPushMatrix();        this.texturePushed = true;    }    public void pop(GL gl)    {        if (this.attribsPushed)        {            gl.glPopAttrib();            this.attribsPushed = false;        }        if (this.clientAttribsPushed)        {            gl.glPopClientAttrib();            this.clientAttribsPushed = false;        }        if (this.modelviewPushed)        {            gl.glMatrixMode(GL.GL_MODELVIEW);            gl.glPopMatrix();            this.modelviewPushed = false;        }        if (this.projectionPushed)        {            gl.glMatrixMode(GL.GL_PROJECTION);            gl.glPopMatrix();            this.projectionPushed = false;        }        if (this.texturePushed)        {            gl.glMatrixMode(GL.GL_TEXTURE);            gl.glPopMatrix();            this.texturePushed = false;        }    }    public void pushModelviewIdentity(GL gl)    {        gl.glMatrixMode(GL.GL_MODELVIEW);        this.modelviewPushed = true;        gl.glPushMatrix();        gl.glLoadIdentity();    }    public void pushProjectionIdentity(GL gl)    {        gl.glMatrixMode(GL.GL_PROJECTION);        this.projectionPushed = true;        gl.glPushMatrix();        gl.glLoadIdentity();    }    public void pushTextureIdentity(GL gl)    {        gl.glMatrixMode(GL.GL_TEXTURE);        this.texturePushed = true;        gl.glPushMatrix();        gl.glLoadIdentity();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?