 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
gno Guest
|
Posted: Thu Nov 02, 2006 8:23 pm Post subject: Graphics applet blinks on fast processors |
|
|
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
|
Posted: Fri Nov 03, 2006 4:24 pm Post subject: Re: Graphics applet blinks on fast processors |
|
|
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
|
Posted: Tue Nov 21, 2006 9:33 pm Post subject: Re: Graphics applet blinks on fast processors |
|
|
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 |
|
 |
|
|
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
|
|