Friday, October 26, 2012

Re: AnimationScheduler.requestAnimationFrame example

Hi Alfredo,

Thank you for the code snippet, works as expected.
Also thank you for the issue related to cancel() method, I will keep that in mind.

-br
Arun


On Friday, 26 October 2012 17:37:09 UTC+1, Alfredo Quiroga-Villamil wrote:
Something along the lines of ... Notice the line under "Call it again."

                animation = AnimationScheduler.get().requestAnimationFrame(new
AnimationCallback() {
                        @Override
                        public void execute(double timestamp) {
                                        // Do some stuff here

                                        // Call it again.
                                        AnimationScheduler.get().requestAnimationFrame(this);
                                }
                        }
                });

Regards,

Alfredo

On Fri, Oct 26, 2012 at 8:43 AM, Arun <arunk.s...@gmail.com> wrote:
>
> Hi Everyone,
>
> I am beginning to learn WebGL development using GWT using gwtgl.
> I am not able to get the requestAnimationFrame working to render my scene regularly.
> Could someone please take a look at it and offer some advice?
>
> Code:
>
> Mygwtgl.java
> public class Mygwtgl implements EntryPoint, AnimationScheduler.AnimationCallback {
> ...
> private Redraw redraw;
>     private void start() {
> ...
> redraw = new Redraw();
> redraw.requestAnimationFrame(this);
> }
> public void execute(double timestamp) {
> drawScene();
> }
> }
>
> Redraw.java
> public class Redraw extends AnimationScheduler {
> private AnimationScheduler.AnimationHandle hAnimScheduler;
> public Redraw() {
> hAnimScheduler = new AnimationScheduler.AnimationHandle() {
> @Override
> public void cancel() {
> // TODO Auto-generated method stub
> }
> };
> }
> public AnimationScheduler.AnimationHandle requestAnimationFrame(AnimationScheduler.AnimationCallback cb, Element e) {
>
>                 // cb.execute() works here but only once, not getting scheduled regularly
>                 //
>
> return hAnimScheduler;
> }
> }
>
> I do not have much programming experience with java and I am not sure whether this is the correct way to use requestAnimationFrame().
> The callback doesn't seem to be scheduled,
> I really appreciate any advice in this regard.
>
> -br
> Arun
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.




--
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/D-coc4Vp2SkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment