From: <NM...@th...> - 2002-03-25 18:02:07
|
Hi, My application needs to swap a GLCanvas and a JPanel in and out of a GUI Container(JSplitPane). Currently I am destroying a GLCanvas with cvsDispose () and then rebuilding by recalling the constructor with each swap. What is the proper way to dispose of a GLCanvas? Currently, I am executing the following code : try { cvsDispose(); } catch (Exception e) { e.printStackTrace(); } On a WinNT machine this call causes a EXCEPTION_ACCESS_VIOLATION outside of the Java VM. It is happening in the gljDestroyNative() method in OpenGL_Win32_jawt.c when the native disp_wglDeleteContext(gc) call is made(Line 713). if(ret==JNI_TRUE) { if(gc!=0) { disp__wglDeleteContext(gc); } } I can wrap the code in a __try/__except but when I do my application freezes for up to a minute due to, I assume, a weird threading issue. I've tested my application on a Win95 machine and there is no error. Only NT. Also, I have the most recent release 2.8.2.0, Java 1.3.1, and the most current GL dlls. My questions are : 1) Am I making the right call to properly dispose of a GLCanvas? 2) Is this a known error? Is there a work around I am not aware of? 3) If there is no work around, can anyone suggest a way of disabling and then re-enabling a GLCanvas without actually destroying it? I have tried many combinations using calls : setVisible(), setGLEnabled() but the context is never re-enabled. I think it has something to do with the JPanel being placed on top of the GLCanvas. Is there a combination of calls anyone can recommend? Your help is GREATLY appreciated. Thanks, Noah Keen PS: FYI : In a recent post about platform independent gaming on slashdot.org the following comments were made about GL4Java. http://slashdot.org/comments.pl?sid=29967&cid=3218526 Good stuff! |