Problem changing the parent of a JPanel containing a CanvasPeer

hi

In my current game a integrate xith with Swing. I’ve extended the JPanel class so that it contains a CanvasPeer (and a Canvas3D) with GridLayout (called CanvasPanel). Such a panel is than added to another JPanel. I want to reuse this CanvasPanel on just another JPanel because it takes so long to initialize a new CanvasPeer.

For that perpose I pause the rendering loop, remove the CanvasPanel from it’s parent and add it to another parent panel. From that moment on I get several errors looking the following each time view.renderOnce() is called:

fglX11AllocateManagedSurface: __FGLTexMgrAllocMem failed!!

I’m using Xith3D 0.7.1 and the jogl version coming with it, Java 1.5.0 Update6 and Linux.

What am I doing wrong? Is it the designated way to do it? Is there another way to quickly generate more than one Canvas?

Qudus

PS: I also tried to remove not the CanvasPanel itself but it’s parent and readd this parent to another container. It’s all the same behaviour. And I tried to remove the canvas from it’s view (I have only one view) and readd it when it’s needed.

Seems to be a problem with the Linux ATI driver. I’ll try to upgrade it (quite a bunch of work).

But maybe I’m still doing something wrong.

Ok. Upgraded it, but it didn’t fix the problem. I worked the problem around but now I’m fighting with these dammed crashes when switching panels containing CanvasPeers or changing the container of a panel holding a CanvasPeer.

Now I decided not to change a canvas’ parent or grandparent as a start. And I moved to windows to develop this part of the game. On Windows the ATI driver is much more stabil and it doesn’t hang the whole system when the JVM crashes. But the JVM still crashes. This is a log output of such a crash.

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x690c73e2, pid=208, tid=468
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode)
# Problematic frame:
# C  [atioglxx.dll+0xc73e2]
#

---------------  T H R E A D  ---------------

Current thread (0x0ad27d70):  JavaThread "AWT-EventQueue-0" [_thread_in_native, id=468]

siginfo: ExceptionCode=0xc0000005, reading address 0x0e75f000

Registers:
EAX=0x1057c000, EBX=0x0e1acbe8, ECX=0x00000254, EDX=0x00000654
ESP=0x0b08f4cc, EBP=0x0e1792d8, ESI=0x0e75f000, EDI=0x1057d000
EIP=0x690c73e2, EFLAGS=0x00010246

Top of Stack: (sp=0x0b08f4cc)
0x0b08f4cc:   d052c000 0e171040 691c911b 0000021c
0x0b08f4dc:   0000000c 0000021c 0e171040 00000000
0x0b08f4ec:   0e1792d0 01d27e30 1057c000 d052c000
0x0b08f4fc:   00000005 00000000 691cefdf 00000004
0x0b08f50c:   0000021c 00000004 0e171040 00000001
0x0b08f51c:   0e1792d0 00000001 00000000 0000021c
0x0b08f52c:   691cec7a 00000004 00000000 0000021c
0x0b08f53c:   02b23cc0 0000021c 0b08f568 0ad27d70 

Instructions: (pc=0x690c73e2)
0x690c73d2:   5d 5f 5e c2 08 00 8d 14 52 57 8b f1 8b f8 8b ca
0x690c73e2:   f3 a5 8b c7 5f 5e c2 08 00 cc cc cc cc cc 8b c1 


