@Override
    public void onSurfaceChanged(GL10 unused, int width, int height) {
        sizeX = mNumberOfTilesX;
        sizeY = height * sizeX /  width;

        // Set the OpenGL viewport to the same size as the surface.
        GLES20.glViewport(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.
        final float ratio = (float) width / height;

        final float left = -ratio;
        final float right = ratio;
        final float bottom = -1.0f;
        final float top = 1.0f;
        final float near = 1.0f;
        final float far = 10.0f;

        this.ratio = ratio;

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

        genTilesData();
    }
Allocate storage for the final combined matrix. This will be passed into the shader program.
library/src/main/java/com/yalantis/starwars/render/StarWarsRenderer.java