GLSL <> Betreiber auf eine vec4

Ich bin auf der Suche auf einige neuere GLSL-code, der nicht kompiliert zu meiner aktuellen version von OpenGL, und ich Frage mich, was die Kurzform der folgenden Mittel:

vec4 base;

if (base < 0.5) {
    result = (2.0 * base * blend);
}

Ist dies äquivalent zu:

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;
}

Edit:

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)

Habe ich auch versucht:

(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'

Ich gehe davon aus dies ist weil ich bin mit GLSL 1.2.
ATI Radeon 3450

  • OS, GL-Implementierung, Hersteller, Treiber version, und die Fehlermeldung(en)?
  • Aktualisiert mit Fehlermeldungen.
  • Also, der ursprüngliche code nicht kompilieren? Wo hast du es bekommen? Sind Sie sicher, dass es funktionieren sollte?
InformationsquelleAutor ansiart | 2011-05-02
Schreibe einen Kommentar