From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


native static void EnableStencil(bool on)


Enables the usage of the stencil buffer when drawing. The stencil buffer allows for textures to act as a mask for other textures drawn on the screen, discarding anything that doesn't fit within it. This can be used to draw textures with complex shapes without having to rely on Shape2D or masking with shaders.

Warning: This can only be called from within functions that are specifically designed to draw HUD elements (e.g. BaseStatusBar's Draw or EventHandler's RenderOverlay).


  • on - If set to true, turns on the stencil buffer. If false, turns it off


Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.