方向更改GLSurfaceView中的问题

时间:2011-09-08 14:15:59

标签: android screen-orientation glsurfaceview

我使用Android openGLES1.0旋转多边形。如果我连续2,3次更改设备的方向(横向到纵向反面)我的活动有GLSurfaceView die.it结果到之前的Activity(屏幕).logcat显示以下消息。 请帮帮我。

这是我的日志:

09-08 19:39:29.865: INFO/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-08 19:39:29.865: INFO/DEBUG(28): Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
09-08 19:39:29.865: INFO/DEBUG(28): pid: 860, tid: 878  >>> com.samples.android.MyExample <<<
09-08 19:39:29.865: INFO/DEBUG(28): signal 11 (SIGSEGV), fault addr 46aff000
09-08 19:39:29.865: INFO/DEBUG(28):  r0 46aff000  r1 ffffffff  r2 00000268  r3 ffffffff
09-08 19:39:29.865: INFO/DEBUG(28):  r4 00000120  r5 46afeec8  r6 000003c0  r7 00000640
09-08 19:39:29.865: INFO/DEBUG(28):  r8 475fad88  r9 42f26ee4  10 42f26ecc  fp 0011dcf0
09-08 19:39:29.865: INFO/DEBUG(28):  ip ffffffff  sp 475fad1c  lr ffffffff  pc afb043f4  cpsr 20000010
09-08 19:39:30.005: INFO/DEBUG(28):          #00  pc 000043f4  /system/lib/libcutils.so
09-08 19:39:30.025: INFO/DEBUG(28):          #01  pc 00015284  /system/lib/libpixelflinger.so
09-08 19:39:30.025: INFO/DEBUG(28):          #02  pc 000153cc  /system/lib/libpixelflinger.so
09-08 19:39:30.025: INFO/DEBUG(28):          #03  pc 00014b84  /system/lib/egl/libGLES_android.so
09-08 19:39:30.025: INFO/DEBUG(28):          #04  pc 0000f1f4  /system/lib/libdvm.so
09-08 19:39:30.025: INFO/DEBUG(28):          #05  pc 00037fcc  /system/lib/libdvm.so
09-08 19:39:30.035: INFO/DEBUG(28):          #06  pc 00031642  /system/lib/libdvm.so
09-08 19:39:30.035: INFO/DEBUG(28):          #07  pc 00013f58  /system/lib/libdvm.so
09-08 19:39:30.035: INFO/DEBUG(28):          #08  pc 00019888  /system/lib/libdvm.so
09-08 19:39:30.035: INFO/DEBUG(28):          #09  pc 00018d5c  /system/lib/libdvm.so
09-08 19:39:30.045: INFO/DEBUG(28):          #10  pc 0004d6d0  /system/lib/libdvm.so
09-08 19:39:30.045: INFO/DEBUG(28):          #11  pc 0004d702  /system/lib/libdvm.so
09-08 19:39:30.055: INFO/DEBUG(28):          #12  pc 00041c78  /system/lib/libdvm.so
09-08 19:39:30.055: INFO/DEBUG(28):          #13  pc 00010000  /system/lib/libc.so
09-08 19:39:30.055: INFO/DEBUG(28):          #14  pc 0000fad4  /system/lib/libc.so
09-08 19:39:30.055: INFO/DEBUG(28): code around pc:
09-08 19:39:30.055: INFO/DEBUG(28): afb043e4 e1b03103 24801004 e1a03001 e2522020 
09-08 19:39:30.065: INFO/DEBUG(28): afb043f4 28a0500a 28a0500a 2afffffb e2822020 
09-08 19:39:30.065: INFO/DEBUG(28): afb04404 e1b02e02 28a0500a 48a04002 e1b02102 
09-08 19:39:30.065: INFO/DEBUG(28): code around lr:
09-08 19:39:30.065: INFO/DEBUG(28): stack:
09-08 19:39:30.065: INFO/DEBUG(28):     475facdc  00000000  
09-08 19:39:30.065: INFO/DEBUG(28):     475face0  bf8295fb  
09-08 19:39:30.065: INFO/DEBUG(28):     475face4  bf800000  
09-08 19:39:30.065: INFO/DEBUG(28):     475face8  00000000  
09-08 19:39:30.065: INFO/DEBUG(28):     475facec  00000000  
09-08 19:39:30.075: INFO/DEBUG(28):     475facf0  c0014afd  
09-08 19:39:30.075: INFO/DEBUG(28):     475facf4  00000000  
09-08 19:39:30.075: INFO/DEBUG(28):     475facf8  40c19648  
09-08 19:39:30.075: INFO/DEBUG(28):     475facfc  00000000  
09-08 19:39:30.075: INFO/DEBUG(28):     475fad00  00000000  
09-08 19:39:30.075: INFO/DEBUG(28):     475fad04  00000000  
09-08 19:39:30.075: INFO/DEBUG(28):     475fad08  00000000  
09-08 19:39:30.075: INFO/DEBUG(28):     475fad0c  40805851  
09-08 19:39:30.075: INFO/DEBUG(28):     475fad10  df002777  
09-08 19:39:30.075: INFO/DEBUG(28):     475fad14  e3a070ad  
09-08 19:39:30.075: INFO/DEBUG(28):     475fad18  00000000  
09-08 19:39:30.075: INFO/DEBUG(28): #00 475fad1c  acf15287  /system/lib/libpixelflinger.so
09-08 19:39:30.075: INFO/DEBUG(28): #01 475fad20  bf8295fb  
09-08 19:39:30.085: INFO/DEBUG(28):     475fad24  0000ffff  [heap]
09-08 19:39:30.085: INFO/DEBUG(28):     475fad28  00000000  
09-08 19:39:30.085: INFO/DEBUG(28):     475fad2c  003e8540  [heap]
09-08 19:39:30.085: INFO/DEBUG(28):     475fad30  000000b3  
09-08 19:39:30.085: INFO/DEBUG(28):     475fad34  000002d4  
09-08 19:39:30.085: INFO/DEBUG(28):     475fad38  000001e0  
09-08 19:39:30.085: INFO/DEBUG(28):     475fad3c  acf153d1  /system/lib/libpixelflinger.so
09-08 19:39:31.444: DEBUG/Zygote(30): Process 860 terminated by signal (11)
09-08 19:39:31.454: INFO/ActivityManager(52): Process com.samples.android.MyExample (pid 860) has died.
09-08 19:39:31.465: INFO/WindowManager(52): WIN DEATH: Window{44dbc0b0 com.samples.android.MyExample/com.samples.android.MyExample.polygonActivity paused=false}
09-08 19:39:31.465: INFO/WindowManager(52): WIN DEATH: Window{44ec8d30 com.samples.android.MyExample/com.samples.android.MyExample.polygonsTabActivity paused=false}
09-08 19:39:31.474: INFO/ActivityManager(52): Start proc com.samples.android.MyExample for activity com.samples.android.MyExample/.polygonsTabActivity: pid=879 uid=10028 gids={3003}
09-08 19:39:31.474: INFO/WindowManager(52): WIN DEATH: Window{44e47ee0 SurfaceView paused=false}
09-08 19:39:31.565: DEBUG/ddm-heap(879): Got feature list request
09-08 19:39:31.595: INFO/UsageStats(52): Unexpected resume of com.samples.android.MyExample while already resumed in com.samples.android.MyExample
09-08 19:39:31.725: DEBUG/dalvikvm(879): GC freed 702 objects / 55456 bytes in 46ms
09-08 19:39:31.785: DEBUG/dalvikvm(879): GC freed 73 objects / 2888 bytes in 34ms
09-08 19:39:31.955: WARN/PhoneWindow(879): Previously focused view reported id 16908298 during save, but can't be found during restore.
09-08 19:39:32.075: WARN/InputManagerService(52): Got RemoteException sending setActive(false) notification to pid 860 uid 10028
09-08 19:39:32.355: INFO/ActivityManager(52): Displayed activity com.samples.android.MyExample/.polygonsTabActivity: 897 ms (total 897 ms)
09-08 19:39:33.525: DEBUG/dalvikvm(52): GC freed 1330 objects / 60912 bytes in 73ms
polygon

2 个答案:

答案 0 :(得分:0)

您可以停用方向更改。根据您的工作情况,这可能不太可行。

答案 1 :(得分:0)

如果您正在使用API​​ 3 +,请尝试使用view.setPreserveEGLContextOnPause(true)