コード例 #1
0
            public void onSurfaceChanged(GL10 glUnused, int width, int height)
            {
                // Set the OpenGL viewport to the same size as the surface.
                gl.viewport(0, 0, width, height);

                // Create a new perspective projection matrix. The height will stay the same
                // while the width will vary as per aspect ratio.
                float ratio  = (float)width / height;
                float left   = -ratio;
                float right  = ratio;
                float bottom = -1.0f;
                float top    = 1.0f;
                float near   = 1.0f;
                float far    = 10.0f;

                Matrix.frustumM(mProjectionMatrix, 0, left, right, bottom, top, near, far);
            }