0

Using OpenGLES 1.1 (don't have a choice at this time). Target OS is Android.

I'm having some inconsistency when rendering to the main framebuffer, and when rendering to a texture.

When I render to the normal screen, everything is fine. When I render to a texture, I get a dark rim around my graphics wherever alpha is translucent.

Here's my helper functions:

void RenderNormal()
{
    if (!gIsRenderToTexture)
    {
        glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
        glBlendEquationOES(GL_FUNC_ADD_OES);
    }
    else
    {
        glBlendFuncSeparateOES(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
        glBlendEquationSeparateOES(GL_FUNC_ADD_OES,GL_FUNC_ADD_OES);
    }
}

void RenderAdditive()
{
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}

void RenderMultiply()
{
    glBlendFunc(GL_ZERO, GL_SRC_COLOR);
}

So, some data:

  • On newer systems, this works just fine (also on iOS, OSX, and Linux)
  • On Kindle Fire, I still get the dark rims.
  • On an older Android device running KitKat, my additive/multiply functions don't turn off (I assume because of juggling between glBlendFunc and glBlendFuncSeparate... I'm not turning something off, but whatever I try to do to fix it makes it worse)

I'm looking for a way to square these three functions so that they can operate both with render to texture, and with rendering to the normal ol' screen. Can you assist?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Raptisoft
  • 203
  • 1
  • 10
  • Yep... the issue appears to be with drawing on zero alpha (as opposed to 1 alpha of the normal framebuffer). I am using render targets as "layers" in the game I'm working on. Also, note that on newer devices, it works... so I suspect there is some housekeeping that is not needed on newer devices that needs doing on older ones. – Raptisoft Jul 12 '17 at 19:16
  • Why not just clear to a 1.0 alpha? – solidpixel Jul 13 '17 at 14:27
  • Because I'm using it as a transparent layer... wherever I don't draw, I want transparent. – Raptisoft Jul 13 '17 at 15:32

1 Answers1

0

Okay, a day of working and research and I finally figure out that on the target device, the OES are not supported. So that said, anyone having this problem... the Kindle Fire and a lot of older tablets just outright don't support glBlendFuncSeparateOES or glBlendEquationOES and they will fail SILENTLY.

Raptisoft
  • 203
  • 1
  • 10