-1
我想从我的顶点着色器向我的片段着色器发送变量,但是当我在if语句中包含特定的in
变量时,它不会显示任何内容。删除if语句会导致所有内容出现并正常工作。奇怪的是,如果语句实际上并没有做任何事情,并且片段着色器没有产生任何错误。片段着色器IN变量不会导致任何内容出现
我从我的顶点着色器发送到我的片段着色器有几个其他变量,但这一个具体是唯一一个导致问题。我知道type
正在设置正确,因为我用它来正常工作的其他东西。
顶点着色器
#version 150
in float type;
out int roofBool;
void main(void)
{
textureXY = texcoords;
roofBool = 0;
if(type == 2){
roofBool = 1;
}
}
片段着色器
#version 150
in int roofBool;
// The output. Always a color
out vec4 fragColor;
void main()
{
int a = 0;
if(roofBool == 1){ //removing this causes everything to work
a = 2;
}
}