I am doing an application-infinitely rotating 3D cylinder in
openGl.The speed varies with finger touch but wen i reduce the
speed,i
can see  flickering happening in animation towards right and
left.Initialy I thought it is because of the linked list im updating
but found out there is no such problem with my linked list .I'm using
a thread here for a small delay after each 30 degree rotation
drawing.I cant do it widout the thread coz i need a sleep or a delay
after each 30 degree drawing,if i remove the thread and implement the
code in thread inside my onDraw frame, the curvature rotation itself
goes and it appears that images are just left shifting n right
shifting coz the sleep is not getting identified in onDraw frame.So i
cant implement my logic here widout using thread..so thread is a must
in my logic but i guess the flickering is due to my thread...Is the
flickering issue during animation because of the thread?please do
help
me with this flickering issue......dis is d thread part im using in
my
code.........
Runnable r1=new Runnable()
                {
                        //Thread t1=new Thread(r1);
                        //t1.start();

                        public void run()
                        {
                                //t1.start();
                                while(true){


                                        if(rotateFlagRight)
                                         {
                                                mRenderer.rotationFlag
= 1;
                                                //
System.out.println("positive value of dx...."+dx);


                                                for(int i=0;i<=30;i+
+)
                                                {
                                                mRenderer.mAngleXX=
i;
                                                        if ((dx>10)&&
(dx<50))
                                                        {
                                                                try {
 
Thread.sleep(100);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        else if
((dx>50)&& (dx<100))
                                                        {
                                                                try {
 
Thread.sleep(10);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        else if
((dx>100)&& (dx<150))
                                                   {
                                                                try {
 
Thread.sleep(8);
                                                                        }
catch (InterruptedException e1) {}
                                                   }
                                                        else if
((dx>150)&& (dx<200))
                                                   {
                                                                try {
 
Thread.sleep(7);
                                                                        }
catch (InterruptedException e1) {}
                                                   }
                                                        else if
((dx>200)&& (dx<250))
                                                  {
                                                                try {
 
Thread.sleep(5);
                                                                        }
catch (InterruptedException e1) {}
                                                  }
                                                        else if
((dx>250)&& (dx<300))
                                                  {
                                                                try {
 
Thread.sleep(4);
                                                                        }
catch (InterruptedException e1) {}
                                                  }
                                                        else if
((dx>300)&& (dx<350))
                                                  {
                                                                try {
 
Thread.sleep(3);
                                                            } catch
(InterruptedException e1) {}
                                                  }
                                                        else if
((dx>350))
                                                  {
                                                                try {
 
Thread.sleep(2);
                                                                        }
catch (InterruptedException e1) {}
                                                  }
                                                }


                                                mRenderer.
listPhotos();
 
mRenderer.rotationFlag=0;
                                        }
                                        if(rotateFlagLeft)
                                        {
                                                //if(rotateFlagLeft)
                                                mRenderer.rotationFlag
= 2;
                                                //
System.out.println("Negative value of dx...."+dx);
                                                for(int
i=0;i>=-30;i--)
                                                {
 
mRenderer.mAngleXX= i;
                                                        if
((dx<-350))
                                                        {
                                                                try {
 
Thread.sleep(2);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        if ((dx<-300)
&& (dx>-350))
                                                        {
                                                                try {
 
Thread.sleep(3);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        if ((dx<-250)
&& (dx>-300))
                                                        {
                                                                try {
 
Thread.sleep(4);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        if ((dx<-200)
&& (dx>-250))
                                                        {
                                                                try {
 
Thread.sleep(5);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        if ((dx<-150)
&& (dx>-200))
                                                        {
                                                                try {
 
Thread.sleep(7);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        else if
((dx<-100)&&(dx>-150))
                                                        {
                                                                try {
 
Thread.sleep(8);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        else if
((dx<-50)&&(dx>-100))
                                                        {
                                                                try {
 
Thread.sleep(10);
                                                                        }
catch (InterruptedException e1) {}
                                                        }
                                                        else if
((dx<-10)&&(dx>-50))
                                                        {
                                                                try {
 
Thread.sleep(100);
                                                                        }
catch (InterruptedException e1) {}
                                                        }


                                                }
                                                        //}
 
mRenderer.listPhotos();
 
mRenderer.rotationFlag=0;


                                                                //
continue;


                                        }
                                        if(!rotateFlagLeft){
                                                 if(!rotateFlagRight)
                                                 {
                                                rotateFlagLeft=false;
 
rotateFlagRight=false;
                                                 }


                                        }
                                }
                        }
                        };
please do help me to reduce the flickering.Thanks in advance
Tina


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to