=====================
Application Structure
=====================

To your application, HOOPS looks like a subroutine library. Your application invokes HOOPS subroutines to insert and delete objects from the graphics database, to initiate and control rendering, and to receive input events. The order in which these operations occur is called the *control flow* of the application. Control flow is a major topic of :doc:`Chapter 4 <04_1_user_interaction_event_loop>`. The control flow of a typical graphics application cycles through the following steps:

#. Your application code makes changes to the graphics database.
#. When it is finished making changes to the graphics database, your application tells HOOPS Visualize to update the display (either by explicitly calling ``Update_Display()`` or by waiting for input).
#. HOOPS walks the database and sends the primitives to be drawn to the renderer.
#. The renderer draws the scene and sends it to some output device.
#. The user sees the new picture, thinks for a while, and then generates input through the user interface. 
#. Your application code receives this input and makes further changes to the Visualize database. 

This cycle repeats until the user terminates the application. 

We can visualize the control flow as a repeating cycle. This cycle contains the main parts of HOOPS Visualize - the database and renderer, in addition to your application code, the user-input subsystem, and the end-user. 

.. image:: images/011a_app_control_flow.gif

*Control flow of a graphics application.*
