Passing uniform 4x4 matrix to vertex shader program

前端 未结 2 943
南笙
南笙 2021-02-14 00:58

I am trying to learn OpenGL and following this: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

Up until the point where they started passing mat

2条回答
  •  轮回少年
    2021-02-14 01:34

    glUniform*() calls set values for the current program. You need to call glUseProgram() before the glUniform*() call. In this example:

    glUseProgram(programID);
    glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
    

提交回复
热议问题