@Override
    public void render() {
        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

        final int stride = Const.BYTES_PER_FLOAT
                * (Const.POSITION_DATA_SIZE
                   + Const.NORMALS_DATA_SIZE
                   + Const.TEXTURE_COORDS_DATA_SIZE
                   + Const.TILE_DATA_SIZE);

        // Pass in the position information
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mBufferId);
        GLES20.glEnableVertexAttribArray(mRenderer.positionHandle);
        GLES20.glVertexAttribPointer(mRenderer.positionHandle,
                Const.POSITION_DATA_SIZE,
                GLES20.GL_FLOAT,
                false,
                stride,
                0
        );

        // Pass in the normal information
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mBufferId);
        GLES20.glEnableVertexAttribArray(mRenderer.normalHandle);
        GLES20.glVertexAttribPointer(mRenderer.normalHandle,
                Const.NORMALS_DATA_SIZE,
                GLES20.GL_FLOAT,
                false,
                stride,
                Const.BYTES_PER_FLOAT * Const.POSITION_DATA_SIZE
        );

        // Pass in the texture information
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mBufferId);
        GLES20.glEnableVertexAttribArray(mRenderer.textureCoordinateHandle);
        GLES20.glVertexAttribPointer(mRenderer.textureCoordinateHandle,
                Const.TEXTURE_COORDS_DATA_SIZE,
                GLES20.GL_FLOAT,
                false,
                stride,
                Const.BYTES_PER_FLOAT * (Const.POSITION_DATA_SIZE + Const.NORMALS_DATA_SIZE)
        );

        // Pass in the tile x,y information
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mBufferId);
        GLES20.glEnableVertexAttribArray(mRenderer.tileXyHandle);
        GLES20.glVertexAttribPointer(mRenderer.tileXyHandle,
                Const.TILE_DATA_SIZE,
                GLES20.GL_FLOAT,
                false,
                stride,
                Const.BYTES_PER_FLOAT * (Const.POSITION_DATA_SIZE + Const.NORMALS_DATA_SIZE + Const.TEXTURE_COORDS_DATA_SIZE)
        );

        // Clear the currently bound buffer (so future OpenGL calls do not use this buffer).
        GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

        // Draw tiles
        GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, mRenderer.sizeX * mRenderer.sizeY * 6);
    }
Started by Artem Kholodnyi on 11/1/15 12:40 PM -- com.yalantis.com.yalantis.starwars
library/src/main/java/com/yalantis/starwars/render/StarWarsTiles.java