|
|
My goal is to obtain a speed of 15/20fps running about 10,000 polys.
Depending on the level of compatibility you're targeting (for instance, if you wanted your program to run as an applet and work in as many browsers as possible, and/or on as many operating systems, etc.) you may need to restrict your use of Java class libraries to those which are Java 1.0 compatible... Like the Java 1.0 event model, etc. The reason I bring this up with regard to framerate, is because the standard way of getting custom-rendered pixels onto the screen in Java is, in my experience so far, very very slow.
If you were rendering into a 640x480 buffer for example, the best you can hope for, from what I've seen, is in the 15/20fps range just for copying the pixels to the screen! And that was using the technique TinyPTC uses in Java of making itself the ImageProducer (which is about as "low level" as you can get in AWT to my knowledge, at least for Java 1.0 compatibility.)
[Note, my machine is not the fastest thing around these days, a mere 300MHz PII... so Your Framerate May Vary :)]
So the point here was really intended to get at two things, I guess. One, that there may be a faster way to get pixels on the screen in some of the newer Java APIs, like Java 2D - I haven't investigated it yet because in my case I needed Java 1.0 compatibility anyway...
But also, that if you ARE using standard AWT stuff to get your pixels on the screen, and you're looking for a peppy framerate, well, to borrow a line from the Princess Bride, "...get used to disappointment." ;-)
I have a little test applet at:
http://www.foosenblat.org/ftp/java/testpix/test.html
It is just the TinyPTC example code, with some stuff added to measure the framerate, and blitting into a larger window (512x450).
(The code is in the testpix/ directory.)
So, the ugly part is, the code that renders the "static" into the buffer, can actually do its job at about 120fps on my machine. But just copying those pixels into the window drops the framerate to 15fps. !!!
Okay... just wanted to warn you where the major framerate bottleneck seems to be in Java - but if you or anyone has experience to the contrary I'd certainly love to hear it!
Anyway, best of luck with your project,
Bill
|