opengl-es-2.0

Identity matrix confusion


I have the following vertex shader:

attribute vec4 Position;
attribute vec4 SourceColor;
varying vec4 DestinationColor;
uniform mat4 Projection;

void main(void) {
    DestinationColor = SourceColor;
    gl_Position = Projection * Position;
}

I then try to apply the following matrix to the Projection uniform:

float matrix[16] = {
    1.0f, 0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f, 0.0f,
    0.0f, 0.0f, 1.0f, 0.0f,
    0.0f, 0.0f, 0.0f, 1.0f
};

glUniformMatrix4fv(projectionSlot, 1, GL_FALSE, matrix);

Shouldn't this do nothing? After running this, I can't see my objects on the screen anymore...


Solution

  • Yes it should be a no-op. If you remove the projection multiply then you say it works fine? Couple ideas: