- Qt Creator Documentation
- Create OpenGL fragment and vertex shaders
- Qt Creator 18.0.0-beta1

How To

# Create OpenGL fragment and vertex shaders

Qt supports integration with OpenGL implementations on all platforms, so you can display hardware accelerated 3D graphics alongside a more conventional user interface. For more information, see Qt GUI.

You can use the QOpenGLShader class to compile OpenGL shaders written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES). QOpenGLShader and QOpenGLShaderProgram shelter you from the details of compiling and linking vertex and fragment shaders.

To create OpenGL shaders:

1. Select File > New File > GLSL.

2. Select the type of the shader to create, and then select Choose.
3. Follow the instructions of the wizard to create the shader file.
4. Open the shader file in the code editor, and write the shader code in GLSL or GLSL/ES. The code editor offers syntax highlighting and code completion for the files.

See also Create files and Use project wizards.

How To