opengl - GLSL component-wise equal comparison -


i'm trying check if given pixel in texture white, black, or neither. i've decided use equal function described in opengl 4 reference pages. believe i'm having issue getting syntax correct.

i using opengl version 4.0.0 , opengl shading language version 4.00.

here relevant part of fragment shader code:

   //texture 1    vec4 texturecolor1 = texture(texunit1, texturecoord);    //texture 2    vec4 texturecolor2 = texture(texunit2, texturecoord);    //texture 3 (only contains black , white pixels)    vec4 texturecolor3 = texture(texunit3, texturecoord);     vec4 finaltexturecolor;     vec4 whitecolor = vec4(1.0, 1.0, 1.0, 0.0); //define white    vec4 blackcolor = vec4(0.0, 0.0, 0.0, 0.0); //define black     if (bvec equal(texturecolor3, whitecolor)){ //if texture 3 pixel white         finaltexturecolor = texturecolor1;    } else if (bvec equal(texturecolor3, blackcolor)){  //if texture 3 pixel black         finaltexturecolor = texturecolor2;    } else { //not black or white         finaltexturecolor = mix(texturecolor1, texturecolor2, 0.5);    }     color = finaltexturecolor; 

here errors getting:

error: 0:101: 'bvec' : undeclared identifier error: 0:101: 'equal' : syntax error syntax error 

i know texture data getting correctly passed fragment shader because can color = texturecolor1 or color = texturecolor2 or color = texturecolor3, of display appropriate texture on 3d object.

thank help!

bvec return type of equal function. vector of booleans tell components equal. if want compare entire color, use equality operator ==.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -