src/gl/compiler.h

changeset 259
c27612f0eac0
parent 217
6d95c1a41e6e
child 264
76a025db4948
equal deleted inserted replaced
258:fe094d0687ad 259:c27612f0eac0
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #pragma once 19 #pragma once
20 #include "basics.h"
21 #include "gl/common.h"
22 #include "types/boundingbox.h"
23 #include <glm/gtc/type_ptr.hpp> 20 #include <glm/gtc/type_ptr.hpp>
24 #include <QOpenGLVertexArrayObject> 21 #include <QOpenGLVertexArrayObject>
25 #include <QOpenGLBuffer> 22 #include <QOpenGLBuffer>
26 #include <QOpenGLShaderProgram> 23 #include <QOpenGLShaderProgram>
27 #include <QOpenGLExtraFunctions> 24 #include "basics.h"
25 #include "gl/common.h"
26 #include "types/boundingbox.h"
28 #include "model.h" 27 #include "model.h"
29 28
30 class Model; 29 class Model;
31 class DocumentManager; 30 class DocumentManager;
32 31
87 void setShaderUniform(gl::ModelShaders* shaders, const char* uniformName, T&& value) 86 void setShaderUniform(gl::ModelShaders* shaders, const char* uniformName, T&& value)
88 { 87 {
89 for (gl::ModelShaders::ShaderObject& shader : shaders->shaderObjects) 88 for (gl::ModelShaders::ShaderObject& shader : shaders->shaderObjects)
90 { 89 {
91 shader.program->bind(); 90 shader.program->bind();
92 const int location = glfunc.glGetUniformLocation(shader.program->programId(), uniformName); 91 const int location = glfunc().glGetUniformLocation(shader.program->programId(), uniformName);
93 Q_ASSERT(location != -1); 92 Q_ASSERT(location != -1);
94 shader.program->setUniformValue(location, std::forward<T>(value)); 93 shader.program->setUniformValue(location, std::forward<T>(value));
95 shader.program->release(); 94 shader.program->release();
96 } 95 }
97 } 96 }

mercurial