I’ve been looking at converting my app from Graphics2D to LWJGL, learning OpenGL as I go. I’ve run into a problem that I was hoping there might be a quick and dirty solution to.
I’ve been using PNG files for my sprites, using the alpha channel for simple bit-mask transparency (a bit of overkill, I know). So I’ve only used alpha values of 0 and 255.
Now, when I try and use these same graphics as textures, I get a sort of weird transparency when two images overlap, rather than the clean bit-masking I’m used to. I’ve looked through NeHe’s tutorials, and his solution is to use separate 2-bit mask files. I’d really hate to have to create 2-bit masks for all my graphics, especially when they have perfectly good alpha channels.
Is there a quick fix for this? Some combination of arguments passed to gl.blendFunc() that I haven’t tried yet? I’ve been attempting gl.blendFunc(GL.SRC_ALPHA, GL.ONE) and gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA). The former gives me the odd transparency I’ve mentioned, the latter no transparency whatsoever.
I hope to go grab myself a copy of the red book this weekend, as NeHe’s tutorials, while good, are just not enough. Perhaps someone has some insights to save me a bit of time though?
