|
hi,
I design a Observer Pattern to
sperate logic and presentation operation
about the "Observer"
part,
I use
a state pattern for change different view with Java3D (class called
""ViewState")
thus, when the logic operation
Notify(),
then the Update() would be invoked
in ViewState
the ViewState will update current
scene :
Transform3D
trans = new Transform3D();
if (objRoot.numChildren() != 0) { ( (TransformGroup) objRoot.getChild(0)).getTransform(trans); } BranchGroup
newRoot = new BranchGroup();
newRoot.setCapability(BranchGroup.ALLOW_DETACH); newRoot.setCapability(BranchGroup.ALLOW_CHILDREN_READ); pickCanvas = new
PickCanvas(c, newRoot);
pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO); pickCanvas.setTolerance(1.0f); TransformGroup
newTG = createTG_of_Shape();
newTG.setTransform(trans); newRoot.addChild(newTG); createMouseBehavior(newTG, newRoot); newRoot.compile(); u.getLocale().replaceBranchGraph(objRoot, newRoot); objRoot =
newRoot;
createTG_of_Shape() is
abstract method and implement in derive sub classes
these different sub view classes
will return the TransformGroup of the current scene of the current
view
the Canvas3D (as c),
SimpleUniverse (as u), BranchGroup (as objRoot) and PickCanvas (as
pickCanvas)
are static field in ViewState
for keeping the current Transform
because avoid that if the
view is changed,
the state pattern will new another
view subclass and lose the current Transform
in the other hand, that will
retrench the time and resource when change view without
new Canvas3D, SimpleUniverse,
BranchGroup and PickCanvas again.
everything is ok
but............
now, when change to a
specific view of the sub view classes (called
"ModelControlView")
I will let it open another JFrame
for render something of Java3D (called "CutPlaneWin")
and close it when change to
another view again.
so I add the following code in
ModeControlView constructor
public
ModelControlView(UIController ctrl) {
....
planeWin = new
CutPlaneWin(...); /** open the CutPlaneWin
Update(); } and close the planeWin in
changToXXXXView(...)
the CutPlaneWin handle Canvas3D, SimpleUniverse,
BranchGroup, PickCanvas and JFrame
in construtor,
it initiates the j3d objects, and then add
somthing to the scene, and then add the Canvas3D to JFrame
finailly show the
JFrame
but it always happens the native exception in
Canvas3D when change to ModelControlView,
that's my trouble!
why?
I post it as the
following...
thanks all.
Y.P. Liao
-----------------------------------------------------------------------------------------------------------
An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x0 Function=[Unknown.] Library=(N/A) NOTE: We are
unable to locate the function name symbol for the
error
just occurred. Please refer to release documentation for possible reason and solutions. Current Java thread: at javax.media.j3d.Canvas3D.setProjectionMatrix(Native Method) at javax.media.j3d.Renderer.doWork(Renderer.java:1237) at javax.media.j3d.J3dThread.run(J3dThread.java:250) Dynamic
libraries:
0x00400000 - 0x00406000 C:\JBuilder8\jdk1.4\bin\javaw.exe 0x77F80000 - 0x77FFB000 C:\WINNT\System32\ntdll.dll 0x77D90000 - 0x77DEB000 C:\WINNT\system32\ADVAPI32.dll 0x77E60000 - 0x77F31000 C:\WINNT\system32\KERNEL32.dll 0x786F0000 - 0x78761000 C:\WINNT\system32\RPCRT4.dll 0x77DF0000 - 0x77E4F000 C:\WINNT\system32\USER32.dll 0x77F40000 - 0x77F79000 C:\WINNT\system32\GDI32.dll 0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll 0x75E00000 - 0x75E1A000 C:\WINNT\System32\IMM32.DLL 0x6D330000 - 0x6D45C000 C:\JBuilder8\jdk1.4\jre\bin\client\jvm.dll 0x77530000 - 0x77560000 C:\WINNT\System32\WINMM.dll 0x6D1D0000 - 0x6D1D7000 C:\JBuilder8\jdk1.4\jre\bin\hpi.dll 0x6D300000 - 0x6D30D000 C:\JBuilder8\jdk1.4\jre\bin\verify.dll 0x6D210000 - 0x6D229000 C:\JBuilder8\jdk1.4\jre\bin\java.dll 0x6D320000 - 0x6D32D000 C:\JBuilder8\jdk1.4\jre\bin\zip.dll 0x136F0000 - 0x13705000 C:\work\FEM3D\ConcreteAnalysis.dll 0x32600000 - 0x32762000 C:\work\FEM3D\CC3260.DLL 0x6D000000 - 0x6D0FA000 C:\JBuilder8\jdk1.4\jre\bin\awt.dll 0x777C0000 - 0x777DE000 C:\WINNT\System32\WINSPOOL.DRV 0x75010000 - 0x75020000 C:\WINNT\system32\MPR.dll 0x77A30000 - 0x77B25000 C:\WINNT\system32\ole32.dll 0x6D180000 - 0x6D1D0000 C:\JBuilder8\jdk1.4\jre\bin\fontmanager.dll 0x51000000 - 0x51044000 C:\WINNT\System32\ddraw.dll 0x727A0000 - 0x727A6000 C:\WINNT\System32\DCIMAN32.dll 0x72C90000 - 0x72D03000 C:\WINNT\System32\D3DIM.DLL 0x6E260000 - 0x6E266000 C:\WINNT\System32\INDICDLL.dll 0x63000000 - 0x63014000 C:\WINNT\System32\SynTPFcs.dll 0x777E0000 - 0x777E7000 C:\WINNT\system32\VERSION.dll 0x75950000 - 0x75956000 C:\WINNT\system32\LZ32.DLL 0x1C540000 - 0x1C562000 C:\JBuilder8\jdk1.4\jre\bin\J3D.dll 0x692D0000 - 0x69397000 C:\WINNT\System32\OPENGL32.dll 0x6F920000 - 0x6F93F000 C:\WINNT\System32\GLU32.dll 0x6D230000 - 0x6D235000 C:\JBuilder8\jdk1.4\jre\bin\jawt.dll 0x1C680000 - 0x1C838000 C:\WINNT\System32\ialmgicd.dll 0x1C970000 - 0x1C996000 C:\WINNT\System32\ialmgdev.dll 0x24AC0000 - 0x24AED000 C:\Program Files\Dreye\PeaDict\Api\dictnt.dll 0x78F90000 - 0x791D4000 C:\WINNT\system32\shell32.dll 0x77C50000 - 0x77C9A000 C:\WINNT\system32\SHLWAPI.dll 0x77B30000 - 0x77BB9000 C:\WINNT\system32\COMCTL32.dll 0x77990000 - 0x77A2B000 C:\WINNT\system32\OLEAUT32.DLL 0x72BF0000 - 0x72C75000 C:\WINNT\System32\CLBCATQ.DLL 0x77810000 - 0x7784D000 C:\WINNT\System32\cscui.dll 0x77080000 - 0x770A3000 C:\WINNT\System32\CSCDLL.DLL 0x76DB0000 - 0x76DC1000 C:\WINNT\System32\mydocs.dll 0x71500000 - 0x71611000 C:\WINNT\System32\SHDOCVW.DLL 0x76F60000 - 0x76F6F000 C:\WINNT\System32\ntshrui.dll 0x773A0000 - 0x773B5000 C:\WINNT\System32\ATL.DLL 0x75100000 - 0x7514F000 C:\WINNT\System32\NETAPI32.DLL 0x77BC0000 - 0x77BCF000 C:\WINNT\System32\Secur32.dll 0x75150000 - 0x75156000 C:\WINNT\System32\NETRAP.dll 0x750E0000 - 0x750F0000 C:\WINNT\System32\SAMLIB.dll 0x74FB0000 - 0x74FC3000 C:\WINNT\System32\WS2_32.dll 0x74FA0000 - 0x74FA8000 C:\WINNT\System32\WS2HELP.DLL 0x77930000 - 0x77958000 C:\WINNT\system32\WLDAP32.dll 0x77960000 - 0x77984000 C:\WINNT\System32\DNSAPI.dll 0x74FD0000 - 0x74FDA000 C:\WINNT\System32\WSOCK32.dll 0x750F0000 - 0x750FC000 C:\WINNT\System32\ntlanman.dll 0x751A0000 - 0x751B5000 C:\WINNT\System32\NETUI0.DLL 0x75160000 - 0x75198000 C:\WINNT\System32\NETUI1.DLL 0x77900000 - 0x77923000 C:\WINNT\system32\imagehlp.dll 0x72900000 - 0x7292D000 C:\WINNT\system32\DBGHELP.dll 0x68E00000 - 0x68E0B000 C:\WINNT\System32\PSAPI.DLL Local Time =
Sun Apr 13 01:37:55 2003
Elapsed Time = 31 # # The exception above was detected in native code outside the VM # # Java VM: Java HotSpot(TM) Client VM (1.4.1-b21 mixed mode) # |
