2d rotation and scaling speed

BlitzMax Forums/BlitzMax Beginners Area/2d rotation and scaling speed

It depends on what your graphics hardware can do, but in general it is very fast.

Typically, I find that there is no difference in speed between drawing an image without rotation, and drawing it with rotation. The system will use matrices to work out where exactly the pixel should be, which includes handling any rotation, regardless of whether you position your image with no rotation or with some rotation.

I don't know if some graphics cards optimize so that when there is `no rotation` ie angle is 0, it draws even faster, but from my direct experienec it seems to be the same.

The same applies to scaling, albeit that with a larger scale factor things will obviously take more GPU time, or less with a lower scale.

With a screenfull of bouncing-around zooming-in-and out images, it didn't seem to make any difference to the speed to specify a rotation angle for every image.

You can also specify that your images will by `filtered` ie smoothed, so that when they scale or rotate they are sub-pixel accurate/antialiased, which is even nicer.

In Max you also automatically can apply a color tint to every image in realtime which has no additional cost, plus you can flip the image vertically or horizontally in realtime at no extra cost. Technically you can also rotate your images in 3D and have it be no slower, as well, but Max2D - Max's default 2d graphics engine, doesn't have the functionality to specify rotation in 3D, at the moment anyway. That's where direct OpenGL or DirectX programming comes in.