Author Topic: error screen rotated horizontally to the vertical  (Read 1764 times)

Offline canoide1592

  • byte
  • *
  • Posts: 6
    • View Profile
error screen rotated horizontally to the vertical
« on: February 24, 2014, 09:00:54 pm »
Good evening I'm having a problem with my Live Wallpaper, the problem is this when rotating the screen shoot me an execution error.

Code: [Select]
02-24 14:38:37.059: D/GLWallpaperService(3118): onSurfaceDestroyed()
02-24 14:38:37.179: D/GLWallpaperService(3118): onCreate()
02-24 14:38:37.179: I/jPCT-AE(3118): Loading Texture...
02-24 14:38:37.179: I/jPCT-AE(3118): Texture loaded...65536 bytes/128*128 pixels!
02-24 14:38:37.179: I/jPCT-AE(3118): Loading Texture...
02-24 14:38:37.189: D/dalvikvm(3118): GC_FOR_ALLOC freed 582K, 18% free 5850K/7132K, paused 6ms, total 6ms
02-24 14:38:37.189: I/jPCT-AE(3118): Texture loaded...65536 bytes/128*128 pixels!
02-24 14:38:37.199: I/jPCT-AE(3118): Loading Texture...
02-24 14:38:37.199: D/dalvikvm(3118): GC_EXPLICIT freed 82K, 18% free 5898K/7132K, paused 0ms+1ms, total 5ms
02-24 14:38:37.209: D/dalvikvm(3118): GC_EXPLICIT freed <1K, 18% free 5898K/7132K, paused 0ms+1ms, total 5ms
02-24 14:38:37.209: I/jPCT-AE(3118): Texture loaded...65536 bytes/128*128 pixels!
02-24 14:38:37.209: I/jPCT-AE(3118): Loading Texture...
02-24 14:38:37.219: D/dalvikvm(3118): GC_FOR_ALLOC freed 100K, 16% free 6025K/7132K, paused 3ms, total 3ms
02-24 14:38:37.219: I/jPCT-AE(3118): Texture loaded...65536 bytes/128*128 pixels!
02-24 14:38:37.219: I/jPCT-AE(3118): Loading Texture...
02-24 14:38:37.219: I/jPCT-AE(3118): Texture loaded...65536 bytes/128*128 pixels!
02-24 14:38:37.219: I/jPCT-AE(3118): Loading Texture...
02-24 14:38:37.219: D/dalvikvm(3118): GC_FOR_ALLOC freed 164K, 17% free 6154K/7336K, paused 3ms, total 3ms
02-24 14:38:37.219: I/jPCT-AE(3118): Texture loaded...65536 bytes/128*128 pixels!
02-24 14:38:37.219: I/jPCT-AE(3118): Loading Texture...
02-24 14:38:37.229: I/jPCT-AE(3118): Texture loaded...65536 bytes/128*128 pixels!
02-24 14:38:37.279: D/GLWallpaperService(3118): onSurfaceCreated()
02-24 14:38:37.279: I/jPCT-AE(3118): GL context is -1288267568
02-24 14:38:37.279: I/jPCT-AE(3118): OpenGL vendor:     Android
02-24 14:38:37.279: I/jPCT-AE(3118): OpenGL renderer:   Android PixelFlinger 1.4
02-24 14:38:37.279: I/jPCT-AE(3118): OpenGL version:    OpenGL ES-CM 1.0
02-24 14:38:37.279: I/jPCT-AE(3118): OpenGL renderer initialized (using 2/2 texture stages)
02-24 14:38:37.279: W/dalvikvm(3118): threadid=11: thread exiting with uncaught exception (group=0xb2f52648)
02-24 14:38:37.279: E/AndroidRuntime(3118): FATAL EXCEPTION: GLThread 188
02-24 14:38:37.279: E/AndroidRuntime(3118): java.lang.NullPointerException
02-24 14:38:37.279: E/AndroidRuntime(3118): at com.AppEnjoy.SpeakerLiveWallpaper3DFree.MyWallpaperService$MyRenderer.rotarObjeto(MyWallpaperService.java:365)
02-24 14:38:37.279: E/AndroidRuntime(3118): at com.AppEnjoy.SpeakerLiveWallpaper3DFree.MyWallpaperService$MyRenderer.onDrawFrame(MyWallpaperService.java:264)
02-24 14:38:37.279: E/AndroidRuntime(3118): at net.rbgrn.android.glwallpaperservice.GLThread.guardedRun(GLWallpaperService.java:716)
02-24 14:38:37.279: E/AndroidRuntime(3118): at net.rbgrn.android.glwallpaperservice.GLThread.run(GLWallpaperService.java:574)

