100
« on: January 31, 2012, 02:10:38 pm »
I have a similar problem in my Wallpaper.
I was getting intermittent crashes when going in and out of the wallpaper settings. But the wallpaper was still running in the background. Objects would intermittently disappear and reappear.
So as suggested in this thread to re-create the GLViewSurface, I added this to onResume() in my WallpaperService class:
if (renderer != null)
{
renderer.release();
renderer = null;
// New renderer
renderer = new WallpaperRenderer(getApplicationContext());
//setRenderer(renderer); // Causes crash, "setRenderer is already set"
//setRenderMode(RENDERMODE_CONTINUOUSLY);
}
..which basically re-creates my WallpaperRenderer class, which implements GLSurfaceView.Renderer.
Now that actually fixed the problem on my Gingerbread phone completely, but on my HoneyComb tablet I'm now seeing a texture problem.
If I have some other wallpaper running, then go to Settings->Wallpaper->[select my wallpaper], everything is fine.
But if I have my own wallpaper running in the background and then go to Settings->Wallpaper->[select my wallpaper], all textures are missing in the wallpaper preview screen. I still see the objects but they are blank objects with no texture. But if I press "Set Wallpaper", everything is fine and the wallpaper gets all its textures back. Then if I go back into the wallpaper selection screen, I get a crash (see below), but the wallpaper is still running behind the error.
02-01 00:02:23.670: E/AndroidRuntime(13380): FATAL EXCEPTION: GLThread 10
02-01 00:02:23.670: E/AndroidRuntime(13380): java.lang.NullPointerException
02-01 00:02:23.670: E/AndroidRuntime(13380): at com.threed.jpct.World.draw(World.java:1333)
02-01 00:02:23.670: E/AndroidRuntime(13380): at com.threed.jpct.World.draw(World.java:1135)
01-31 23:44:32.060: I/jPCT-AE(13336): Visibility lists disposed!
01-31 23:44:32.060: I/jPCT-AE(13336): All texture data unloaded from gpu!
01-31 23:44:32.060: I/jPCT-AE(13336): Disposing VBOs!
01-31 23:44:32.060: I/jPCT-AE(13336): Renderer disposed!
01-31 23:44:32.060: I/jPCT-AE(13336): Static references cleared...
01-31 23:44:32.060: I/jPCT-AE(13336): OpenGL vendor: NVIDIA Corporation
...and the rest of it..
and then a huge amount of:
01-31 23:44:32.480: I/jPCT-AE(13336): [ 1328013872491 ] - WARNING: OpenGL context has changed...trying to recover...
(I was seeing this earlier as well)
I tried to use temp.keepPixelData(true) on each texture, but that made no difference.
I have a static class that saves the instance of my wallpaper.java class so I'm not reloading all the textures and objects when onSurfaceCreated is called.
I'm using Robert Green's GLWallpaperService btw.
If someone has a working wallpaper using GLWallpaperService, can you please send me the WallpaperService.java file and WallpaperRender.java file?