painting on demand and continuously in a GLCanvas

classic Classic list List threaded Threaded
15 messages Options
don
Reply | Threaded
Open this post in threaded view
|

painting on demand and continuously in a GLCanvas

don
Hi all,

I have two separate GLCanvases which I need to have painting on demand and also painting continuously in both.
Because I have a red point which can be dragged by mouse(It has to be painted continuously ) and a contour plot which is changed when ever the function is changed(paint on demand because its rendering needs lots of time), Is it possible to have both methods in each canvas?

Thank in advance =)
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

gouessej
Administrator
Hi

You can use distinct animators for your canvases, one painting continuously and another one painting on demand. You can override an existing animator to paint only on demand.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

Sven Gothel
Administrator
On 03/14/2013 10:09 AM, gouessej [via jogamp] wrote:
> Hi
>
> You can use distinct animators for your canvases, one painting continuously
> and another one painting on demand. You can override an existing animator to
> paint only on demand.

.. or could simply call pause() and resume() to trigger the 'on demand',
as you wish.

If you implement your own .. pls derive from GLAnimatorControl and
read it's references in GLAutoDrawable carefully.

~Sven


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

Re: painting on demand and continuously in a GLCanvas

gouessej
Administrator
Sven Gothel wrote
.. or could simply call pause() and resume() to trigger the 'on demand',
as you wish.
Excellent idea, it is more simple than implementing another animator.
Julien Gouesse | Personal blog | Website
don
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

don
In reply to this post by Sven Gothel
Thank you for reply, But  I have to apply both method in each canvas, it means that in first canvas there is a contour plot (paint on demand) and also a dragging point (paint continuously) the same for the second canvas.
If I use pause() it prevents to show the dragging point by mouse until it resume()?????
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

Sven Gothel
Administrator
On 03/14/2013 10:48 AM, don [via jogamp] wrote:
> Thank you for reply, But  I have to apply both method in each canvas, it means
> that in first canvas there is a contour plot (paint on demand) and also a
> dragging point (paint continuously) the same for the second canvas.
> If I use pause() it prevents to show the dragging point by mouse until it
> resume()?????

use 2 Animators ..

~Sven



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

Re: painting on demand and continuously in a GLCanvas

gouessej
Administrator
In reply to this post by don
You can modify your drawing code to draw the plot once, store it in a texture or use a FBO and display this texture in order to avoid continuously performing the rendering of the plot when it hasn't changed. Use GLOffscreenAutoDrawable. You can't use 2 animators as each canvas contains elements painted continuously and elements painted on demand.
Julien Gouesse | Personal blog | Website
don
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

don
In reply to this post by Sven Gothel
You mean that two animators for each canvas it means four animators for my program?
Is it possible in Java? It is my first project which I use Java.
don
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

don
In reply to this post by gouessej
I do not how to do that =( could you please introduce me a site or a similar example code?
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

gouessej
Administrator
Please look at the Java documentation of JOGL. You can simply draw your plot on a GLOffscreenAutodrawable, it's just another drawable, there is nothing fancy. I think that there is an example using it on the Github repository.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

gouessej
Administrator
In reply to this post by don
You can look at this example.
Julien Gouesse | Personal blog | Website
don
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

don
This post was updated on .
is it related to JOGL 2 because I am working with JOGL 1? there is no GLOffscreenAutoDrawable in its package?
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

gouessej
Administrator
Yes, you have to switch to JOGL 2.0 if you want to use GLOffscreenAutoDrawable.
Julien Gouesse | Personal blog | Website
don
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

don
is there another way in JOGL 1?
Reply | Threaded
Open this post in threaded view
|

Re: painting on demand and continuously in a GLCanvas

gouessej
Administrator
There is no trivial way to do the same thing in JOGL 1. This class allows to manipulate pixmaps, pbuffers and FBOs very easily. Don't expect to get lots of advises on how to use JOGL 1. You should really switch to JOGL 2, it isn't very difficult and it will be less risky than sticking to JOGL 1. If you find a major bug in JOGL 1, we won't be able to help you.
Julien Gouesse | Personal blog | Website