ios - OpenGL Blending with Transparent Background? -
i building ios app open gl es 2.0. simple drawing application.
if draw on top of clear framebuffer opacity value less one, blending with?
some setup:
if have framebuffer cleared absolute clear color...
glclearcolor(0.0, 0.0, 0.0, 0.0); glclear(gl_color_buffer_bit) with blending set such:
glenable(gl_blend); glblendfunc(gl_one, gl_one_minus_src_alpha); [self render] gldisable(gl_blend); and draw simple quad on 50% opacity. say...
gl_fragcolor = vec4(1.0, 0.0, 0.0, 0.5); what color expect out?
the real application of question draw things translucent view. say, want gl code to blend view underneath view in ios. if has more specific advice on that, i'd love hear it, too!
the resulting color 1 drew with—red, 50% opacity. if gl view sitting on top of view (and isn’t opaque), result identical you’d other red-with-50%-opacity content on top of other view. glblendfunc , affect gl drawing in view; don’t affect how gets composited other views.
Comments
Post a Comment