Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Java 3D / November 2006

Tip: Looking for answers? Try searching our database.

Graphics applet blinks on fast processors

Thread view: 
gno - 02 Nov 2006 15:23 GMT
I have made a graphics Java applet that shows a moving fractal.  I made
it in a computer with a 1GHz processor.  In this processor the applet
runs smoothly without any blinking.

The problem is that in new machines with faster processors the moving
object blinks in a slightly annoying way.

How could I make it not blink at any processor speed?

(I intend also to preserve the motion speed of the object to be always
the same on any processor.)

You can find the applet (source included) at:

http://josechu.com/moving_fractal/

I'm not sure, but perhaps the key to fix this problem is at this
portion of code:

public void run() {
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
        while (true) {
            try {
                Thread.sleep(44);
            } catch (InterruptedException ex) {
            }
            Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
            repaint();
        }
    }

Any suggestion will be welcome.
Inácio Ferrarini - 03 Nov 2006 11:24 GMT
Hi there.

I am not an expert on GC and I am used to JOGL, but, in general,
flickering and blinking are related to refreshing rate, or, to things
related to refreshing.
Are you using double-buffering?
Maybe you should try a different approach in the code? something like

 public void run() {
      while (true) {
             try {
                  Thread.sleep(44);
                  repaint();
                  Thread.sleep(60);
             } catch (InterruptedException ex) {
             }
       }
 }

Maybe the MAX_PRIORITY to a fast processor is too fast ...

Hope I helped,

- Inácio Ferrarini.

> I have made a graphics Java applet that shows a moving fractal.  I made
> it in a computer with a 1GHz processor.  In this processor the applet
[quoted text clipped - 28 lines]
>
> Any suggestion will be welcome.
chickenf - 21 Nov 2006 15:33 GMT
Hi,

Java3d is always trying to force the maximum refresh rate possible,
taking 100% CPU for animations.
To get a refreshing rate independant of your hardware, you might want
to try the setMinimumFrameCycleTime(long minimumTime) of
javax.media.j3d.View

>From Javadoc:
"Sets the minimum frame cycle time, in milliseconds, for this view. The
Java 3D renderer will ensure that the time between the start of each
successive frame is at least the specified number of milliseconds. The
default value is 0."

Regards,

chickenf

On Nov 3, 11:24 am, "Inácio Ferrarini" <inacio.ferrar...@gmail.com>
wrote:
> Hi there.
>
[quoted text clipped - 53 lines]
>
> > Any suggestion will be welcome.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.