Weird display on screen borders

Hey,



I’m proceeding to some tests of my game models on several Android devices and on all of them I have a strange display behavior on the screen borders. The best is still a picture to show you :



http://img13.imageshack.us/img13/1315/img20110616181745.jpg



You can see on it that my “ground” models (which are basically square meshes with a texture) fail displaying on borders. It appears that from the point their center is not in the cam range, the meshes are not displayed at all.



Is there a solution to this ? Does it come from the models, the engine, the phones ? I’d really appreciate a hand on this. Thx.

I have had the same problem, when a model moved its center outside it disapeared immediatly. It has something to do with the bounding box.

I cant remember exactly. If a updateModelBound() does not help we need debugging into the core :slight_smile:

If updateModelBound() is needed then we need to do that too :stuck_out_tongue:

But why it happens on Android while the desktop tests I have done worked perfectly ?

s4milli4 said:
But why it happens on Android while the desktop tests I have done worked perfectly ?

Because as you've been told multiple times this is a very early stage implementation you work with.

Could you post a test for this issue ? So i can debug it.

Sure… use this test via AndroidHarness :

[java]public class Test1 extends SimpleApplication {

private Spatial ground;

private Node groundNode;

public void simpleInitApp() {

AmbientLight light = new AmbientLight();

light.setColor(ColorRGBA.White.mult(5f));

rootNode.addLight(light);

int length = 20;

int width = 20;

createFloor(length, width);

}

public void simpleUpdate(float tpf) {

}

public void createFloor(int length, int width){

groundNode = new Node(“groundNode”);

ground = assetManager.loadModel(“Models/Ground_A.mesh.xml”);

groundNode.attachChild(ground);

for (int j = 0; j < width; j++) {

for (int i = 0; i < length; i++) {

if(i == 0 && j == 0){

continue;

}

Spatial ground1 = assetManager.loadModel(“Models/Ground_A.mesh.xml”);

ground1.setLocalTranslation(new Vector3f(i, 0f, j));

groundNode.attachChild(ground1);

}

}

rootNode.attachChild(groundNode);

groundNode.setLocalTranslation(new Vector3f(-10, 5, -10));

groundNode.rotate(FastMath.PI/4, 0, 0);

}

}[/java]

I send you the model via pm (cause it’s kind of a commercial project actually… and I’m not sure I can share these models).

You could also try to apply this patch to your jme3 copy:

Its the only diff i have in my local copy. Didnt commit it because i dont know

what side effects it has for other people, but i works for me on android.



[patch]Index: src/core/com/jme3/scene/Mesh.java

===================================================================

— src/core/com/jme3/scene/Mesh.java (revision 7646)

+++ src/core/com/jme3/scene/Mesh.java (working copy)

@@ -487,17 +487,12 @@

}



public void getTriangle(int index, int[] indices){

  •    VertexBuffer ib = getBuffer(Type.Index);<br />
    
  •    if (ib.getFormat() == Format.UnsignedShort){<br />
    
  •        // accepted format for buffers<br />
    
  •        ShortBuffer sib = (ShortBuffer) ib.getData();<br />
    

-

  •        // acquire triangle's vertex indices<br />
    
  •        int vertIndex = index * 3;<br />
    
  •        indices[0] = sib.get(vertIndex);<br />
    
  •        indices[1] = sib.get(vertIndex+1);<br />
    
  •        indices[2] = sib.get(vertIndex+2);<br />
    
  •    }<br />
    
  •    IndexBuffer ib = getIndexBuffer();<br />
    
  •    // acquire triangle's vertex indices<br />
    
  •    int vertIndex = index * 3;<br />
    
  •    indices[0] = ib.get(vertIndex);<br />
    
  •    indices[1] = ib.get(vertIndex+1);<br />
    
  •    indices[2] = ib.get(vertIndex+2);<br />
    

}



