• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Slow g.paint() ?

 
Mike Cole
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

i have a quick question. Ive made a prog. which displays some gfx. Iam using Graphics2D for that. First i had a class which was holding all BufferedImages in an array and i used a loop to paint(g.drawImage(...)) all these.
But then i decided to change that and instead of BufferedImages i made a sprite class which holds the buffered image. So now iam looping over an array of sprites and call each sprites own "paint"(g.drawImage(...)) function.
The problem is it is extremly slower than the first version. Frames dropped from over 200 to 32, just by this small change! Is that normal or is it possible that i made a mistake???

thank you
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That drop in performance sounds at least suspicious. Hard to say more without seeing some of the code...
 
Mike Cole
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will post the code here as soon as iam home.
Is there a special part of interesst or shall i just post the two classes?

thank you.
 
Mike Cole
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay, i found it out. The problem was that the BufferedImages in the Sprite-Class were not accelerated. After i constructed the image with the gfxConfiguration everything went fine.

but.. Thanks anyway!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic