Search code examples
javaopenglgraphics2dcolor-key

Java 2d Library - Sprite Color Key Support


I'm building a 2d game with box2d and opengl.

Turns out, opengl does not support color keying (removing the background color of a sprite). This is obviously ridiculous and any half-decent, 2d library should support this.

I'm willing to scrap opengl, but I can't find another graphics library as of yet. Something with the functionality of pygame would be more than sufficient.

Any suggestions?


Solution

  • If you use shaders it is supereasy. If not I guess you have to find another library.

    I do recommend you to use shaders and a way of removing the background is to discard the fragment if the fragment's color is the backgroundcolor (this is in the fragmentshader). There are a lot of tutorials on shaders on the internet and it is the way to go nowadays.