Tilemap advice needed

BlitzMax Forums/BlitzMax Programming/Tilemap advice needed

flying willy(Posted 2004) [#1]
Hi,

Tilemaps in 2D are optimised by drawing to a larger image then pasting that image until you need to draw more blocks. This is called a 'cache' drawing scheme.

Lets consider that drawimage in opengl is actually throwing textured quads at the screen.

Lets consider that for each different textured quad you throw at the screen, you actually make a small gfx render state change.

So what is the fastest way to make tile maps on blitzmax?
please consider the following:

* possibly ordering your drawing so texture switching is minimised

* cache map or not?


Thoughts?


smilertoo(Posted 2004) [#2]
Fastest way i could think of was to make a grid of quads and assign the UV's for each quad to the bit of texture you want to put in that tile.


flying willy(Posted 2004) [#3]
I've done some testing regarding grouping your draws and found it to be significantly faster. http://www.blitzbasic.com/Community/posts.php?topic=41634

That shows a basic and actually useful optimisation to make.