mardi 19 mai 2020

GLSL if statement not evaluating correctly

I have the following in my frag shader, using GLSL 1.4. This compiles correctly.

    int testint = 0;
    if(testint == 1) {
        // code executes no matter what
    }

The code within the if executes no matter what, even though testint is assigned to 0 immediately before. I've also tried swapping the condition with another equally untrue condition such as if(testint==5) or if(testint > 1) or !=0, yielding the same results.

If i remove the code within the if, it does not execute, I can verify this visually. Why is this if statement always evaluating true?

Aucun commentaire:

Enregistrer un commentaire