AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Graphics applet blinks on fast processors

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> 3D Graphics API's for Java
View previous topic :: View next topic  
Author Message
gno
Guest





PostPosted: Thu Nov 02, 2006 8:23 pm    Post subject: Graphics applet blinks on fast processors Reply with quote



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.
Back to top
Inácio Ferrarini
Guest





PostPosted: Fri Nov 03, 2006 4:24 pm    Post subject: Re: Graphics applet blinks on fast processors Reply with quote



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.

gno wrote:
Quote:
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.
Back to top
chickenf
Guest





PostPosted: Tue Nov 21, 2006 9:33 pm    Post subject: Re: Graphics applet blinks on fast processors Reply with quote



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

Quote:
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:
Quote:
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.

gno wrote:
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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> 3D Graphics API's for Java All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.