iphone - Alpha blending with OpenGL ES 2.0? -


What's the best way?

I tried to make this naïve with a piece that looks like this:

Less Wax 4 colors; Zero main () {low curve 4 alpha = color Constellation VC4A = VC4 (1.0, 1.0, 1.0, 1.0); Weak VC4 Aquinas Elpha = One-alpha; Gl_FragColor = gl_FragColor * oneMinusAlpha + Color enhancement * alpha; Gl_FragColor.w = 1.0; }

But that does not work, because it seems that nothing is meaningful before the shader runs in gl_FragColor.

What is the correct approach?

Alpha blending is done for you, on exit from the shader, gl_FragColor Should have alpha values ​​in the w component and you have to set the blending mode with the normal API as if it is not at all. For example gl_FragColor = vec4 (0,1,0,0,5) will become a green, 50% transparent piece.


Comments