jonjava - he says he is using Slick2D, not Java2D.
In OpenGL you generally don’t modify texture data per-pixel in real time; instead, you modify pixels as they are rasterized by GL. The former requires copying data between CPU and GPU (very slow), whereas the latter is done all on GPU (very fast).
Instead of modifying textures per-pixel, you might get faster speeds by drawing rectangles. The problem is that Slick doesn’t batch calls to g.fillRect, so using it many times per frame can create a bottleneck. Instead, you might have better luck with using an Image to create an opaque coloured rectangle. So it might look like this:
//pack a small opaque white area into your sprite sheet,
//e.g. 1x1 white pixel with nearest filtering
//or a larger area with bilinear filtering
//get the sub-image of the white pixel
Image whitePixel = spriteSheet.getSubImage(...);
...
//now in your render loop, draw many rectangles like so:
spriteSheet.startUse();
//... draw your other sprites from this sheet using drawEmbedded ... //
//now bind the color you want your filled rectangles to be, e.g. black or whatever
rectColor.bind();
for ( each filled rectangle ) {
//draw the filled rectangle
whitePixel.drawEmbedded(x, y, width, height);
}
//end the sprite sheet
spriteSheet.endUse();
I also described the technique here (for a different library):
For more info on drawEmbedded:
http://slick.cokeandcode.com/wiki/doku.php?id=performance_memory_tips
If you want to try modifying a texture per-pixel (and deal with the performance problems of copying data from CPU to GPU), check out this page:
http://slick.cokeandcode.com/wiki/doku.php?id=per-pixel_manipulation:pixeldata_utility
If you are more interested in the GPU approach, you might have some luck from shaders:
http://slick.cokeandcode.com/wiki/doku.php?id=shaders