OpenGLES + Framebuffer artifacts

139 Views Asked by At

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?

1

There are 1 best solutions below

0
Raptisoft On

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.