Problems with If statement

hey, im super new to glsl and was trying to write a shader that depends on an if statement, and after troubleshooting for about 2 hours, i found that the If statement itself is not working, it just seems to skip right over the whole statement

        if(1.0>0.0){
		vec4 v_vColour = vec4(0.0,1.0,0.0,1.0);
	}
	else{
		vec4 v_vColour = vec4(0.0,1.0,0.0,1.0);
	}

is my code, and despite both outcomes being change v_vColour to red, it doesnt at all, ive tested this without the if statement, just changing the color to red, and it works fine, ive also tried changing the condition to 1 == 1, and other things that should always be true, and yet it just seems to skip right over the statement. I have not found anyone else with this issue online, so i think maybe its just a really simple error in syntax.

after troubleshooting for longer, it was because i had set v_vColour to varying vec4, problem solved when i turned it to a normal vec4, sry.

v_vColour is a local variable.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.