Stack: [0x0b050000,0x0b090000),  sp=0x0b08f4cc,  free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [atioglxx.dll+0xc73e2]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  com.sun.opengl.impl.GLImpl.glDrawArrays(III)V
J  com.xith3d.render.jsr231.ShapeAtomPeer.drawGeometry(Lcom/xith3d/render/CanvasPeer;Ljavax/media/opengl/GL;Lcom/xith3d/scenegraph/GeometryArray;)V
J  com.xith3d.render.jsr231.ShapeAtomPeer.renderAtom(Lcom/xith3d/render/CanvasPeer;Lcom/xith3d/render/RenderAtom;)V
J  com.xith3d.render.CanvasPeerBase.render(Lcom/xith3d/render/RenderAtom;)V
J  com.xith3d.render.jsr231.CanvasPeerImpl.drawBin(Ljavax/media/opengl/GL;Lcom/xith3d/render/RenderBin;)V
J  com.xith3d.render.jsr231.CanvasPeerImpl.display(Ljavax/media/opengl/GLAutoDrawable;)V
J  com.sun.opengl.impl.GLDrawableHelper.display(Ljavax/media/opengl/GLAutoDrawable;)V
J  javax.media.opengl.GLCanvas$DisplayAction.run()V
J  com.sun.opengl.impl.GLDrawableHelper.invokeGL(Ljavax/media/opengl/GLDrawable;Ljavax/media/opengl/GLContext;Ljava/lang/Runnable;Ljava/lang/Runnable;)V
J  javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(Ljava/lang/Runnable;Ljava/lang/Runnable;)V
J  javax.media.opengl.GLCanvas.display()V
v  ~RuntimeStub::alignment_frame_return Runtime1 stub
j  javax.media.opengl.GLCanvas.paint(Ljava/awt/Graphics;)V+1
j  sun.awt.RepaintArea.paintComponent(Ljava/awt/Component;Ljava/awt/Graphics;)V+6
j  sun.awt.RepaintArea.paint(Ljava/lang/Object;Z)V+326
j  sun.awt.windows.WComponentPeer.handleEvent(Ljava/awt/AWTEvent;)V+63
j  java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V+765
J  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V
J  java.awt.EventDispatchThread.pumpOneEventForHierarchy(ILjava/awt/Component;)Z
v  ~RuntimeStub::alignment_frame_return Runtime1 stub
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+26
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j  java.awt.EventDispatchThread.run()V+9
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x00356230 JavaThread "DestroyJavaVM" [_thread_blocked, id=260]
  0x0acead40 JavaThread "Thread-2" [_thread_blocked, id=1952]
=>0x0ad27d70 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=468]
  0x0acd0b98 JavaThread "AWT-Windows" daemon [_thread_in_native, id=452]
  0x0acd0720 JavaThread "AWT-Shutdown" [_thread_blocked, id=456]
  0x0ac89e28 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=444]
  0x00a1bfe0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1132]
  0x00a1abb0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1140]
  0x00a19f30 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1136]
  0x00a10fd0 JavaThread "Finalizer" daemon [_thread_blocked, id=1180]
  0x00a0fb38 JavaThread "Reference Handler" daemon [_thread_blocked, id=1216]

