In order to minimize the amount of texture graphics I need to load, I was wondering how costly it would be to blit, for example, four (4) line segments together to form a square, like this:
buffer.blit(frameMap, frameXPos, frameYPos, xCoord, yCoord, frameWidth, 1, FrameBuffer.OPAQUE_BLITTING);
buffer.blit(frameMap, frameXPos, frameYPos, xCoord, yCoord+frameHeight, frameWidth, 1, FrameBuffer.OPAQUE_BLITTING);
buffer.blit(frameMap, frameXPos, frameYPos, xCoord, yCoord, 1, frameHeight,FrameBuffer.OPAQUE_BLITTING);
buffer.blit(frameMap, frameXPos, frameYPos, xCoord+frameWidth, yCoord, 1, frameHeight, FrameBuffer.OPAQUE_BLITTING);
Insted of blitting the square as a whole texture, like this:
buffer.blit(frameMap, frameXPos, frameYPos, xCoord, yCoord, frameHeight, frameHeight, FrameBuffer.TRANSPARENT_BLITTING);
When does the performance become noticable? In the extreme, I'd also be able to blit one pixel at a time from a loaded texture to draw a line, right? Would that be excessive? The way I see it it's a matter of trade off between performance and memory usage since minimizing the number of blit calls means that you need more specific texture graphics and therefore more memory. Please tell me if I'm way off on this :oops:
That first post was mine :) Didn't notice that I wasn't logged in :oops:
I've done similar research, check it out here:
http://www.jpct.net/forum/viewtopic.php?p=2177
With latest JPCT changes, blitting lots of small components doesnt hurts performance badly, and therefor can be used as it is more convenient than generating/uploading texture every time component changes.
Quote from: "Anonymous"In the extreme, I'd also be able to blit one pixel at a time from a loaded texture to draw a line, right? Would that be excessive?
Yes, that sounds excessive. Rolz is right that the version that i posted in the mentioned thread improves blitting performance, but blitting a line by setting single pixels sounds a bit too much to me.
Ok, thank-you for the feedback :mrgreen: