Author Topic: EGL_BAD_ALLOC error  (Read 11703 times)

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
EGL_BAD_ALLOC error
« on: January 21, 2015, 05:38:51 pm »
Hello everyone,

I hope I can get some help with an odd error.
I am getting this error a lot lately in the Google Developers Console:
Code: [Select]
java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1077)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1035)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1333)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

I got three reports of this error.
I found it odd that all three reports came from Android 2.2 devices.
Devices:
Galaxy Mini (GT-S5570)
IDEOS S7 Slim (qsd8k_slim)
Galaxy Precedent (SCH-M828C)

I hope that I can get some help with this error! :)

Cheers,
Abiram

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: EGL_BAD_ALLOC error
« Reply #1 on: January 21, 2015, 06:19:35 pm »

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: EGL_BAD_ALLOC error
« Reply #2 on: January 21, 2015, 11:17:30 pm »
I mainly found that adding (instance GLSurfaceView).onPause() and (instance GLSurfaceView).onResume() should work in the Overridden methods of Activity. However, I already have those...

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: EGL_BAD_ALLOC error
« Reply #3 on: January 22, 2015, 07:48:45 am »
Update.

New error:
Code: [Select]
java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1229)
at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1187)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1514)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1267)
But this time it is not on Android 2.2, but Android 4.0.3 - 4.0.4.
Device: nuclear-XIONhh901

I couldn't find anything about this device.
However, the Android 2.2 devices all had an Andreno 200 GPU (if that matters)...
« Last Edit: January 22, 2015, 07:51:57 am by AeroShark333 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: EGL_BAD_ALLOC error
« Reply #4 on: January 22, 2015, 08:05:18 am »
Does this happen at startup or randomly at runtime...or when? It's clearly something on your side, because jPCT-AE just renders into a gl context. It doesn't care about any buffer swapping and such and it doesn't trigger anything in that regard.

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: EGL_BAD_ALLOC error
« Reply #5 on: January 22, 2015, 11:53:07 am »
I really do noy have a clue...
The Play Store doesn't give more information tham that.
Any other suggestions?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: EGL_BAD_ALLOC error
« Reply #6 on: January 22, 2015, 12:38:23 pm »
Not really. If that's all you get as debug information, it's hard to make something out of it. Maybe it's related to memory? It might be worth a  try to add "android:largeHeap" to your manifest (in case you haven't already) and see if that helps, but other than that, it's hard to fix this (if it's even possible) without an actual device that allows you to reproduce this error.

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: EGL_BAD_ALLOC error
« Reply #7 on: January 22, 2015, 02:53:31 pm »
Hmm, I can add android:largeHeap="true"
However, I do not think that would fix the error on Android 2.2 devices.
Why? Because the largeHeap feature is added in API Level 11.
Android 2.2 (API Level 8 ) would ignore that line, since it's function is known.
« Last Edit: January 22, 2015, 03:05:36 pm by AeroShark333 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: EGL_BAD_ALLOC error
« Reply #8 on: January 22, 2015, 04:54:22 pm »
I wasn't sure when it was added...it won't help then.

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: EGL_BAD_ALLOC error
« Reply #9 on: February 07, 2015, 09:34:34 pm »
java.lang.NullPointerException
at com.threed.jpct.GLRenderer.setTextures(GLRenderer.java:2441)
at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2297)
at com.threed.jpct.World.draw(World.java:1417)
at com.threed.jpct.World.draw(World.java:1100)
at com.aeroshark333.skinviewer.SkinActivity$ViewerRenderer.onDrawFrame(SkinActivity.java:1048)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1146)

How does this happen?

line 1048: [mainWorld.draw(frameBuffer);]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: EGL_BAD_ALLOC error
« Reply #10 on: February 07, 2015, 10:12:31 pm »
Most likely because you are fiddling around with something jPCT related in some other than the rendering thread, like changing textures in an async way or in an event listener.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: EGL_BAD_ALLOC error
« Reply #12 on: February 08, 2015, 12:55:57 am »
So passing "Runnable"s to the GLSurfaceView thread should solve my problem, right?

Edit: Using GLSurfaceView.queueEvent(Runnable r);
« Last Edit: February 08, 2015, 01:41:12 am by AeroShark333 »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: EGL_BAD_ALLOC error
« Reply #13 on: February 08, 2015, 09:13:27 am »
That's one solution...at least if something like this really causes your problem.

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: EGL_BAD_ALLOC error
« Reply #14 on: February 14, 2015, 12:29:35 pm »
A bit offtopic but is it possible to bend an Object3D.
For instance, let's say I have an cube object (uv mapped). Is it possible to curve/bend it so there probably will be more vertices, but it still has the appropriate texture on each cube face. Bend/curve = making a cube a bit 'U' shaped for example.

Sorry for this question, I am very noob at OpenGL related stuff :/