O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Shaders

Qt can make use of shaders through a set of classes based around QOpenGLShaderProgram. This class allows compiling, linking, and executing of shader programs written in GLSL. You can check whether your OpenGL implementation supports shaders by inspecting the result of a static QOpenGLShaderProgram::hasOpenGLShaderPrograms() call that accepts a pointer to an OpenGL context. All modern hardware and all decent graphics drivers should have some support for shaders.

Qt supports all kinds of shaders, with the most common being vertex and fragment shaders. These are both part of the classic OpenGL pipeline. You can see an illustration of the pipeline in the following diagram:

A single shader is represented by an instance of the QOpenGLShader ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required