May 2019
Intermediate to advanced
542 pages
13h 37m
English
Our shader programs contained some variables that we need to be able to access and put values into, so we need to retrieve a handle for those variables. The QOpenGLProgram object has two methods, attributeLocation() and uniformLocation(), which can be used to retrieve a handle for attribute and uniform variables, respectively (there is no such function for the varying types).
Let's grab some handles for our vertex shader variables:
self.vertex_location = self.program.attributeLocation('vertex') self.matrix_location = self.program.uniformLocation('matrix') self.color_location = self.program.attributeLocation('color_attr')
The values returned from these methods are actually just integers; internally, OpenGL just uses ...
Read now
Unlock full access