About defaultToKeepPixels

Started by kiffa, September 21, 2012, 09:59:10 AM

Previous topic - Next topic

EgonOlsen

If you really want the keep the gui textures in memory for whatever reason, then don't flush and use replaceTexture() to reload all other textures instead. That will keep the ids.


Thomas.

Egon, what means this error? When I simply ignore it (try-catch) textures are loaded and everything works, but it is not right... and it seems method "onSurfaceChanged" is called many times after change context, is it right?
10-07 01:02:49.237: E/AndroidRuntime(8963): FATAL EXCEPTION: GLThread 7583
10-07 01:02:49.237: E/AndroidRuntime(8963): java.lang.RuntimeException: [ 1349564569196 ] - ERROR: java.lang.NullPointerException
10-07 01:02:49.237: E/AndroidRuntime(8963): at com.threed.jpct.GLRenderer.rescale32(GLRenderer.java:1061)
10-07 01:02:49.237: E/AndroidRuntime(8963): at com.threed.jpct.GLRenderer.buildMipmap(GLRenderer.java:983)
10-07 01:02:49.237: E/AndroidRuntime(8963): at com.threed.jpct.GLRenderer.convertTexture(GLRenderer.java:935)
10-07 01:02:49.237: E/AndroidRuntime(8963): at com.threed.jpct.GLRenderer.upload(GLRenderer.java:1603)
10-07 01:02:49.237: E/AndroidRuntime(8963): at com.threed.jpct.TextureManager.preWarm(TextureManager.java:297)
10-07 01:02:49.237: E/AndroidRuntime(8963): at cz.chladek.mygame.util.TextureLoader.loadTextures(TextureLoader.java:149)
10-07 01:02:49.237: E/AndroidRuntime(8963): at cz.chladek.mygame.AppActivity$MyRenderer.onSurfaceCreated(AppActivity.java:525)
10-07 01:02:49.237: E/AndroidRuntime(8963): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1494)
10-07 01:02:49.237: E/AndroidRuntime(8963): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
10-07 01:02:49.237: E/AndroidRuntime(8963): at com.threed.jpct.Logger.log(Logger.java:189)
10-07 01:02:49.237: E/AndroidRuntime(8963): at com.threed.jpct.Logger.log(Logger.java:136)
10-07 01:02:49.237: E/AndroidRuntime(8963): at cz.chladek.mygame.util.TextureLoader.loadTextures(TextureLoader.java:154)
10-07 01:02:49.237: E/AndroidRuntime(8963): at cz.chladek.mygame.AppActivity$MyRenderer.onSurfaceCreated(AppActivity.java:525)
10-07 01:02:49.237: E/AndroidRuntime(8963): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1494)
10-07 01:02:49.237: E/AndroidRuntime(8963): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

EgonOlsen

Looks like it tries to create mipmaps for a texture that has no pixels. Maybe you haven't replaced all textures without pixels when calling preWarm().

Thomas.

#19
Yes, I replace one texture and upload it. I can not replace all textures at once, because it causes OutOfMemory error...

EgonOlsen

I see...i should simply exclude textures without pixels from the prewarming.

EgonOlsen