Example usage for android.opengl GLES20 glUniformMatrix4fv

List of usage examples for android.opengl GLES20 glUniformMatrix4fv

Introduction

In this page you can find the example usage for android.opengl GLES20 glUniformMatrix4fv.

Prototype

public static native void glUniformMatrix4fv(int location, int count, boolean transpose, float[] value,
            int offset);

Source Link

Usage

From source file:com.google.vrtoolkit.cardboard.samples.treasurehunt.MainActivity.java

/**
 * Draw the floor.// ww w  .j  av a 2s. c  o  m
 *
 * <p>This feeds in data for the floor into the shader. Note that this doesn't feed in data about
 * position of the light, so if we rewrite our code to draw the floor first, the lighting might
 * look strange.
 */
public void drawFloor() {
    GLES20.glUseProgram(floorProgram);

    // Set ModelView, MVP, position, normals, and color.
    GLES20.glUniform3fv(floorLightPosParam, 1, lightPosInEyeSpace, 0);
    GLES20.glUniformMatrix4fv(floorModelParam, 1, false, modelFloor, 0);
    GLES20.glUniformMatrix4fv(floorModelViewParam, 1, false, modelView, 0);
    GLES20.glUniformMatrix4fv(floorModelViewProjectionParam, 1, false, modelViewProjection, 0);
    GLES20.glVertexAttribPointer(floorPositionParam, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, 0,
            floorVertices);
    GLES20.glVertexAttribPointer(floorNormalParam, 3, GLES20.GL_FLOAT, false, 0, floorNormals);
    GLES20.glVertexAttribPointer(floorColorParam, 4, GLES20.GL_FLOAT, false, 0, floorColors);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);

    checkGLError("drawing floor");
}