Android RendererException

Hi everyone!

I’m new to java, android and game development and i’m trying to made a simple 3d game to run on android.
All goes well until the app shoot this intermittent exception (various android versions):

com.jme3renderer.RendererException: an opengl error has occurred: out of memory at
com.jme3.renderer.android.RenderUtil.checkGLError(RenderUtil.java:125) at
com.jme3.renderer.android.OGLESShaderRenderer.setClipRect(OGLESShaderRenderer.java:579) at
com.jme3.renderer.RenderManager.setViewPort(RenderManager.java:827) at
com.jme3.renderer.RenderManager.setCamera(RenderManager.java:881) at
com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:962) at
com.jme3.renderer.RenderManager.render(RenderManager.java:1029) at
com.jme3.app.SimpleApplication.update(SimpleApplication.java:252) at
com.jme3.app.AndroidHarness.update(AndroidHarness.java:467) at
com.jme3.system.android.OGLESContext.onDrawFrame(.java:349) at
android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1529) at
android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1246)

All my pictures are 64x64 and my font too…
I think that Nifty may be triggering the error, someone no idea what can be? I’ve tried various solutions, even System.gc () and resetGLObjects () (which correct place to implement these codes?) And so far nothing! The output of the exception can not trace the reason for the problem …

Thanks if anyone can help

ps.: no problem on desktop, just android

I’ve been analyzing the output of the exception… i think the mobile memory is going to the air after running the following command (in the 3.0 source), and the exception is thrown after:

GLES20.glEnable (GLES20.GL_SCISSOR_TEST);

I’ve read somewhere here in the forum that this SCISSOR_TEST allocates an object (ScissorRectangle) for every object and every frame! And that is bad for small memory of the mobile.

I will comment the line that calls the test at source, recompile and test. And then I bring the news …

If there’s any allocation, its not by jME3. It just gets translated into OpenGL ES calls:

Complex nifty UIs might be using the clipping feature a lot, which I guess might be difficult for some OpenGL drivers to handle?

I took the line of the scissor_test, but the exception continues. I tried to comment out the line of the class that calls the user function setcliprect (the setCamera function of RendererManager.java:827) but the exception is thrown elsewhere, does not solve the problem that apparently does not come from jme3 code.

Monitoring memory usage via the controls:

Runtime.getRuntime().freeMemory();
Runtime.getRuntime().totalMemory();

… Memory usage is gradually rising up the locking and quick, about 3 to 4 mb per second. In logcat, something seems to be trying to read 1152 bytes which is available 704 bytes and is forcing a crash. Throughout the run logcat repeats these two lines to reach the exception:

I/MaliBase(26028): WARNING: Reading 1152 bytes at offset 0 from GL stream 2 (HW stream 2) bound to VBO 43. But only 704 bytes available in VBO.
I/MaliBase(26028): This is an application error that may cause a pagefault in hardware. 

I’m using the simplest possible models, about 30 objects moving vehicles with very little vertices (700vert 400trian) to keep the scene below 15,000 vertices and 100 objects. If I put 2 or 3 cars, the used memory is parked in a few mb, but if I put more objects of the cars, the memory used starts to up quickly. On the desktop the System.gc () frees the memory with a small role (if FreeMem <100mb) but in android does not work. I’ll keep trying to find, perhaps checking collisions. Maybe is not nifty…

UPDATED:
even looking many objects to the scene, the game runs well at a good rate fps on the noname android 2.3 single core device with 256mb of ram … until the memory burst, which does not always happen. I’m searching for the vertexbuffer object, maybe increasing (or decreasing) the buffer size (34,66kb set on the GLES20.java)

I removed all the lights and left only a directional light on the scene and the error out of memory has not returned to appear. But it is still occurring the application error on the console on a tablet android 4.4. No idea what that is, but it seems that a buffer exceeds the size allowed by the system (But apparently not affecting the operation of the game.)

The problem came back again! And I discovered that @Momoko_Fan was completely right! Thanks!

Nifty gui seems to be very heavy for android with complex UI. I’ll try something simpler!

Actually the message clearly says application error, which in this case means engine error. I am guessing the unified renderer in jME 3.1 probably fixed the issue.

I’ll try, thanks!