From: <aco...@mi...> - 2003-04-14 13:25:42
|
Hi, We were having the problem with OpenMind. I think this comes from the fact the GLContext is already managed by gl4java in class GLAnimCanvas and GLCanvas, and though GLContext management appears in almost every gl4java example, managing it results in this error, because you make a new call to these methods while they have just been called by -say- the GLAnimCanvas.display() method, and while the context hasn't been released yet, you are trying to make it current again. I don't have a very good understanding of glContext management and multithreading but this how I have solved this problem with OpenMind, after having tested various combinations of code : public void init(GLDrawable drawable) { glj.gljMakeCurrent(); =20 =20 // init code goes here =20 =20 glj.gljFree(); firstRun=3Dtrue; =20 } public void display(GLDrawable drawable) { if(firstRun){ glj.gljMakeCurrent(); firstRun=3Dfalse; } =09 // display code goes here =09 // notice there is no gljFree() here and gljMakeCurrent()=20 // is only called at the first run =20 =20 } public void cleanup() { // making context current prevents VM crash in nvogl.dll=20 // for Nvidia cards when calling glDeleteTextures glj.gljMakeCurrent();=20 // your cleanup code goes here glj.gljFree(); } public void reshape(int width, int height) { glj.gljMakeCurrent(); =09 // your reshape code goes here =20 glj.gljFree(); } This structure for the main loop fixes the gljDestroy failed (free) error message, and VM crash on cleanup when using NVidia cards. Regards, Alban -----Message d'origine----- De=A0: gl4...@li... [mailto:gl4...@li...] De la part de =D6berg Johan Envoy=E9=A0: lundi 14 avril 2003 14:21 =C0=A0: gl4...@li... Objet=A0: [gl4java-usergroup] gljDestroy failed (free) I get the error 'gljDestroy failed (free)' everytime I try to close my application. I've searched for this error on google but I haven't seen any good answer yet. What do I need to do to get it to work? My display function looks like this: public void display() { glj.gljMakeCurrent(); =20 ... ... ... glj.gljSwap(); glj.gljFree(); } I read in GL4Java's documentation that you should call gljfree before gljDestroy so I've overridden doCleanup like this: public void doCleanup() { glj.gljFree(true); super.doCleanup(); } But that didn't help. Hope someone can help me. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ gl4java-usergroup mailing list gl4...@li... https://lists.sourceforge.net/lists/listinfo/gl4java-usergroup |