Exemplo n.º 1
0
        public void OnSurfaceChanged(IGL10 gl, int width, int height)
        {
            RenderManager.width  = width;
            RenderManager.height = height;
            RenderManager.gl     = gl;
            RenderManager.GetCurrent().width  = width;
            RenderManager.GetCurrent().height = height;
            GLES20.GlViewport(0, 0, width, height);
            float ratio  = (float)width / height;
            float left   = -ratio;
            float right  = ratio;
            float top    = 1.0f;
            float bottom = -1.0f;
            float near   = 5.4f;
            float far    = 200.0f;

            Matrix.FrustumM(RenderManager.GetCurrent().mProjectionMatrix, 0, left, right, bottom, top, near, far);
            //ORTHO!
            //Matrix.OrthoM(RenderManager.GetCurrent().mProjectionMatrix, 0, 0f, width, 0.0f, height, 0, 50);
        }
Exemplo n.º 2
0
        public static float GetScrY(float x, float y, float z)
        {
            if (RenderManager.GetCurrent() == null)
            {
                return(-1);
            }

            float[] vector   = new float[4];
            int[]   viewport = new int[] { 0, 0, RenderManager.width, RenderManager.height };

            GLU.GluProject(x, y, z, RenderManager.GetCurrent()._mViewMatrix, 0, RenderManager.GetCurrent().mProjectionMatrix, 0, viewport, 0, vector, 0);

            if (vector[2] > 1.0f)
            {
                return(-1.0f);
            }
            else
            {
                return(viewport[3] - vector[1]);
            }
        }