Essentially give a Z-layer parameter to each GUI element and use that to enforce rendering.
This combines nicely with deferring draws (amassing a command buffer/list) and eliminating draw call.
Irrlicht's GUI draws more in "immediate mode" right now.
Dig in!
https://github.com/buildaworldnet/Irrli ... -3D-Engine
NextGen GUI system idea
Re: NextGen GUI system idea
Is it really worth to add a ZBuffer to the whole GUI thing? The reason for the GUI to be in "immediate mode" is to ensure the rendering order of the elements and to avoid any aditional overhead that otherwise could be sorted out by enforcing a strict rendering order. Also Transparency doesn't get along with ZBuffered rendering, so i think it is better an immediate approach.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: NextGen GUI system idea
ZBuffer is optional, only there to prevent overdraw, only pixels with 100% would draw to it.
Sometimes your animation or gui logic code for maintainability reasons will need to be traversed in an order vastly different to rendering order.
Also with vulkan, etc. You need to create a command buffer anyway.
But more importantly opengl 3.2 core onwards demands the use of a VAO so immediate mode is out of question, so you better pack all gui in one mesh with same material.
Not to mention the cost of switching descriptor sets (text is es, vaos, etc.) if you draw immediate without packed textures.
Sometimes your animation or gui logic code for maintainability reasons will need to be traversed in an order vastly different to rendering order.
Also with vulkan, etc. You need to create a command buffer anyway.
But more importantly opengl 3.2 core onwards demands the use of a VAO so immediate mode is out of question, so you better pack all gui in one mesh with same material.
Not to mention the cost of switching descriptor sets (text is es, vaos, etc.) if you draw immediate without packed textures.