From: Combe, C. <C....@na...> - 2002-06-06 15:58:31
|
hi, its me again I'm making some progress but am now stuck again. I've realized what some of the problems i've been having are. This is what i currently think is going on - please correct me if i'm wrong... (i'm new to all this). Before i can remove the GLCanvas I must do cvsDispose(). My canvas is drawn by the thread from the model part of the program passing through my subclass of GLCanvas, the way I was calling cvsDispose() didn't work because it was the event thread for the button that was doing it, so i got errors to do with 'not holding context'. This was fixed by using shaded3D.getGLContext().gljMakeCurrent() before calling cvsDispose(). (shaded3D is my subclass of GLCanvas.) After using cvsDispose, when I re-add the canvas to the frame it is not enabled or initialised, so trying to draw to it doesn't work. I can enable it by using setGLEnabled(true), but then it still isn't initialised. To initialise it i have to use createGLContext(Graphics g), but I'm not sure how to do this. createGLContext() is a method in GLContext so I need a GLContext before I can call it. So in my Frame class I'm doing shaded3D.getGLContext().createGLContext(this.getGraphics()); This doesn't work, I've tried to pursue the cause of why it doesn't work into the gl4java source code and the reason is that openOpenGLNative() returns false. The error messages are: could not open a GL widget -- GL CONTEXT can't create a GL context GL4Java ERROR: openOpen could not lock JAWT reference! I've tried passing createGLContext() the graphics object from both the GLCanvas and the Frame. Any suggestions about what i'm doing wrong? thanks again, colin -----Original Message----- From: Combe, Colin Sent: 04 June 2002 16:41 To: Combe, Colin Cc: gl4...@li... Subject: RE: [gl4java-usergroup] prog never returns from gljMakeCurrent() thanks, i just tried changing it but it didn't help :-( I'll leave it as a subclass of GLCanvas. colin -----Original Message----- From: Kenneth B. Russell [mailto:kbr...@al...] Sent: 04 June 2002 16:26 To: Colin Combe Cc: gl4...@li... Subject: Re: [gl4java-usergroup] prog never returns from gljMakeCurrent() > hi, i've been trying different ways of swapping one type of GLCanvas in an > application for another. Here's the current problem - after removing a > GLAnimCanvas from the a JPanel and then adding it again, the program never > returns from the glj.gljMakeCurrent() method, it just fails silently. The > following bit of code prints "hello" and nothing else, and then the program > is frozen. Have you tried subclassing GLCanvas instead? It has fewer assumptions built into it. |