CGFLib - A library for Computer Graphics @ FEUP
 All Classes Files Functions Variables Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CGFapplication Class Reference

Main class for an application where you can add scenes, interfaces and manage other aspects of the application. More...

#include <CGFapplication.h>

Public Member Functions

void init (int *, char **)
 Initial method, should be called from main and have (argc, argv) passed through.
 
void run ()
 Main application loop; should be called after initializing and setting the active scene and interface using setScene() and setInterface()
 
void setScene (CGFscene *gls)
 Associates the provided scene with the application, and initializes it.
 
void setInterface (CGFinterface *gli)
 Associates the provided interface with the application and the previously associated scene, and initializes it.
 
int getMainWindow ()
 Returns the OpenGL handle to the main application window.
 
void forceRefresh ()
 Forces the application to refresh, including updating the viewports and corresponding projection matrices.
 

Static Public Member Functions

static void snapshot ()
 Takes a snapshot of the application window and stores it in PNG format in the working directory, with a timestamp.
 
static unsigned long getTime ()
 Returns the current time in milliseconds to be used in time-based updates and other actions. The time base may vary from platform to platform, can be from a specific date, or from the start of the application.
 

Static Public Attributes

static float xy_aspect = 0
 Aspect ratio of the application window.
 
static int width = 0
 Width of the application window.
 
static int height = 0
 Height of the application window.
 
static int vpx = 0
 
static int vpy = 0
 
static int vpw = 0
 
static int vph = 0
 Viewport coordinates and dimensions within the application window, excluding the interface area.
 
static CGFapplicationactiveApp = NULL
 

Protected Member Functions

void activate ()
 
void environmentInit ()
 Called at the end of init(), it sets the default OpenGL parameters, such as culling, depth testing, etc. (which can later be overriden by CGFscene::init() ).
 
void updateScene ()
 

Static Protected Member Functions

static void gluiIdleFunction (void)
 Static idle handler to be registered in GLUT/GLUI. It is responsible to route execution to any handlers specific of the active application, scene and/or interface.
 
static void reshape (int, int)
 Static reshape handler to be registered in GLUT/GLUI. It is responsible to handle reshape in terms of application, and to update the active camera of the active scene.
 
static void display ()
 Static display handler to be registered in GLUT/GLUI. It is responsible to route execution to the active scene's CGFscene::display() handler.
 

Protected Attributes

CGFsceneapp_scene
 
CGFinterfaceapp_interface
 

Static Protected Attributes

static int app_window = 0
 
static bool refreshRequested =false
 

Detailed Description

Main class for an application where you can add scenes, interfaces and manage other aspects of the application.