Image Load and subsequent render speed

I have a ton of 1 and 2k images that are loaded at startup for GT6 and when rendering any number of them, I get about 40-43 fps ( windows:) ).

When I travel to sector 5, there is a large green planet that is an 11k gif. Once you fly enough to bring it into view, my fps drops to the mid 20’s until I leave that sector altogether.

I use toolket.getImage for loading all of my images. I went back and loaded the green planet with imageIO jsut to check and it still renders dog slow.

Any thoughts?

Are they meant to be accelerated images? ImageIO doesn’t look accelerated images (yet) apparantly. So you’d need to createCompatibleImage() to create an accelerated image, draw the loaded image into it, then use that to render to the screen.

Kev

Thanks!

here is my new code for loading that planet, after getting the graphics config from the jframe. I load the image from toolit or io, then pass that image to the following method. Eventually I need to clean up my ImageManager class :slight_smile:

      public static BufferedImage loadImage(Image in) {
            //BufferedImage dst = new BufferedImage(in.getWidth(null), in.getHeight(null), Transparency.BITMASK);        
            BufferedImage dst = gc.createCompatibleImage(in.getWidth(null), in.getHeight(null), Transparency.BITMASK);        
            Graphics2D g2d = dst.createGraphics();       
            g2d.drawImage(in,0,0,null);        
            g2d.dispose();        
            return dst;       
      }

I still get a sudden slowdown when the planet comes in to view.

[quote] I have a ton of 1 and 2k images
[/quote]
How many is ‘a ton’?
enough to use all the available vram?
causing the planet image to be not cached in vram?

Your fps in general sounds abit poo tbh, (on my machine[athlon 1.33 GF2gts] I can render around 5000 images @ 40fps)
are you simply running on a dog slow machine, or is there something more fundamentally wrong with your image managment.

On an athlon 1.1, 512 ram with a gf2. Actually about 34 total images with somewhere around 20-30 instances of images on the screen at a high end. I have set my “sleep” to give me about 60 fps. May be both Image management and game loop, either way the planet really drops things.

It could be that it stutters when you’re rendering a bunch of freshly loaded (and thus not yet accelerated) images to your backbuffer: the first copy of managed image to accelerated is done via software loop. The next tiime around they get accelerated, and it works fine.

Try running your app with this property set:
-Dsun.java2d.acelthreshold=0

no change. I need to truly revisit my loop and image loading. When you start in an empty sector, and standing still…49-50 fps. Start moving…and I get my 40-43 fps average. Hit that dang planet and poof…mid 20’s.

I’ll poke around a bit and see what happens.

I have to have missed something…I have a tile rpg(similar to kevs) that has 300+ tiles, a few characters, etc., and renders at 60 fps consistantly.(set to 60 fps and using offScreen image as buffer, the old way)

I strolled thru your 4kshooter, Abuse, and you do much more math calcs and ping pongs thru the render and build a lot more buffered images than I do…my loop has to be poo. :slight_smile:

ok, now I am really confused. I went thru and rewrote my image manager to build all images using a call to the graphics config and buffered image to paint into an image. Entire system fps dropped from mid 40’s to mid 30’s. I replaced it with my old system…back to mid 40’s. Edited the planet gif to be only 4k instead of 11k and still dogs down when it appears on screen. It got loaded at startup into a static image so it can be used over and over.

Will keep at it!

FOUND IT!

It seems that I was getting a BI for my spae objects in order to properly rotate other player ships ont he screen(I am using Affine Transform—I know…yuck, but I wan the full 360) anyway…the following code really died on the planet image, even though it was not rotating, where shipPic is a prebuilt BI class.

      protected BufferedImage getShipPic() {
            dst = shipPic.getBaseBI();        
            g2d = dst.createGraphics();
            g2d.clearRect(0,0,width,height);
            if(facing != 0) {
                  AffineTransform at = new AffineTransform();
                  at.rotate(facing, width>>1, height>>1);
                  g2d.setTransform(at);           
             }       
            g2d.drawImage(image,0,0,null);        
            g2d.dispose();        
            return dst;      
      }

Thanks to all that helped. Now I only call that method if the opbject to be paint actually is an object that can rotate (other ships).