Opengl GLSL<&燃气轮机;向量4上的运算符

Opengl GLSL<&燃气轮机;向量4上的运算符,opengl,glsl,Opengl,Glsl,我正在查看一些新的GLSL代码,这些代码没有编译到我当前版本的OpenGL,我想知道以下简称的含义是什么: vec4 base; if (base < 0.5) { result = (2.0 * base * blend); } vec4碱基; if(基准

我正在查看一些新的GLSL代码,这些代码没有编译到我当前版本的OpenGL,我想知道以下简称的含义是什么:

vec4 base;

if (base < 0.5) {
    result = (2.0 * base * blend);
}
vec4碱基;
if(基准<0.5){
结果=(2.0*基础*混合);
}
这是否等于:

if (base.r < 0.5 && base.g < 0.5 && base.b < 0.5 && base.a < 0.5) {
    result.r = 2.0 * base.r * blend.r;
    result.g = 2.0 * base.g * blend.g;
    result.b = 2.0 * base.b * blend.b;
    result.a = 2.0 * base.a * blend.a;
}
if(base.r<0.5&&base.g<0.5&&base.b<0.5&&base.a<0.5){
结果.r=2.0*base.r*blend.r;
结果.g=2.0*base.g*blend.g;
结果.b=2.0*基础.b*混合.b;
结果.a=2.0*基础.a*混合.a;
}
编辑:

错误:
片段着色器未能编译,出现以下错误:
第5.9节(第38页顶部)中的操作数类型错误无操作“:

关系运算符大于 (>),小于(=),小于或等于
(操作系统、GL实施供应商、驱动程序版本和错误消息)?原来的代码没有编译?你从哪里得到的?你确定它应该能工作吗?只是吹毛求疵:一个有效的答案,但你可能想参考。你的规范来自2006@Bart:OP说他/她正在使用GLSL 1.2,所以我想我会从该版本的规范中退出。Plus Mesa仍在2.1上,所以4.1还不存在:):)然后我就开始挑剔了。应该意识到这是有原因的无论如何,现在OP有2个选项可供选择:P
Error:
Fragment shader failed to compile with the following errors:
Wrong operand types no operation '<' exists that takes a left-hand operand of type 'highp 3-component vector of float' and a right operand of type 'const float' (or there is no acceptable conversion)
(base.rgb < vec3(0.5))
... Wrong operand types no operation '<' exists that takes a left-hand operand of type 'highp 3-component vector of float' and a right operand of type 'const highp 3-component vector of float'