Hello. This problem is not really related to JME but I’m trying to add dynamic transparency to an object with these open gl es functions:
gl.glTexCoordPointer (2, GL10.GL_FIXED, 0, node.uv);
gl.glColor4f(1.0f,1.0f,1.0f,alpha);
gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE);
gl.glDrawArrays (GL10.GL_TRIANGLE_STRIP, 0, 4);
This way I can use vertex color (only one for the whole mesh here) to make the transparency varying. The result is that for not transparent texture the transparency is ok (alpha) , for ones with a part fully transparent it works okay too by adding (alpha) transparency to opaque pixels, but I’m having problems with partly transparent textures, pixels appears greys or black. I suppose it’s an overflow in alpha but I’m not really sure.
Thank for your help !
Have you enabled blending?
(C code glEnable(GL_BLEND); )
Yeah, I guess overflow. If you set the alpha byte to >255 it will pop back to zero and vice versa.
This is my code to enable alpha:
// GL11.glEnable(GL11.GL_BLEND);
// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);