Skip rendering if alpha is 0.0

This commit is contained in:
ocornut 2014-08-18 13:20:57 +01:00
parent c5dacee3a7
commit ca027e1754

View File

@ -1401,6 +1401,10 @@ void Render()
memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters)); memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
} }
// Skip render altogether if alpha is 0.0
// Note that vertex buffers have been created, so it is best practice that you don't call Begin/End in the first place.
if (g.Style.Alpha > 0.0f)
{
// Render tooltip // Render tooltip
if (g.Tooltip[0]) if (g.Tooltip[0])
{ {
@ -1430,6 +1434,7 @@ void Render()
g.IO.RenderDrawListsFn(&g.RenderDrawLists[0], (int)g.RenderDrawLists.size()); g.IO.RenderDrawListsFn(&g.RenderDrawLists[0], (int)g.RenderDrawLists.size());
g.RenderDrawLists.resize(0); g.RenderDrawLists.resize(0);
} }
}
// Find the optional ## from which we stop displaying text. // Find the optional ## from which we stop displaying text.
static const char* FindTextDisplayEnd(const char* text, const char* text_end = NULL) static const char* FindTextDisplayEnd(const char* text, const char* text_end = NULL)