OpenGL uniform变量赋值的三种方法
生活随笔
收集整理的這篇文章主要介紹了
OpenGL uniform变量赋值的三种方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
unsigned int modelLoc = glGetUniformLocation(ourShader.ID, "model");unsigned int viewLoc = glGetUniformLocation(ourShader.ID, "view");// pass them to the shaders (3 different ways)//方法一glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));//方法二glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]);// note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once.//方法三ourShader.setMat4("projection", projection);
總結
以上是生活随笔為你收集整理的OpenGL uniform变量赋值的三种方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OpenGL 坐标变换
- 下一篇: Qt OpenGL环境配置的问题