PDA

View Full Version : can GL_COMBINE implement a expression with if else



shelton
04-25-2011, 01:05 AM
hi, everyone!

i try to implement a algorithm about overlay (like photoshop feature.)
and the expression is {v2 < 128 ? (2 * v1 * v2 / 255) : (255 - 2 * (255-v1) * (255-v2) / 255)}.
and i failed to merge the two expressions.
btw. I can't implement it with shader because i''m using opengles 1.1.

thx for any reply

yoyonel
04-25-2011, 02:33 PM
Hi !

You can try this:
float f_test = v2 < 128;
float f_result = f_test * (2 * v1 * v2 / 255) + (1-f_test) * (255 - 2 * (255-v1) * (255-v2) / 255);

Good Luck !

YoYOOOoOO

shelton
04-25-2011, 11:27 PM
thx for your reply, but i don't think GL_COMBINE can implement the complicated expression.