May 2019
Intermediate to advanced
542 pages
13h 37m
English
Our next step in implementing an OpenGL drawing is to create our program. You may remember that an OpenGL program is a collection of shaders that form a complete pipeline.
In Qt, the process to create a program is as follows:
The following code will implement this:
self.program = qtg.QOpenGLShaderProgram() self.program.addShaderFromSourceFile( qtg.QOpenGLShader.Vertex, 'vertex_shader.glsl') self.program.addShaderFromSourceFile( qtg.QOpenGLShader.Fragment, 'fragment_shader.glsl') self.program.link()
Shaders can be added from files, as we've done here using addShaderFromSourceFile(), or from strings using addShaderFromSourceCode() ...
Read now
Unlock full access