|
What is the fastest way to draw a large bitmap? |
EatDaPewPew
Member #16,739
September 2017
|
I am making a game where you can scroll around a bitmap. I can play it fine on my i7 computer just fine up to a certain size. Then things get really slow. I have tried to get it running on a raspberry pi, but it is too slow to be playable even on the smallest size of bitmap. I have tried using a function called al_hold_bitmap_drawing() when I draw the large scrollable bitmap, but it only helped slightly. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
If you're going to need a large tile map (that is too big to be a video bitmap), then you're going to need to break it up into individual textures. Find the max texture size and create as many textures that size as you need to cover the tile or background map. EDIT int NTWIDE = map->W()/MaxTextureWidth() + (map->W()%MaxTextureWidth())?1:0; int NTTALL = map->H()/MaxTextureHeight() + (map->H()%MaxTextureHeight())?1:0; Texture* TEXARRAY = new Texture[NTWIDE*NTTALL]; for each TEX in TEXARRAY : BLIT(MAP , x , y , MaxTextureWidth() , MaxTextureHeight() , TEX , 0 , 0 , MaxTextureWidth() , MaxTextureHeight())
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
beoran
Member #12,636
March 2011
|
Use al_get_display_option with ALLEGRO_MAX_BITMAP_SIZE as the option parameter to see how big a hardware accelerated bitmap may be. |
|