Constructing FrameBuffer crashing some devices? (Android) (OpenGL ES)

Hey guys, could really use some advice with this. First off, I’m using LibGDX and as a result all devices must be running OpenGL ES 2.0 or higher.

I’m creating a FrameBuffer like this:

_frameBuffer= new FrameBuffer(Format.RGBA8888, (int)getWidth(), (int)getHeight(), false);

This works fine for almost all devices, but I receive 4-6 crash reports from Google Analytics every day where this code apparently goes wrong:

Thread: GLThread 17, Exception: java.lang.IllegalStateException: frame buffer couldn't be constructed: unknown error 0 at
com.badlogic.gdx.graphics.glutils.FrameBuffer.build(FrameBuffer.java:178) at
com.badlogic.gdx.graphics.glutils.FrameBuffer.<init>(FrameBuffer.java:97) at

Note the error, “unknown error 0” - meaning I’m getting the last error in this list (from FrameBuffer.java):

if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)
    throw new IllegalStateException("frame buffer couldn't be constructed: incomplete attachment");
if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS)
    throw new IllegalStateException("frame buffer couldn't be constructed: incomplete dimensions");
if (result == GL20.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT)
    throw new IllegalStateException("frame buffer couldn't be constructed: missing attachment");
if (result == GL20.GL_FRAMEBUFFER_UNSUPPORTED)
    throw new IllegalStateException("frame buffer couldn't be constructed: unsupported combination of formats");
throw new IllegalStateException("frame buffer couldn't be constructed: unknown error " + result);

It’s always from the same device models too, here’s three of them for example (I’d post links but the forum won’t allow it, sorry):

[ul]
[li]Galaxy Tab 10.1 (Germany version?)
[/li][li]G-Slate
[/li][li]Iconia Tab A500
[/li][/ul]

So far I haven’t figured a way to fix this. Any advice is really appreciated!

Edit: Could it have anything to do with the following URL, or is this not related to Android / OpenGL ES? Even if it was relevant, I’m not receiving the errors “Unsupported” or “Incomplete Attachment” - I’m getting that “unknown error” nonsense: Common Mistakes - OpenGL Wiki

Alright, so I just pushed out a new update with this horrible code:

try
{
   _frameBuffer = new FrameBuffer(Format.RGB565, exportWidth, exportHeight, false);
}
catch (IllegalStateException e)
{
   try
   {
      _frameBuffer = new FrameBufferNvidia(Format.RGB565, exportWidth, exportHeight, false);
   }
   catch (IllegalStateException e2)
   {
      try
      {
         _frameBuffer = new FrameBuffer(Format.RGBA8888, exportWidth, exportHeight, false);
      }
      catch (IllegalStateException e3)
      {
         try
         {
            _frameBuffer = new FrameBufferNvidia(Format.RGBA8888, exportWidth, exportHeight, false);
         }
         catch (IllegalStateException e4)
         {
            try
            {
               _frameBuffer = new FrameBuffer(Format.RGBA4444, exportWidth, exportHeight, false);
            }
            catch (IllegalStateException e5)
            {
               try
               {
                  _frameBuffer = new FrameBufferNvidia(Format.RGBA4444, exportWidth, exportHeight, false);
               }
               catch (IllegalStateException e6)
               {
                  try
                  {
                     _frameBuffer = new FrameBuffer(Format.RGB565, exportWidth, exportHeight, true);
                  }
                  catch (IllegalStateException e7)
                  {
                     _frameBuffer = new FrameBufferNvidia(Format.RGB565, exportWidth, exportHeight, true);
                  }
               }
            }
         }
      }
   }

What I’m trying to do is determine if anything helps. Guess what? I’m still getting some random crash reports meaning that certain devices are crashing after the last try/catch attempt.

For reference, “FrameBuffer.java” is the LibGDX class, “FrameBufferNvidia.java” is my custom class that extends FrameBuffer but adds in potential “fixes” for this nvidia bug, in case this was the problem: opengl.org/wiki/Common_Mistakes#Render_To_Texture

Would really appreciate any advice!

Alright, what I did was halve the size of the FBO when creating it, and that seems to have kinda done the trick. The FBO was originally either 960x540 or 1920x1080 depending on the device, this was apparently too big for some devices so now the FBOs are either 480x270 or 960x540.

Now, the thing is, I’m still getting the error every day. Definitely a lot less than before, but all errors have come from this Nexus 7 model: http://www.gsmarena.com/asus_google_nexus_7_cellular-5091.php (another Tegra/nvidia device, coincidence?).

Would really like to 100% fix this issue, any advice appreciated!