Hello Guest

Strange Texture Bug When Drawing Opaque Images

  • 3 Replies
  • 3849 Views
Strange Texture Bug When Drawing Opaque Images
« on: December 10, 2018, 22:06:33 »
Hello everyone, recently Ive been having an issue that youll see below. Yes I have GL_BLEND enabled, GL_ALPHA_TEST enabled, GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA),          GL11.glAlphaFunc(GL11.GL_GREATER, 0),    GL11.glEnable(GL11.GL_DEPTH_TEST);



As you can see the white appears where opaque pixels should be. Thanks in advanced for your help with this



*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: Strange Texture Bug When Drawing Opaque Images
« Reply #1 on: December 10, 2018, 23:00:50 »
Premultiplied alpha. "Use it, love it, pass it on."

Re: Strange Texture Bug When Drawing Opaque Images
« Reply #2 on: December 11, 2018, 00:01:51 »
Premultiplied alpha. "Use it, love it, pass it on."

But how would this be implemented in OpenGL?

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: Strange Texture Bug When Drawing Opaque Images
« Reply #3 on: December 11, 2018, 11:25:19 »
You multiply the RGB channels of all your RGBA textures by the ALPHA channel, then use:

glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA);

instead of

glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);