hello,
this is not a jogl problem, but rather related to the opengl generally and maybe java’s ImageIO.
i am using a lot of texture’s that contain transparent parts, so i save them as pngs. then i use this code to load the png:
TextureIO.newTexture(new TextureData(0, 0, true, ImageIO.read(new File(“pngfile.png”))));
now my blendfunc is this:
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
but the result is a darkening of the image, where the alpha decreases.
here is a screenshot:
http://www.embege.com/misc/dark-blending.jpg
now you can see a dark edge along the border of one texture, which i want to get rid of. if i am not mistaken, then this shouldn’t be there, so i was suspecting that the ImageIO functions create a buffered image with a standard-black-background.
if i change the blendfunc to:
gl.glBlendFunc(GL.GL_DST_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
then the blending is correct for this specific case. however when i want to fade in objects by setting the alpha using glColor then the blended result looks weird, cause the colors seem to be added somehow.
this is what i am expecting:
http://www.embege.com/misc/good-blending.jpg
could the problem be the ImageIO reading? or something else? thanks!