When I found this article
https://wiki.allegro.cc/index.php?title=Achieving_Resolution_Independence
I tested both approaches - using a stretched buffer and using transformations - in a simple test program that draws a line and shows an image. I noticed a difference in image quality of the results (see attachement). When using transformations the edges look quite a bit smoother compared to the result using a stretched buffer. Any ideas?
As the article says, transformation is best if your game mostly uses primitives (lines, rectangles...)
From looking a screenshot you may think it's also better visual quality for sprite, but in an actual game it will cause graphical artifacts which are sometimes jarring.
The issue accurs when several sprite bitmaps are supposed to be exactly side-to-side (sokoban player pushing a crate) or overlayed ("damaged variant" of a building, landscape composed of several layered images...) There will be a 1-pixel inaccuracy, and it's very visible if things are scrolling/rotating/zooming as the elements will "float" within a 1-pixel distance of the ideal position, instead of staying stuck together.
Stretched buffer doesn't have this issue because integers match exactly the coordinates and sizes of elements in the original referential, so the computations are pixel-perfect.
3D rendering systems don't have this issue because the system will keep track of all coordinates with decimal precision, and takes the entire scene into account when rasterizing.
You might want to try adding al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR) for scaling your sprite. It will make it look immensely better imho.
Edgar, I tried adding these flags, however, the image looks more blurry then but not as nice as with the transformation (see attachement #2). Maybe there is a hidden filter applied when transformations are used?
Audric, I did not know that. In fact I found for example this thread where it sounds like people actually prefer transformations over a stretched buffer because it is less GPU/memory intense because the GPU will do scaling anyway. But if you say that this could yield in a 1-pixel inaccuracy this would be a big disadvantage (at least for me)
If you like the pixelated look that's fine just don't use Allegro mag linear
OK guys thanks for your help. I found that pixel inaccuracy may occur indeed (see attachment #3) when using transformation (especially non-integer scaling) so I think I'm gonna stick with the stretched buffer...
Transformations only affect the underlying data. If your vertices are off, there's nothing you can do. There should not be a conflict between using transformations and drawing textures. How do you think all those 3D games are super seam less and all that? There's something else going on.
EDIT
I seem to recall that al_draw_scaled_bitmap uses a transform underneath it all anyway, so you're doing the exact same thing.
OK this makes sense indeed...
I'll try to figure out where that 'inaccuracy' may come from...