Changing number of samples

classic Classic list List threaded Threaded
3 messages Options
ac
Reply | Threaded
Open this post in threaded view
|

Changing number of samples

ac
Hello,

If I need to change the number of samples of the gl surface after it has been created and possibly in the middle of rendering a frame, what would be the recommended way to do it, either with AWT or NEWT?

I think of the following sequence of operations: stop animator, destroy canvas, recreate canvas with new sample config, restart animator...

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Changing number of samples

Sven Gothel
Administrator
On 02/22/2012 05:23 PM, ac [via jogamp] wrote:

>
>
> Hello,
>
> If I need to change the number of samples of the gl surface after it has
> been created and possibly in the middle of rendering a frame, what would be
> the recommended way to do it, either with AWT or NEWT?
>
> I think of the following sequence of operations: stop animator, destroy
> canvas, recreate canvas with new sample config, restart animator...
Yes, you got it - sure.

Note: GLWindow and GLCanvas are GLAutoDrawable's.

You can keep the GLEventListener instance alive of course.
If properly implemented (destroy/init),
it should keep it's application state alive.
Hence remove the GLEventListener from the GLAutoDrawable
and add it to the new created one would be enough.

Instead of animator.stop(), you can also 'just' remove the GLAutoDrawable
from the running animator .. and later attach the new one.

If that is not working, you found a bug.
However, we already have a few unit tests validating this
'extended' lifecycle - ie. hopping an GLEventListener from
GLAutoDrawable to GLAutoDrawable :)

~Sven

>
> Thanks!


signature.asc (910 bytes) Download Attachment
ac
Reply | Threaded
Open this post in threaded view
|

Re: Changing number of samples

ac
Ok that works, at least in my test apps.

Here you have the one for AWT: http://pastebin.com/4y936aiC
and the one for NEWT: http://pastebin.com/FGMZykkE

just in case someone finds this useful.