0

I wrote a Java color buffer class that contains a 2D float array, which is the buffer. Now I want to exchange the buffer from the BufferStrategy of my JFrame/Canvas with my buffer. I did this by drawing each pixel of the buffer to the screen using drawLine:

public void exchangeBuffers(Graphics g) {
    for (int i = 0; i < width; i++)
        for (int j = 0; j < width; j++)
            g.drawLine(i, j, i, j);
}

Now is there a better way of doing this? The performance is really low using this.

0 Answers0