public void OnSurfaceChanged(IGL10 gl, int width, int height)
            {
                // 设置3D视窗的大小及位置
                gl.GlViewport(0, 0, width, height);
                // 将当前矩阵模式设为投影矩阵
                gl.GlMatrixMode(GL10.GlProjection);
                // 初始化单位矩阵
                gl.GlLoadIdentity();
                // 计算透视视窗的宽度、高度比
                float ratio = (float)width / height;

                // 调用此方法设置透视视窗的空间大小。
                gl.GlFrustumf(-ratio, ratio, -1, 1, 1, 10);
            }
Exemplo n.º 2
0
		public void OnSurfaceChanged (IGL10 gl, int width, int height)
		{
			gl.GlViewport (0, 0, width, height);

			/*
			 * Set our projection matrix. This doesn't have to be done
			 * each time we draw, but usually a new projection needs to
			 * be set when the viewport is resized.
			 */

			float ratio = (float) width / height;
			gl.GlMatrixMode (GL10.GlProjection);
			gl.GlLoadIdentity ();
			gl.GlFrustumf (-ratio, ratio, -1, 1, 1, 10);
		}
        public void OnSurfaceChanged(IGL10 gl, int width, int height)
        {
            gl.GlViewport(0, 0, width, height);

            /*
             * Set our projection matrix. This doesn't have to be done
             * each time we draw, but usually a new projection needs to
             * be set when the viewport is resized.
             */

            float ratio = (float)width / height;

            gl.GlMatrixMode(GL10.GlProjection);
            gl.GlLoadIdentity();
            gl.GlFrustumf(-ratio, ratio, -1, 1, 1, 10);
        }