OpenGL Programming/Bounding box

= Concept =

We analyze the object:
 * Minimum coordinates in X, Y and Z
 * Maximum coordinates in X, Y and Z
 * We compute the size necessary for the object:  in X, Y and Z
 * We compute the center of the object:  in X, Y and Z

We compute of cube around the object:
 * We prepare a cube of size 1 (1x1x1), centered on the origin
 * We scale it by the size of the object
 * We center it on the object

To draw the cube:
 * We draw the front face using 1 looping line
 * We draw the back face using 1 looping line
 * We draw 4 orthogonal lines to join both faces

= Code =

= Intersection with surfaces =

As seen in Scientific tutorial 05, you can improve situations where lines and surfaces are mixing, by using:

Keep  enabled even after you draw the lines, it needs to be enabled when drawing the surfaces as well.

You can also increase the line thickness if need be: