freezE
freezE

Reputation: 1

how to pass matrix2 to shader

in shader, i have:

uniform mat2 textureMatrix;

in java, i have:

    Matrix2f txMat = new Matrix2f();

    txMat.m00 = (float)1;
    txMat.m01 = (float)2;
    txMat.m10 = (float)3;
    txMat.m11 = (float)4;

    FloatBuffer buffer = BufferUtils.createFloatBuffer(4);

    txMat.load(buffer);

    int loc5 = glGetUniformLocation(programID, "textureMatrix");
    glUniformMatrix2(loc5, false, buffer); 

Why doesn't this work ?

Upvotes: 0

Views: 85

Answers (1)

Matti Virkkunen
Matti Virkkunen

Reputation: 65166

Haven't used LWJGL but I'm gonna go out on a whim and guess you want store instead of load. You're loading the matrix from the buffer you created, instead of putting the matrix into the buffer.

Upvotes: 1

Related Questions