创建 OpenGL 片段和顶点着色器
Qt 支持与所有平台上的 OpenGL 实现集成,因此您可以在显示传统用户界面的同时显示硬件加速的 3D 图形。有关详细信息,请参阅 Qt GUI.
您可以使用 QOpenGLShader 类编译以 OpenGL 着色语言(GLSL)和 OpenGL/ES 着色语言(GLSL/ES)编写的 OpenGL 着色器。QOpenGLShader 和 QOpenGLShaderProgram 可避免编译和链接顶点与片段着色器的细节。
创建 OpenGL 着色器
- 选择File >New File >GLSL 。
- 选择要创建的着色器类型,然后选择Choose 。
- 按照向导的指示创建着色器文件。
- 在代码编辑器中打开着色器文件,用 GLSL 或 GLSL/ES 编写着色器代码。代码编辑器可为文件提供语法高亮显示和代码自动补全功能。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.