- Online Community Forums » Programming Questions » Drawing bitmaps to screen causes massive performance issues [A5]

This thread is locked; no one can reply to it. rss feed Print
Drawing bitmaps to screen causes massive performance issues [A5]
Member #13,589
October 2011

Hi all,

I am creating a version of Rally X, I have a grid of squares which represents the map. Each block can be represented by a specific element. When I started, I was drawing using only primitive routines, straight to the display. I then changed it so I created bitmaps per element in the game. I create and initialise these bitmaps in the class constructor which handles all things graphical. When I draw to the screen, I use al_set_target_bitmap(element pointer,x,y,0) each time an object is drawn. I pass the display pointer to the drawing class. This has caused major performance issues compared to drawing all primitives to the screen. The area being drawn is a small section of the larger map, probably a quarter of the screen.

Why is there such a change in performance? Should I be drawing each smaller block element to another larger bitmap and then displaying that on the screen....

Many thanks in advance.

Trent Gamblin
Member #261
April 2000

stvnlvtt said:

al_set_target_bitmap(element pointer,x,y,0)

I guess you meant al_draw_bitmap. When drawing tilemaps I strongly recommend storing all of the tiles in the same bitmap, creating subbitmaps, and calling al_hold_bitmap_drawing(true) before drawing all of the tiles (with no other bitmaps or fonts or anything drawn). Then call al_hold_bitmap_drawing(false).

Go to: