Qt Opengl :The shader uses varing xxx,but previous shader does not write to it. Out

在使用QT5.12和QT Creator 4.8进行OpenGL开发时,遇到链接错误,提示着色器程序未链接且varying变量未被前一个着色器写入。解决办法是确保顶点着色器的Out变量与片段着色器的In变量匹配,以避免资源错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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: The shader uses varying xxxx, but previous shader does not write to it.
Out of resource error.

3.解决方案

在这里插入图片描述
顶点着色器文件中的Out变量必须和片段着色器文件中的In变量一致!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值