Other Threads:
  0x00a0b998 VMThread [id=1244]
  0x00a1d1c8 WatcherThread [id=448]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 2112K, used 1012K [0x02a60000, 0x02ca0000, 0x02f40000)
  eden space 1920K,  52% used [0x02a60000, 0x02b5d0d0, 0x02c40000)
  from space 192K,   0% used [0x02c70000, 0x02c70260, 0x02ca0000)
  to   space 192K,   0% used [0x02c40000, 0x02c40000, 0x02c70000)
 tenured generation   total 27236K, used 15767K [0x02f40000, 0x049d9000, 0x06a60000)
   the space 27236K,  57% used [0x02f40000, 0x03ea5d38, 0x03ea5e00, 0x049d9000)
 compacting perm gen  total 10240K, used 10183K [0x06a60000, 0x07460000, 0x0aa60000)
   the space 10240K,  99% used [0x06a60000, 0x07451f98, 0x07452000, 0x07460000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x0040c000 	C:\Programme\Java\jre1.5.0_06\bin\javaw.exe
0x77f40000 - 0x77fee000 	C:\WINDOWS\System32\ntdll.dll
0x77e40000 - 0x77f38000 	C:\WINDOWS\system32\kernel32.dll
0x77da0000 - 0x77e3c000 	C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78086000 	C:\WINDOWS\system32\RPCRT4.dll
0x77d10000 - 0x77d9c000 	C:\WINDOWS\system32\USER32.dll
0x77c40000 - 0x77c80000 	C:\WINDOWS\system32\GDI32.dll
0x77be0000 - 0x77c33000 	C:\WINDOWS\system32\MSVCRT.dll
0x6d670000 - 0x6d804000 	C:\Programme\Java\jre1.5.0_06\bin\client\jvm.dll
0x76af0000 - 0x76b1d000 	C:\WINDOWS\System32\WINMM.dll
0x6d280000 - 0x6d288000 	C:\Programme\Java\jre1.5.0_06\bin\hpi.dll
0x76bb0000 - 0x76bbb000 	C:\WINDOWS\System32\PSAPI.DLL
0x6d640000 - 0x6d64c000 	C:\Programme\Java\jre1.5.0_06\bin\verify.dll
0x6d300000 - 0x6d31d000 	C:\Programme\Java\jre1.5.0_06\bin\java.dll
0x6d660000 - 0x6d66f000 	C:\Programme\Java\jre1.5.0_06\bin\zip.dll
0x6d000000 - 0x6d167000 	C:\Programme\Java\jre1.5.0_06\bin\awt.dll
0x72f70000 - 0x72f93000 	C:\WINDOWS\System32\WINSPOOL.DRV
0x76330000 - 0x7634c000 	C:\WINDOWS\System32\IMM32.dll
0x77180000 - 0x772a1000 	C:\WINDOWS\system32\ole32.dll
0x51000000 - 0x51050000 	C:\WINDOWS\System32\ddraw.dll
0x73b30000 - 0x73b36000 	C:\WINDOWS\System32\DCIMAN32.dll
0x5c000000 - 0x5c0c8000 	C:\WINDOWS\System32\D3DIM700.DLL
0x6d240000 - 0x6d27d000 	C:\Programme\Java\jre1.5.0_06\bin\fontmanager.dll
0x746a0000 - 0x746e4000 	C:\WINDOWS\System32\MSCTF.dll
0x773a0000 - 0x77ba1000 	C:\WINDOWS\system32\shell32.dll
0x0af40000 - 0x0afa4000 	C:\WINDOWS\system32\SHLWAPI.dll
0x78090000 - 0x78174000 	C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
0x77310000 - 0x7739b000 	C:\WINDOWS\system32\comctl32.dll
0x6d4c0000 - 0x6d4d3000 	C:\Programme\Java\jre1.5.0_06\bin\net.dll
0x71a10000 - 0x71a25000 	C:\WINDOWS\System32\WS2_32.dll
0x71a00000 - 0x71a08000 	C:\WINDOWS\System32\WS2HELP.dll
0x6d4e0000 - 0x6d4e9000 	C:\Programme\Java\jre1.5.0_06\bin\nio.dll
0x609d0000 - 0x609d8000 	C:\WINDOWS\System32\mslbui.dll
0x6d1c0000 - 0x6d1e3000 	C:\Programme\Java\jre1.5.0_06\bin\dcpr.dll
0x10000000 - 0x10047000 	D:\Qudus\workspace\libs\xith3d\native\jogl.dll
0x5f0d0000 - 0x5f196000 	C:\WINDOWS\System32\OPENGL32.dll
0x68fc0000 - 0x68fde000 	C:\WINDOWS\System32\GLU32.dll
0x6d3c0000 - 0x6d3df000 	C:\Programme\Java\jre1.5.0_06\bin\jpeg.dll
0x6d190000 - 0x6d1bf000 	C:\Programme\Java\jre1.5.0_06\bin\cmm.dll
0x6d360000 - 0x6d366000 	C:\Programme\Java\jre1.5.0_06\bin\jawt.dll
0x0b030000 - 0x0b035000 	D:\Qudus\workspace\libs\xith3d\native\jogl_awt.dll
0x69000000 - 0x694ff000 	C:\WINDOWS\System32\atioglxx.dll

VM Arguments:
jvm_args: -Djava.library.path=D:\Qudus\workspace\libs\xith3d\native;D:\Qudus\workspace\libs\xith3d\native
java_command: game.starter.Starter1
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\Programme\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Technologies\ATI Control Panel
USERNAME=Qudus
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 31 Stepping 0, AuthenticAMD



---------------  S Y S T E M  ---------------

OS: Windows XP Build 2600 Service Pack 1

CPU:total 1 family 31, cmov, cx8, fxsr, mmx, sse, sse2

Memory: 4k page, physical 1047792k(556796k free), swap 3045112k(2658684k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0_06-b05) for windows-x86, built on Nov 10 2005 11:12:14 by "java_re" with MS VC++ 6.0

Can anyone help me?

Qudus