Author Topic: Blitting performance  (Read 4135 times)

Anonymous

  • Guest
Blitting performance
« on: February 10, 2006, 04:56:29 pm »
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:

Code: [Select]

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:

Code: [Select]

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:

Offline Mr.Marbles

  • int
  • **
  • Posts: 81
    • View Profile
Blitting performance
« Reply #1 on: February 10, 2006, 04:59:23 pm »
That first post was mine  :)  Didn't notice that I wasn't logged in  :oops:

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
Blitting performance
« Reply #2 on: February 11, 2006, 01:26:56 pm »
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.
Regards,
Andrei

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Blitting performance
« Reply #3 on: February 11, 2006, 06:20:03 pm »
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.

Offline Mr.Marbles

  • int
  • **
  • Posts: 81
    • View Profile
Blitting performance
« Reply #4 on: February 13, 2006, 01:45:42 pm »
Ok, thank-you for the feedback :mrgreen: