We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
loadImage (Read 1964 times)
loadImage
Sep 6th, 2005, 3:04am
 
in the documentation for loadImage, under description, it says:

"Loading images in draw() can dramatically reduce the speed of a program. "

Doing this gives me 70 fps

however loading images in setup instead gives me 99.99 fps.

misquote?

====
also just before this sentence there is a minor typo:
"In most cases, load all images in setup() to preload them with the program starts."

should be ". . .when the program starts"
Re: loadImage
Reply #1 - Sep 6th, 2005, 5:45am
 
Besides the grammar, the reference is absolutely right.

You don't want to be loading images on run-time, especially if it's directly inside loop.

Imagine where you're playing a game and every frame it's trying to draw is trying to read a giant tif file on your hard drive. Yes. This will kill performance.
Re: loadImage
Reply #2 - Oct 4th, 2005, 10:39am
 
Well I am doing this at 15 fps to load image in that holds some analysed data coded with colors...works fine, better then sending huge amounts of data via socket Wink

But there is another issue regarding loadImage in the reference, I think we should mention that its possible to load PNGs!

Re: loadImage
Reply #3 - Oct 4th, 2005, 11:26pm
 
beachmeat wrote on Oct 4th, 2005, 10:39am:
But there is another issue regarding loadImage in the reference, I think we should mention that its possible to load PNGs!

no, not consistently.. depends on the version of your java vm so it's strongly discouraged. i'm not sure when sun added this (but if anyone cares to look it up, that'd be great.. my guess is java 1.4 or later).
Re: loadImage
Reply #4 - Oct 6th, 2005, 6:17pm
 
It was 1.3:
http://java.sun.com/j2se/1.3/docs/guide/2d/new_features.html

I am actually very happy with it Smiley
Re: loadImage
Reply #5 - Oct 6th, 2005, 6:32pm
 
interesting.. one more reason to perhaps cut the java 1.1 support cord and make 1.3 our baseline permanently...
Re: loadImage
Reply #6 - Oct 7th, 2005, 12:37am
 
I have a Java 1.1 compatible png loader, if such is wanted.

Marcello
Page Index Toggle Pages: 1