Archived

This topic is now archived and is closed to further replies.

Best blitting

This topic is 5823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it better to blit tiles to the video memory with many different video calls when constructing the frame, or blitting everything to a surface in ram and then send that surface to video memory with 1 call?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The optimal method is to create a backbuffer(or several backbuffers) within your video memory. This will in effect create 2 block of memory on your video card. One of them holds what is currently being displayed on the monitor, the other is the one you blot to. Once you''re done blitting you tell the video card to page flip. The video card then switches the display to the region you were just blitting to, and the region previously being displayed now becomes your backbuffer for the next frame.

Share this post


Link to post
Share on other sites
The first because blitting from system RAM to the graphics card has to go over the PCIbus (or AGP BUS) and it can''t handle all that data. A 640x480x32 bit color is 1228800 bytes of data per frame...

It''s alot easier to upload the textures/graphics to the graphics card once (at the beginning), then send it many "draw this texture here" calls to it. Because those simple commands only take like 80 bytes of memory per call. Yes, the first time you upload textures will be slow, but thats the first second the game is running.

The time it starts to go slower is when you have more than 15360 (polygons / commands) * 80 bytes = the same data as blitting a big picture from RAM over it.

I''m sure if you are tiling, it won''t be 15360 squares on the screen you are blitting, maybe 100-500 or so. =) so it diffiently will be faster using the first.

Share this post


Link to post
Share on other sites