0

I'm trying to figure out how to remove all green pixels of a picture i am rendering. I've already searched the web, but found nothing I can use.

I know I probably have to use this function:

        gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

If I'm right, how do I change the color to green?

Thanks for your help.

1 Answers1

0

Do you mean that you have a texture, which has green pixels, which should be transparent? (A search term for this might be 'chroma key')

If so, there's not a trivial way to enable this in OpenGL. You've got two options though:

  • Preprocess the image to convert all green pixels to ALPHA=0 pixels, and then enable alpha testing.
  • Write a custom fragment shader that rejects fragments of a certain color.
Tim
  • 35,413
  • 11
  • 95
  • 121