Hi, I'm working on a game for a homework assignment. We are a group of 4 and basicly got the game running now, but we got issues with the rendering/drawing.
I use BufferStrategy to get double buffering, and i have a custom draw-loop in a canvas. What this does is that it sends a Graphics2D object to the gameObjectHandler who send the graphics2D to the objects who need to be draw. These objects then use the g2D like this:
public void draw(Graphics2D g2d)
{
g2d.drawImage(_owner.getGraphicsHolder().getImage(), (int)(_position.getX()-_size/2-300), (int)(_position.getY()-_size/2-300), (int)_size+600,(int)_size+600, null);
}
The _owner is a class that owns the gameobject. Each player got its own graphicsHolder that contains currently 5 Images that is generated upon startup with BufferedImage and RescaleOp to tint a PNG image.
The strange issues i have is that i get framerate-dips from time to time. I have tracked down what is causing this framerate dip, and it is the draw-method you see above. It usually draw at a constant 60 fps, but sometimes a single object uses about 0,042 seconds to draw.
There is this other really strange thing going on. I get memory heap space issues when the game is running on a computer with ATI cards. This makes no sense at all because one of the people working on this game has got a pretty beefy ati card with 1Gb of video ram, and he has 4GB regular ram.
How can this be? is there some fundemental thing that i have yet to understand about java2D?
Thanks for the help! :)