Note that there are some explanatory texts on larger screens.

plurals
  1. POSlow Java2D Drawing on Integrated Graphics
    primarykey
    data
    text
    <p>I'm working on a simple 2D game, rendering via the Java2D API. I've noticed that when I try to draw on integrated graphics card the performance crashes.</p> <p>I've tested this game on both my main rig with a newer ATI Radeon and my 5 year old laptop which also has an (incredibly antiquated) Radeon. On both I get good FPS, but when I try to use my Intel i5's onboard HD 4000 graphics, it crawls at around 20 FPS.</p> <p>I'm using Full Screen Exclusive mode.</p> <p>At any given moment, I am rendering approximately 1000 images at once.</p> <p>Annoyingly, when I try to getAvailableAcceleratedMemory() it just returns -1 for this card, and it seems to refuse to accelerate any images.</p> <p>Does anyone have any ideas how to fix this issue?</p> <p>Rendering code:</p> <pre><code> Graphics g = bufferStrategy.getDrawGraphics(); g.drawImage(img, x, y, img.getWidth(), img.getHeight(), null) g.dispose(); bufferStrategy.show(); </code></pre> <p>Image Loading code:</p> <pre><code> BufferedImage I = null; I = ImageIO.read(new File(currentFolder+imgPath)); imgMap.put(imgIdentifier, I); </code></pre> <p>The images are stored in a hashmap of BufferedImages identified by strings, so when an entity needs to draw and image it just gets it out of the hashmap and draws it. In the current case, the entities are mostly floor and wall tiles, so they never change (and thus don't have to get the image from the hashmap other than the very first time).</p> <p>EDIT - I've incorporated MadProgrammer's method, but it didn't change my FPS.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload