I have recently started adding animated meshes to a level of my games.
Unfortunately this is causing OpenGL out of memory errors.
I have tried downsizing all textures to 128 x 128 to save as much memory as possible. This has not helped.
My meshes are as low poly as I can realistically make them.
Do I have any other courses of action here other than to remove the animated meshes? Is there some sort of “low quality” setting for animation? Will using fewer frames for animations help?
I have multiple animated meshes, however these errors can still occur with only one animated mesh in the scene.
I should have also mentioned that debugging the app shows 40% of memory free immediately before crashing - but I am assuming this is system memory and the issue is with video memory.
The crashes can occur almost immediately - or not until a few minutes have passed.
E/com.jme3.app.AndroidHarness( 6072): SEVERE Exception thrown in Thread[GLThread 9788,5,main]
E/com.jme3.app.AndroidHarness( 6072): com.jme3.renderer.RendererException: An OpenGL error has occurred: out of memory
E/com.jme3.app.AndroidHarness( 6072): at com.jme3.renderer.android.RendererUtil.checkGLError(RendererUtil.java:125)
E/com.jme3.app.AndroidHarness( 6072): at com.jme3.renderer.android.OGLESShaderRenderer.clearBuffers(OGLESShaderRenderer.java:401)
E/com.jme3.app.AndroidHarness( 6072): at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:967)
E/com.jme3.app.AndroidHarness( 6072): at com.jme3.renderer.RenderManager.render(RenderManager.java:1029)
E/com.jme3.app.AndroidHarness( 6072): at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
E/com.jme3.app.AndroidHarness( 6072): at com.jme3.app.AndroidHarness.update(AndroidHarness.java:467)
E/com.jme3.app.AndroidHarness( 6072): at com.jme3.system.android.OGLESContext.onDrawFrame(OGLESContext.java:349)
E/com.jme3.app.AndroidHarness( 6072): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
E/com.jme3.app.AndroidHarness( 6072): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
E/com.jme3.app.AndroidHarness( 6072):
Yes there are a few thousand vertexes per mesh.
Your suggestion seems to have fixed the out of memory errors - however now the animations are somewhat deformed,
here is the relevant code:
[java]final AnimControl ac = findAnimControl(spatial);
try {
// add a skeleton debugger to make bones visible
final Skeleton skel = ac.getSkeleton();
SkeletonControl skeletonControl = new SkeletonControl(skel);
spatial.addControl(skeletonControl);
skeletonControl.setHardwareSkinningPreferred(true);
// create a channel and start the wobble animation
channel = ac.createChannel();
channel.setAnim("walk");
} catch (final Exception e) {
e.printStackTrace();
}[/java]
The meshes are .j3o files, but the skeletons are xml files, as clicking “convert to j3o binary” in the left panel does not seem to convert these files.
The meshes are .j3o files, but the skeletons are xml files, as clicking “convert to j3o binary” in the left panel does not seem to convert these files.
…? The skeleton is saved in the j3o as well… You don’t need to load it separately.
Hm, is the model textures? does it help to remove the textures? Maybee the android app is only a few kb before crashing already? and the buffers for animation are the last bit necessary to explode?