QT5.12 Ui界面开发项目:QOpenGLShaderProgram::uniformLocation(model): shader program is not linked

1. 版本介绍:

(1)QT版本:QT5.12 +QT Creator 4.8
(2)编译器版本:windows msvc2017 32bit / 64bit

2. 问题描述:

QOpenGLShaderProgram::uniformLocation(model): shader program is not linked
QOpenGLShaderProgram::uniformLocation(view): shader program is not linked
QOpenGLShaderProgram::uniformLocation(projection): shader program is not linked
QOpenGLShaderProgram::uniformLocation(lightPos): shader program is not linked
QOpenGLShaderProgram::uniformLocation(lightAmbient): shader program is not linked
QOpenGLShaderProgram::uniformLocation(lightDiffuse): shader program is not linked
QOpenGLShaderProgram::uniformLocation(matAmbient): shader program is not linked
QOpenGLShaderProgram::uniformLocation(matDiffuse): shader program is not linked
QOpenGLShader::link : Link called without any attached shader objects.

3.问题解决

(1)检查顶点着色器和片段着色器文件路径是否有错。
(2)检查shader文件中是否有中文注释。【有的人的shader文件有注释也没关系,但也有人因有中文注释报错】
(3)shader文件的编码格式应该是ANSI,将着色器文件fshader.glsl和vshader.glsl用记事本打开另存为ANSI格式。否则,将出现上述错误。注意:shader文件另存为txt后尽量不要把txt后缀改成其他形式,否则编码格式可能会恢复为默认的“utf-8”。
QT5.12 Ui界面开发项目:QOpenGLShaderProgram::uniformLocation(model): shader program is not linked

上一篇:win下添加Notepad3右键菜单


下一篇:SkiaSharp跨平台绘图研究1-WPF桌面应用