according to this Live Wallpaper is destroyed and recreated another when you have to load the models supposed to do it but I want to rotate the long Object3D java.lang.NullPointerException error

Here I load the code where the models. and where broken waiting. Any advice on how to perform the load or which load models. From already thank you

Code load model:
Code: [Select]
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);

world = new World();
world.setAmbientLight(20, 20, 20);

sun = new Light(world);
sun.setIntensity(250, 250, 250);

TextureManager.getInstance().addTexture("texture", texFuego);

cube = Object3D.mergeAll(Loader.load3DS(getResources().getAssets().open("modelos/parlante1.3ds"), 1));
cube.build();
cube.strip();
cube.forceGeometryIndices(true);
cube.rotateZ(-1.5f);

world.removeAllObjects();
world.addObject(cube);


Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(cube.getTransformedCenter());


SimpleVector pos = new SimpleVector(0, 0, 15);
part = new ParticleSystem(world, pos, 30, 30, "texture", 20,1, 10, 0);
part.SetMaxScale(4f);
part.setMaxDir(new SimpleVector(0.1f, 1f, 0.1f));


SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();

if (master == null) {
Logger.log("Saving master Activity!");
master = MyWallpaperService.this;
}

}

Drawing code:

Code: [Select]
public void onDrawFrame(GL10 gl) {
// (int)(Math.random() * (9-1)+1)

long endTime = System.currentTimeMillis();
float timeDiff = (endTime - startTime) / 1000.0f;
startTime = endTime;

fb.clear(new RGBColor(255, 255, 255));

rotarObjeto(cube, rotacion);


world.renderScene(fb);
world.draw(fb);

//particleSystem
part.Update(timeDiff);

fb.display();

}

public void rotarObjeto(Object3D objeto, int Num) {
objeto.rotateX(0);
objeto.rotateY(0);
objeto.rotateZ(0);

if (contador > 63 || contador == 0) {
rotacion = (byte) (Math.random() * (9 - 1) + 1);
contador = 0;
}
contador++;

float Speed = 0.1f;
switch (Num) {
case 1:
objeto.rotateX(Speed);
break;
case 2:
objeto.rotateY(Speed);
break;
case 3:
objeto.rotateZ(Speed);
break;
case 4:
objeto.rotateX(Speed);
break;
case 5:
objeto.rotateY(Speed);
break;
case 6:
objeto.rotateZ(Speed);
break;
case 7:
objeto.rotateX(Speed);
objeto.rotateY(Speed);
break;
case 8:
objeto.rotateX(Speed);
objeto.rotateZ(Speed);
break;
case 9:
objeto.rotateY(Speed);
objeto.rotateZ(Speed);
break;
}
}



It works rather than to start running the problem arises when I turn the screen from portrait to landscape and viceverza

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: error screen rotated horizontally to the vertical
« Reply #1 on: February 24, 2014, 11:39:38 pm »
Somehow something is null in your rotarObjeto method. Which line is 365? That's a problem with the way in which you are dealing with the screen rotation, it's not the fault of the engine...just add some more debug output to see what actually happens there.