コード例 #1
0
        public void OnSurfaceChanged(IGL10 gl, int width, int height)
        {
            gl.GlViewport(0, 0, width, height);
            mViewportWidth  = width;
            mViewportHeight = height;

            float ratio = (float)width / height;

            mViewRect.Top    = 1.0f;
            mViewRect.Bottom = -1.0f;
            mViewRect.Left   = -ratio;
            mViewRect.Right  = ratio;
            UpdatePageRects();

            gl.GlMatrixMode(GL10.GlProjection);
            gl.GlLoadIdentity();
            if (USE_PERSPECTIVE_PROJECTION)
            {
                GLU.GluPerspective(gl, 20f, (float)width / height, .1f, 100f);
            }
            else
            {
                GLU.GluOrtho2D(gl, mViewRect.Left, mViewRect.Right,
                               mViewRect.Bottom, mViewRect.Top);
            }

            gl.GlMatrixMode(GL10.GlModelview);
            gl.GlLoadIdentity();
        }
コード例 #2
0
        public void OnSurfaceChanged(IGL10 gl, int width, int height)
        {
            gl.GlViewport(0, 0, width, height);
            gl.GlMatrixMode(IGL10Constants.GL_PROJECTION);
            gl.GlLoadIdentity();
            GLU.GluPerspective(gl, 45.0f, (float)width / (float)height, 0.1f, 100.0f);
            gl.GlViewport(0, 0, width, height);

            gl.GlMatrixMode(IGL10Constants.GL_MODELVIEW);
            gl.GlLoadIdentity();
        }