Combe, Colin wrote:
>What is the recommended way of swapping one canvas for another? I'll be most
>grateful for any advice. I'd really like to use gl4java for this project and
>the actual drawing of the scene works fine and is fast - its just this
>canvas changing thing that is the problem. :-(
>
Is there any reason you have to destroy the canvas each time? It is very
inefficient as initialization takes time each time you create a canvas.
If I were you I would keep two instances of GL canvas, one on screen and
one in inactive state. If the canvas is invisible (ie. removed from the
GUI) it won't do anything and you can safely keep it in memory,
re-adding to the GUI later and it will draw perfectly well. cvsDispose
call is required when you dump the canvas completely and want it to be GC'd.
HTH,
Max
|