Quantcast
Channel: Android OpenGL ES 2 - Blending seems to always be additive - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Android OpenGL ES 2 - Blending seems to always be additive

$
0
0

I can't seem to get my blending properly working in OpenGL ES 2 on Android. What I have are textures with alpha channels that I want to appear with the corresponding alpha. The blending appears as additive even when the top drawn object has alpha of 1.0. In my fragment shader I hard-coded a value of 1.0 for the alpha, and realized it seems to be using color, not alpha values.

For example, it looks like this : enter image description here

Instead of this : enter image description here

I am drawing in the correct order, in this example the blue should be fully opaque over top of the gray square. I have tried multiple blending modes (one,one), (alpha,alpha), etc., multiple draw orders, and using and not using depth test. I have tried random blend modes that yield incorrect results, so the blending is changing when I set it.

I believe the problem is that opengl is blending additive color. (Alpha, Alpha) makes sense to me, and when I explicitly set alpha to 1.0 in the shader, I would think I would get a square (the actual shape the texture is projected on) that has a blue circle on it. This not happening puzzles me, I guess I don't understand the sfactor and dfactor blending function enough.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images