Search code examples
bitmaptileallegro5

How to repeat a bitmap with allegro 5


I have a 400x400 image which I need to tile in allegro 5. It will need to tile various sizes so I cannot simply create a larger image. However, a google search returned nothing about this, nor did a search on this site. Is there any way of doing this (like what you can do in DirectX/OpenGL with texture wrapping, clamping and reflecting) without drawing the image over and over again?


Solution

  • Both graphic APIs do that internally, but there is no "tiling" function included on Allegro so you have to implement your own.

    Render time impact will be almost non-existing since you will still be below the MILLIONS of triangles per second current cards can draw. As a bonus, you can use al_hold_bitmap_drawing(true) then draw the tiles you wish from the same bitmap to have even more framerate.