glview_loop()

Enter glview's execution loop.

Synopsis:

#include <glview/glview.h>
 
GLVIEW_API int glview_loop(void)

Arguments:

Library:

libglview

Description:

This function contains glview's main execution loop. You must call glview_initialize() before calling this function.

This function invokes the initialize callback before entering the execution loop. Once started, the execution loop runs for the life of the app, invoking at various points the registered callbacks. The only mandatory callback is the display callback, which is called once per loop.

The execution loop occurs in the following order:
  • Pull all events off the event queue and process them:
    • On background: fire the background callback (if registered)
    • On foreground: fire the foreground callback (if registered)
    • On orientation change: fire the resize callback (if registered)
    • Fire the event callback with event details (if registered)
    • On exit: break out of the execution loop.
  • Call the display callback if the app is in the foreground.
  • Swap the graphic's buffers.
  • Repeat from the top.

When the user exits the app, the execution loop breaks, and the finalize callback is invoked.

The glview_loop() function does not return until the user exits the application. When glview_loop() returns, the graphics stack has already been taken down, and glview has already been destroyed. Any calls to glview after glview_loop() has returned will either fail or have unspecified behavior.

Returns:

GLVIEW_SUCCESS when the user exits the application, GLVIEW_FAILURE otherwise, with errno set to one of the following: