Start of 2D Drawing
// --- Draw General (bits REDRAW_MASK_GENERAL) ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_GENERAL
Call Draw() for all modules that registered that bit
// --- Loop for all windows ---
for all 2D windows that are "on" and need a redraw
Erase cursor with Draw_Cursor() if there is one
// --- Draw the Window portion (bits REDRAW_MASK_WINDOW) ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_WINDOW
Call Draw() for all modules that registered that bit
If there's no loaded images draw the splash screen
If the Flag_Redraw contain any OpenGL bits
Prepare the OpenGL Context
If the Flag_Redraw contain one of the bits in REDRAW_MASK_BACK_GRND
Clear the window's background
If the Flag_Redraw contain one of the bits in REDRAW_MASK_XOR_CLEAR
Call Draw() for all modules that registered that bit
// --- Draw the Open GL portion ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_DB_OPENGL
for all the structures in the DB, call the Draw_OpenGL callback
reset that bit in the DB
If the Flag_Redraw contain one of the bits in REDRAW_MASK_DLL_OPENGL
Call Draw() for all modules that registered that bit
// --- Draw the Stencil portion ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_DB_STENCIL
for all the structures in the DB, call the Draw_Stencil callback
reset that bit in the DB
If the Flag_Redraw contain one of the bits in REDRAW_MASK_DLL_STENCIL
Call Draw() for all modules that registered that bit
// --- Draw the frames Highlights ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_HIGHLIGHT
for all the structures in the DB, call the Draw_Highlight callback
reset that bit in the DB
If the Flag_Redraw contain one of the bits in REDRAW_MASK_XOR_DRAW
Call Draw() for all modules that registered that bit
// --- any "final" redraw ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_FINAL
Call Draw() for all modules that registered that bit
If the Flag_Redraw contain any OpenGL bits
Exit the OpenGL Context
If the Flag_Redraw contain one of the bits in REDRAW_MASK_CURSOR
Draw the cursor with Draw_Cursor()
Reset all redraw flags in the window's structure
Reset all "Redraw Region" in the DB
End of 2D Drawing