Nobody knows ? Nobody has the same problem ?
[Message sent by forum member 'karys' (karys)]
http://forums.java.net/jive/thread.jspa?messageID=301487
===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
A better optimized solution would be to look up for
the right color in setRGB depending on the angle of
the currently drawn pixel - this way you draw the
circle only once, altering the color is bascially
free :)
I modified the setRGB() method of your program as follows to get my optimized
You don't need a BufferStrategy or VolatileImage unless you are doing live
animation. It was hard to tell from your message if that was the case.
I usually use a BufferedImage that you get from createCompatibleImage and draw
using Java2D to the graphics context you get from it. When the plot
Use the Canvas if you need hardware double-buffering badly enough that you're
willing to deal with the Z-ordering issues that you get from mixing Swing and
AWT widgets. Otherwise, use a JPanel. You cannot use a Canvas inside of a
JScrollPane, for one thing.
Rendering outside of the event
Do you get reasonable animation with this method?
How many frames a second do you get using invokeLater()?
[EMAIL PROTECTED] wrote:
You don't need a BufferStrategy or VolatileImage unless you are doing live
animation. It was hard to tell from your message if that was the case.
I usually use
Is there an alternate, faster way to do the maths?
The problem here is Math.round and Math.atan2, the Math class is optimized for
high precission but often sacrifices speed.
Your original version took 205ms on my C2D, replacing atan2 with this unprecise
version and removing the round braught
Looking at some BufferStrategy examples, it seems that the pattern is to do
rendering in a timed loop, something like this:
[code]
// Render loop
while (!done) {
Graphics g = strategy.getDrawGraphics();
render(g);
g.dispose();
strategy.show();
try {
Thread.sleep(100);
}
I recommend using something similar to the Foxtrot API. It is not recommended
to perform time intensive processes in the event queue.
[Message sent by forum member 'bcorbett8769' (bcorbett8769)]
http://forums.java.net/jive/thread.jspa?messageID=301665
I'm starting think my problem is knowing what solution applies to my situation.
There are plenty of solutions for handling long-running tasks in Swing.
(SwingWorker, etc.) There are solutions for double buffering for animations
(BufferStrategy). But, I don't think either of those apply to
Well, lets clarify/assume a few things.
You have some data source, constantly producing data, right? While that data
source happily produces data the user is also looking at a representation of
that data, right? And the user can interactively select (scrolling, zooming)
which portion of the
YES! Why not FPU acceleration? That's what it's there for.
Er... is StrictMath already FPU accelerated? If it is then, oh well...
The current Math package is really not very good. Especially
for low level graphics stuff where 5 significant digits is
the minimum accuracy that is useful.
11 matches
Mail list logo