I’ve created a 2d interactive particle system on android with Opengl ES 2.0. Only one thing left to do but I don’t know how to do it, so I’d like to get some help. I would like to create some transparency to see thing under the smoke “layer” .
So I create the smoke particles render them to a texture, apply some blur on it and then I’d like to put it over other things
GLES20.glClearColor(0.0f,0.0f, 0.0f, 0.0f); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // GLES20.glDisable(GLES20.GL_DEPTH_TEST); GLES20.glEnable(GLES20.GL_BLEND); GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA); ... GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA , texW, texH, 0, GLES20.GL_RGBA , GLES20.GL_UNSIGNED_BYTE , null); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGB, texW, texH, 0, GLES20.GL_RGB, GLES20.GL_UNSIGNED_SHORT_5_6_5 , null);
If I render it to GL_RGB with GL_UNSIGNED_SHORT_5_6_5 it looks like how I want it to look like but can’t see anything under it:
If I render it to GL_RGBA with GL_UNSIGNED_BYTE it looks like… well not so pretty. It seems that this version turns everything completly transparent if the gl_FragColor.a is not 1.0.:
My question is what is the best way to achive quality like the first pics but still able to see things under it. I tried with other RGBA formats and data types but it only resulted black screen.