public int getId(){[/patch]

I updated the svn, applied the patch, rebuilt, changed my jme jar and tried again but it seems that some changes in the svn makes me have this error:


06-17 10:55:50.692: INFO/dalvikvm(14066): Could not find method java.util.Arrays.copyOf, referenced from method com.jme3.font.BitmapFont.merge
06-17 10:55:50.692: WARN/dalvikvm(14066): VFY: unable to resolve static method 18856: Ljava/util/Arrays;.copyOf ([Ljava/lang/Object;I)[Ljava/lang/Object;
06-17 10:55:50.692: INFO/global(14066): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
06-17 10:55:50.832: INFO/dalvikvm(14066): Could not find method com.jme3.material.Material.getTextureParam, referenced from method com.jme3.font.BitmapTextPage.
06-17 10:55:50.832: WARN/dalvikvm(14066): VFY: unable to resolve virtual method 6986: Lcom/jme3/material/Material;.getTextureParam (Ljava/lang/String;)Lcom/jme3/material/Material$MatParamTexture;
06-17 10:55:50.832: WARN/dalvikvm(14066): threadid=8: thread exiting with uncaught exception (group=0x40020ce0)
06-17 10:55:50.862: ERROR/Application(14066): Exception thrown in Thread[GLThread 9,5,main]
06-17 10:55:50.862: ERROR/Application(14066): java.lang.NoSuchMethodError: com.jme3.material.Material.getTextureParam
06-17 10:55:50.862: ERROR/Application(14066): at com.jme3.font.BitmapTextPage.(BitmapTextPage.java:76)
06-17 10:55:50.862: ERROR/Application(14066): at com.jme3.font.BitmapText.(BitmapText.java:66)
06-17 10:55:50.862: ERROR/Application(14066): at com.jme3.font.BitmapText.(BitmapText.java:60)
06-17 10:55:50.862: ERROR/Application(14066): at com.jme3.app.SimpleApplication.loadFPSText(SimpleApplication.java:178)
06-17 10:55:50.862: ERROR/Application(14066): at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:202)
06-17 10:55:50.862: ERROR/Application(14066): at com.jme3.system.android.OGLESContext.initInThread(OGLESContext.java:355)
06-17 10:55:50.862: ERROR/Application(14066): at com.jme3.system.android.OGLESContext.onSurfaceCreated(OGLESContext.java:468)
06-17 10:55:50.862: ERROR/Application(14066): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1317)
06-17 10:55:50.862: ERROR/Application(14066): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

mhh not good copyOf is java 6 specific, we need to change that.

1 Like

I can reproduce and confirm your clipping errors. The quads disappear when their center moves outside of the screen.



I did not have yet time to debug it. Hopefully in the next days.

Okay the issue with copyOf() has been fixed in SVN

2 Likes

What about the other error ? Do you know where it comes from ? So far I still havn’t found it out…

Sorry for my late answer.



Its an updateModelBound issue. For some reason the worldBound field is null after the model load.



if you add an updateModelBound call all works correct:

[java] Spatial ground1 = assetManager.loadModel("Models/Ground_A.mesh.xml");

ground1.updateModelBound();[/java]



Its not a problem in the android code but on the android platform, in this case the error location

would be in the ogre loader i expect.



As a workaround please update your model bound manually until this gets fixed. I dont know

yet what exactly is the problem.

I tried to add the updateModelBound() but something weird happened:


06-24 10:29:31.155: INFO/AndroidConfigChooser(8336): ### JME3 ### using fastest EGL configuration available here:
06-24 10:29:31.155: ERROR/AndroidConfigChooser(8336): Unable to get a valid OpenGL ES 2.0 config
06-24 10:29:31.155: ERROR/OGLESContext(8336): Unable to find suitable EGL config
06-24 10:29:31.155: ERROR/OGLESContext(8336): OpenGL ES 2.0 is not supported on this device
06-24 10:29:31.155: INFO/GLThread(8336): starting tid=10
06-24 10:29:31.175: INFO/AndroidHarness(8336): onStart
06-24 10:29:31.180: INFO/AndroidHarness(8336): onResume
06-24 10:29:31.200: INFO/ActivityManager(2690): Displayed com.lesmobilizers.helloandroidharness/.MainActivity: +226ms
06-24 10:29:31.205: WARN/WindowManager(2690): Layout repeat skipped after too many iterations
06-24 10:29:31.205: WARN/WindowManager(2690): Layout repeat skipped after too many iterations
06-24 10:29:31.205: WARN/WindowManager(2690): Layout repeat skipped after too many iterations
06-24 10:29:31.205: WARN/WindowManager(2690): Animation repeat aborted after too many iterations
06-24 10:29:31.210: ERROR/SurfaceFlinger(2690): createNormalSurfaceLocked() failed (Value too large for defined data type)
06-24 10:29:31.210: WARN/WindowManager(2690): OutOfResourcesException creating surface
06-24 10:29:31.210: INFO/WindowManager(2690): Out of memory for surface! Looking for leaks...
06-24 10:29:31.210: WARN/WindowManager(2690): No leaked surfaces; killing applicatons!
06-24 10:29:31.210: WARN/ActivityManager(2690): Killing processes Free memory at adjustment 0
06-24 10:29:31.210: WARN/ActivityManager(2690): Killing ProcessRecord{409dcfe8 8336:com.lesmobilizers.helloandroidharness/10103} (adj 0): Free memory
06-24 10:29:31.210: WARN/WindowManager(2690): Looks like we have reclaimed some memory, clearing surface for retry.
06-24 10:29:31.210: WARN/WindowManager(2690): Due to memory failure, waiting a bit for next layout
06-24 10:29:31.220: ERROR/InputDispatcher(2690): channel '40957650 com.lesmobilizers.helloandroidharness/com.lesmobilizers.helloandroidharness.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
06-24 10:29:31.220: ERROR/InputDispatcher(2690): channel '40957650 com.lesmobilizers.helloandroidharness/com.lesmobilizers.helloandroidharness.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
06-24 10:29:31.470: INFO/WindowManager(2690): WIN DEATH: Window{40957650 com.lesmobilizers.helloandroidharness/com.lesmobilizers.helloandroidharness.MainActivity paused=false}


Those 3 lines in particular:

06-24 10:29:31.155: ERROR/AndroidConfigChooser(8336): Unable to get a valid OpenGL ES 2.0 config
06-24 10:29:31.155: ERROR/OGLESContext(8336): Unable to find suitable EGL config
06-24 10:29:31.155: ERROR/OGLESContext(8336): OpenGL ES 2.0 is not supported on this device


This log comes from the brand new Samsung Galaxy S2... and before this whole topic, I managed to display some jME apps. I'm totally lost.

Please update your svn, and add this switch to your harness:



//eglConfigType = ConfigType.FASTEST; // default

eglConfigType = ConfigType.BEST;



It seems the config chooser fails to find a suitable “fastest” config, so try to go for best.



Also post more of your log, there should be a list of found configs above the block you posted.

Here is a full log:


06-24 12:17:54.520: INFO/ActivityManager(2690): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.lesmobilizers.helloandroidharness/.MainActivity } from pid 10808
06-24 12:17:54.530: ERROR/com.samsung.app(7669): [MSC]>>> WeatherWidgetProvider.java:303 [0:0] onReceive()@@@ sec.android.intent.action.HOME_PAUSE
06-24 12:17:54.530: ERROR/com.samsung.app(7669): [MSC]>>> WidgetIdManager.java:39 [0:0] AccuWeatherClockWidgetID_Length
06-24 12:17:54.530: ERROR/com.samsung.app(7669): [MSC]>>> WidgetIdManager.java:40 [0:0] getPrefIDs() : length = 1
06-24 12:17:54.530: ERROR/com.samsung.app(7669): [MSC]>>> WidgetIdManager.java:46 [0:0] getPrefIDs() : Ids1 = 2
06-24 12:17:54.530: ERROR/com.samsung.app(7669): [MSC]>>> WeatherWidgetProvider.java:1511 [0:0] disable handler
06-24 12:17:54.550: INFO/ActivityManager(2690): Start proc com.lesmobilizers.helloandroidharness for activity com.lesmobilizers.helloandroidharness/.MainActivity: pid=10815 uid=10103 gids={}
06-24 12:17:54.570: INFO/AndroidRuntime(10808): NOTE: attach of thread 'Binder Thread #1' failed
06-24 12:17:54.590: INFO/OrientationDebug(2690): [pwm] in updateOrientationListenerLp()
06-24 12:17:54.590: INFO/OrientationDebug(2690): [pwm] needSensorRunningLp(), return true #4
06-24 12:17:54.590: INFO/TvOut-Observer(2690): setTvoutOrientation rotation = 1
06-24 12:17:54.590: ERROR/TvOut-Observer(2690): TvoutSetOrientation
06-24 12:17:54.590: INFO/WindowManager(2690): Setting rotation to 1, animFlags=1
06-24 12:17:54.590: INFO/ActivityManager(2690): Config changed: { scale=1.0 imsi=0/0 loc=fr_FR touch=3 keys=1/1/2 nav=1/1 orien=2 layout=34 uiMode=17 seq=21 FlipFont=0}
06-24 12:17:54.645: ERROR/AutoRotationSettingButton(2795): fr
06-24 12:17:54.695: INFO/JmeSystem(10815): Running on jMonkey Engine 3 ALPHA 0.6 Android
06-24 12:17:54.705: INFO/(10815): !@Mali Android API Version : 7 [1308910674]
06-24 12:17:54.705: INFO/OGLESContext(10815): Display EGL Version: 1.0
06-24 12:17:54.705: INFO/AndroidConfigChooser(10815): ### JME3 ### using fastest EGL configuration available here:
06-24 12:17:54.705: ERROR/AndroidConfigChooser(10815): Unable to get a valid OpenGL ES 2.0 config
06-24 12:17:54.705: ERROR/OGLESContext(10815): Unable to find suitable EGL config
06-24 12:17:54.705: ERROR/OGLESContext(10815): OpenGL ES 2.0 is not supported on this device
06-24 12:17:54.725: INFO/GLThread(10815): starting tid=10
06-24 12:17:54.730: INFO/AndroidHarness(10815): onStart
06-24 12:17:54.730: INFO/AndroidHarness(10815): onResume
06-24 12:17:54.735: INFO/Launcher(2835): onWindowFocusChanged(false)
06-24 12:17:54.745: INFO/ActivityManager(2690): Displayed com.lesmobilizers.helloandroidharness/.MainActivity: +198ms (total +41s692ms)
06-24 12:17:54.750: WARN/WindowManager(2690): Layout repeat skipped after too many iterations
06-24 12:17:54.750: WARN/WindowManager(2690): Layout repeat skipped after too many iterations
06-24 12:17:54.750: WARN/WindowManager(2690): Layout repeat skipped after too many iterations
06-24 12:17:54.750: WARN/WindowManager(2690): Animation repeat aborted after too many iterations
06-24 12:17:54.765: ERROR/SurfaceFlinger(2690): createNormalSurfaceLocked() failed (Value too large for defined data type)
06-24 12:17:54.765: WARN/WindowManager(2690): OutOfResourcesException creating surface
06-24 12:17:54.765: INFO/WindowManager(2690): Out of memory for surface! Looking for leaks...
06-24 12:17:54.765: WARN/WindowManager(2690): No leaked surfaces; killing applicatons!
06-24 12:17:54.765: WARN/ActivityManager(2690): Killing processes Free memory at adjustment 6
06-24 12:17:54.765: WARN/ActivityManager(2690): Killing ProcessRecord{40819918 2835:com.sec.android.app.twlauncher/10012} (adj 6): Free memory
06-24 12:17:54.765: WARN/WindowManager(2690): Looks like we have reclaimed some memory, clearing surface for retry.
06-24 12:17:54.765: WARN/WindowManager(2690): Due to memory failure, waiting a bit for next layout
06-24 12:17:54.805: ERROR/InputDispatcher(2690): channel '408c7148 com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher (server)' ~ Consumer closed input channel or an error occurred. events=0x8
06-24 12:17:54.805: ERROR/InputDispatcher(2690): channel '408c7148 com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher (server)' ~ Channel is unrecoverably broken and will be disposed!
06-24 12:17:55.030: INFO/GLThread(10815): exiting tid=10
06-24 12:17:55.030: WARN/dalvikvm(10815): threadid=9: thread exiting with uncaught exception (group=0x40015578)
06-24 12:17:55.030: INFO/WindowManager(2690): WIN DEATH: Window{408ca9b0 SurfaceView paused=false}
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): FATAL EXCEPTION: GLThread 10
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): java.lang.IllegalArgumentException
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): at com.google.android.gles_jni.EGLImpl._eglCreateContext(Native Method)
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): at com.google.android.gles_jni.EGLImpl.eglCreateContext(EGLImpl.java:50)
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): at android.opengl.GLSurfaceView$DefaultContextFactory.createContext(GLSurfaceView.java:690)
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:930)
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1284)
06-24 12:17:55.035: ERROR/AndroidRuntime(10815): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
06-24 12:17:55.040: INFO/WindowManager(2690): WIN DEATH: Window{408c7148 com.sec.android.app.twlauncher/com.sec.android.app.twlauncher.Launcher paused=false}
06-24 12:17:55.055: WARN/ActivityManager(2690): Force finishing activity com.lesmobilizers.helloandroidharness/.MainActivity
06-24 12:17:55.060: ERROR/(2690): Dumpstate > /data/log/dumpstate_app_error
06-24 12:17:55.060: ERROR/SurfaceFlinger(2690): createNormalSurfaceLocked() failed (Value too large for defined data type)
06-24 12:17:55.060: WARN/InputManagerService(2690): Got RemoteException sending setActive(false) notification to pid 2835 uid 10012
06-24 12:17:55.060: WARN/WindowManager(2690): OutOfResourcesException creating surface
06-24 12:17:55.060: INFO/WindowManager(2690): Out of memory for surface! Looking for leaks...
06-24 12:17:55.060: WARN/WindowManager(2690): No leaked surfaces; killing applicatons!
06-24 12:17:55.065: WARN/ActivityManager(2690): Killing processes Free memory at adjustment 0
06-24 12:17:55.065: WARN/ActivityManager(2690): Killing ProcessRecord{40a9f3e0 10815:com.lesmobilizers.helloandroidharness/10103} (adj 0): Free memory
06-24 12:17:55.065: WARN/WindowManager(2690): Looks like we have reclaimed some memory, clearing surface for retry.
06-24 12:17:55.065: WARN/WindowManager(2690): Due to memory failure, waiting a bit for next layout
06-24 12:17:55.075: ERROR/InputDispatcher(2690): channel '40a37818 com.lesmobilizers.helloandroidharness/com.lesmobilizers.helloandroidharness.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
06-24 12:17:55.075: ERROR/InputDispatcher(2690): channel '40a37818 com.lesmobilizers.helloandroidharness/com.lesmobilizers.helloandroidharness.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
06-24 12:17:55.075: INFO/dumpstate(10847): begin
06-24 12:17:55.320: INFO/WindowManager(2690): WIN DEATH: Window{40a37818 com.lesmobilizers.helloandroidharness/com.lesmobilizers.helloandroidharness.MainActivity paused=true}
06-24 12:17:55.320: INFO/WindowManager(2690): WIN DEATH: Window{40ae64f8 SurfaceView paused=false}
06-24 12:17:55.560: WARN/ActivityManager(2690): Activity pause timeout for HistoryRecord{40b3a738 com.lesmobilizers.helloandroidharness/.MainActivity}
06-24 12:17:59.915: INFO/dumpstate(10847): done
06-24 12:18:00.020: INFO/ActivityManager(2690): Start proc com.sec.android.app.twlauncher for activity com.sec.android.app.twlauncher/.Launcher: pid=10883 uid=10012 gids={3003, 1015, 3002}


I'mma try the switch you told me. Thx.

This is strange, no configs found. I will add a verbose flag to the config chooser to log all config.

Btw, I tried with and it did crash too.

Yes, i expected that. I guess it has something to do with me forcing a depth of 16. We will find out :slight_smile: