Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Smooth running applet

Reply
Thread Tools

Re: Smooth running applet

 
 
Karl von Laudermann
Guest
Posts: n/a
 
      07-02-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (dr) wrote in message news:<(E-Mail Removed). com>...
> Hello,
>
> I'm writing an animated applet, which I want to run smoothly in the
> browser. The way I do it now is to draw on a buffered java.awt.Image,
> copy the image to the screen and then make the thread go to sleep for
> some specified time.


I would think it would be easier and probably more reliable to use
java.swing.Timer to control animations, rather than using thread sleep
directly.

> > Two problems arise,

>
> I) The animation is not synchronized with the monitor refresh rate.


How fast are you planning to animate? There's no reason to go faster
than 60 fps, because the human eye won't notice any improvement beyond
that. And AFAIK all monitors have a *minimum* refresh rate of 60 Hz,
so there shouldn't be any problem here. You'd only care about monitor
synchronization if the refresh rate were lower than your animation
speed, because then you'd get dropped frames.

> II) The animation works fine on my machine, but might not do so on
> your machine.


Um, how so? One can't offer a solution without knowing what the actual
problem is. How do you anticipate the behavior to differ on a another
machine?
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      07-02-2003
On 2 Jul 2003 06:45:06 -0700, (E-Mail Removed) (Karl von Laudermann)
wrote or quoted :

>How fast are you planning to animate? There's no reason to go faster
>than 60 fps, because the human eye won't notice any improvement beyond
>that


movies are only 24.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
 
Karl von Laudermann
Guest
Posts: n/a
 
      07-03-2003
Tim Tyler <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> The synchronising of redraws with the monitor refresh prevents
> animations "ripping" - and it does that at any frame rate.
>
> The idea is to update your animation when the scan is *not*
> on top of what is being animated - thereby preventing the flicker
> and glitches caused by undrawn and half-redrawn images being
> presented to the user.
>
> It is a common issue for games programmers using Java.


Ah, I hadn't thought of that. Still, at monitor refresh rates of 60 Hz
and higher, would the human eye even notice if one frame were
partially updated?
 
Reply With Quote
 
Tim Tyler
Guest
Posts: n/a
 
      07-04-2003
Karl von Laudermann <(E-Mail Removed)> wrote:
: Tim Tyler <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...

:> The synchronising of redraws with the monitor refresh prevents
:> animations "ripping" - and it does that at any frame rate.
:>
:> The idea is to update your animation when the scan is *not*
:> on top of what is being animated - thereby preventing the flicker
:> and glitches caused by undrawn and half-redrawn images being
:> presented to the user.
:>
:> It is a common issue for games programmers using Java.

: Ah, I hadn't thought of that. Still, at monitor refresh rates of 60 Hz
: and higher, would the human eye even notice if one frame were
: partially updated?

If it was just one frame then probably not.

However animations don't last for just one frame.

For me, the biggest problems are noticable when scrolling the screen.

The problem produces a "step" in any vertical walls scrolling horizontally.

The position of the step varies according to the update rate - it might
appear randomly flickering up and down the wall's surface - or it might
appear fixed at one location - if your update rate matched the refresh
rate of the monitor. In that case there would be a persitent redraw
glitch maintained at approximately the same point for seconds at a time.

Recalling when I could scroll the screen instantaneously - using the
BBC's VIDC hardware - and synchronise with the monitor refresh rate
so the discontinuity was guaranteed to happen during "flyback" I can
testify that the effect was *much* slicker than is possible today
using Java.

I have written a scrolling game in Java: http://rockz.co.uk/

It is about as good as anything at illustrating the effect.
--
__________
|im |yler http://timtyler.org/ (E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent.... Smooth Refresh Bryan Young ASP .Net 5 01-25-2005 07:39 PM
Swing missing smooth fonts in Linux Steve Horsley Java 0 02-06-2004 08:48 PM
icc profile for Ilford smooth glossy paper peter Digital Photography 2 09-24-2003 08:14 PM
Re: Smooth running applet Roedy Green Java 0 07-02-2003 02:26 PM
Re: Smooth running applet Tim Tyler Java 0 07-02-2003 01:02 PM



Advertisments