draw_texture_flush

Clears all textures from texture memory.

Syntax:

draw_texture_flush();


Returns: N/A


Description

With this function you can remove all textures from video memory, and they will then be reloaded on first use. This is the only effective way to manage video memory when you have multiple texture pages for a game, and you should flush the texture memory between levels on your game and organise the graphics using the texture group feature to ensure that the minimum number of textures are used.

It is worth noting that this function works as described on all target platforms except for Windows (YYC and standard), where by default all textures will always be loaded into memory on start-up. You can, however, change this behaviour from the Global Game Settings and have Windows behave the same as all other target platforms.

NOTE: There is a performance hit as the texture is uploaded to texture memory on most devices, so the best idea is to do a dummy render of the required graphics at the start of a level to avoid any stalls. You would only need to render a single graphic from each texture page to ensure that texture is loaded, and you should be aware that texture groups can have more than one texture page which means that each load will cause a stall.


Example:

draw_texture_flush();

The above code flushes the video memory of texture data, and would probably be placed in the create event of the first instance of an object placed in the room.


Back: Drawing
Next: draw_enable_drawevent
© Copyright YoYo Games Ltd. 2018 All Rights Reserved