The 3D drawing is complicated by the fact that we can use multiple pass in the algorithm to draw a complete geometry. Indeed if a 3D geometry contain to many lines or polygons to be displayed in real time, we will only draw a portion of these and come back to finish later on if the user has not interact with the 3D window. The maximum number of passes needed to draw the geometry is controlled by the Speed parameter in the configuration menu.
Start of 3D Drawing
if the Flag_Redraw contain the bit REDRAW_3D_START:
set "Step_Flag" to Flag_Redraw minus the REDRAW_3D_START bit
set "Step_Current" to 0
set "Step_Total" to the maximum number for this graphic card
// --- Loop for all windows ---
for all 3D windows that are "on" and need a redraw
Prepare the OpenGL context
// --- Draw_Clear ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_3D_WINDOW
Call Draw() for all modules that registered that bit
if the Flag_Redraw contain the bit REDRAW_3D_START
Clear the OpenGL window
// --- Draw_Camera ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_3D_CAMERA
Call Draw() for all modules that registered that bit
// --- Draw_Light ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_3D_LIGHT
Call Draw() for all modules that registered that bit
// --- Draw_Transfo ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_3D_TRANSFO
Call Draw() for all modules that registered that bit
if the Flag_Redraw contain the bit REDRAW_3D_START
// --- Draw_Transfo ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_3D_PRE
Call Draw() for all modules that registered that bit
// --- Database callback ---
if the Step_Flag contain one of the bits of REDRAW_MASK_3D_DB
for all the structures in the DB, call the Draw_3D callback for this step
// --- Geometries callback ---
For all the existing "TAG" geometries (created from the TAG data in sliceO)
Call all the associated "Draw_Geom" callback functions
If none of the callback returned "2", call the default callback function for this step
For all the existing "File" geometries (read as 3D file)
Call all the associated "Draw_Geom" callback functions
If none of the callback returned "2", call the default callback function for this step
// --- Module's Draw functions ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_3D_DLL
Call Draw() for all modules that registered that bit with the current step number
If this is the last step in the 3D redraw (Step_Current = Step_Total-1)
// --- Draw Post ---
If the Flag_Redraw contain one of the bits in REDRAW_MASK_3D_POST
Call Draw() for all modules that registered that bit
Exit the OpenGL Context
Increment Step_Current
Clear the bit REDRAW_3D_START from Flag_Draw
If this is the last step (Step_Current = Step_Total)
Clear Flag_Draw
End of 3D Drawing