That's the way I do things. I do active rendering using BufferStrategy.
I turn off repaint() setIgnoreRepaint(true) while I'm active rendering and
then when I'm not active rendering and the applet is just sitting there,
I turn on repaint() with setIgnoreRepaint(false) so that if the applet
gets covered and then re-exposed, it repaints on the screen properly.
My paint() method looks a lot like my active rendering method with slight
differences in the implementation.
I think that way of drawing on the screen is great especially if you
need a high frame rate. Depending on the size of the screen area
rendered to, I can get a frame in less than 100 milliseconds on
my old, slow computer.
The tricky part is trying to get the "look and feel" of the applet
to be constant on computers with much faster graphics and processors.
I try to adjust the amount of drawing by calculating the average number
of frames per second and then adjusting the "movement" of the image.
Lot's of fussy details...
Dmitri Trembovetski wrote:
You can certainly use repaint() with VolatileImages as back buffers.
The alternative approach is called "active rendering", where you
control when stuff gets rendered.
Take a look at this:
http://java.sun.com/docs/books/tutorial/extra/fullscreen/rendering.html
While this is a "full screen" tutorial, the same applies for rendering
in windowed mode.
Also, I reiterate, it is better to use active rendering and
BufferStrategy
for double buffering, especially if your application is 'game-like'.
Thanks,
Dmitri
[EMAIL PROTECTED] wrote:
Hi Ken,
With VolitileImages, you should render directly from
your program by calling your own render method directly.
Don't call repaint().
I do use my own render method, but that method only renders on my
background volatile image. After that is finished I somehow have to
get my image onto the screen (or to be more precise on my panel).
Then, I assume, I have to call repaint() (of the panel) out of my own
render method, don't I?
Maik
[Message sent by forum member 'kiamur' (kiamur)]
http://forums.java.net/jive/thread.jspa?messageID=291577
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA2D-INTEREST". For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".