MinVR  0.9.0
A multi-platform virtual reality library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
MinVR::AbstractMVRApp Class Referenceabstract

Pure virtual base class for MinVR applications. More...

Public Member Functions

 AbstractMVRApp ()
 
virtual ~AbstractMVRApp ()
 
virtual void doUserInputAndPreDrawComputation (const std::vector< EventRef > &events, double synchronizedTime)=0
 Handle events and computation. More...
 
virtual void initializeContextSpecificVars (int threadId, WindowRef window)=0
 Initialize OpenGL variables. More...
 
virtual void drawGraphics (int threadId, AbstractCameraRef camera, WindowRef window)=0
 Drawing code. This is where all your OpenGL drawing code should go. This routine is typically called more than once per frame. In a desktop VR environment, this would be called once to draw the image for the left eye and then a second time to draw the image for the right eye. In a 4-wall CAVE where the a single graphics window is stretched across all the projection screens and divided into 4 different OpenGL viewports, one per wall, this routine would be called 8 times per frame (once per eye for each of the walls). Before calling this routine, MVREngine will appropriately clear the OpenGL draw buffer(s), set the OpenGL projection matrices including applying head tracking data if applicable, use the OpenGL viewport command to specify the correct protion of the screen to draw if applicable, and/or set the stencil buffer properly to draw to stereo displays that require a left/right eye interlaced signal if applicable. MVREngine determines all of those settings based upon the config variables passed to it at runtime that describe your VR environment. Since all that is handled inside MinVR, the only thing that you should implement in this function is the OpenGL code needed to draw your scene. More...
 

Detailed Description

Constructor & Destructor Documentation

MinVR::AbstractMVRApp::AbstractMVRApp ( )
inline
virtual MinVR::AbstractMVRApp::~AbstractMVRApp ( )
inlinevirtual

Member Function Documentation

virtual void MinVR::AbstractMVRApp::doUserInputAndPreDrawComputation ( const std::vector< EventRef > &  events,
double  synchronizedTime 
)
pure virtual

This will be called once per frame. You should do all your program's logic (handling input events, doing any required simulation, and so on) within this function. If you are doing any simulation or animation where virtual objects change over time, it is useful to base this code on the time value passed in via the synchronizedTime parameter, which is guaranteed to be synchronized across all processes when MinVR is run in a clustered rendering environment.

Parameters
[in]Anarray of events generated by devices, mice, and keyboards
[in]Thetime that has passed since the application launched in ms.
virtual void MinVR::AbstractMVRApp::drawGraphics ( int  threadId,
AbstractCameraRef  camera,
WindowRef  window 
)
pure virtual
Parameters
[in]Aunique id for the current calling renderthread
[in]Areference to the camera, which can be used to set the current object to world transform.
[in]Thewindow for the calling render thread. Can be used to get the window size, position, etc.
Note
This method is called from multiple render threads. Do not modify variables in this method, as it is not thread-safe.
virtual void MinVR::AbstractMVRApp::initializeContextSpecificVars ( int  threadId,
WindowRef  window 
)
pure virtual

This will be called once by each rendering thread as it is created. You should initialize all context specific variables here such as textures, frame buffer objects, vertex buffer objects, shaders, etc. Variables can be stored in an array and matched to the specific thread by the threadId, or alternatively, wrapped as a boost::thread_specific_ptr<> object to automatically create thread specific versions.

Parameters
[in]Aunique thread specific id. Ids will start at zero so that they can be used as indices in an array.
[in]Thewindow for the calling render thread. Can be used to get the window size, position, etc.
Note
Initalizing opengl variables elsewhere in the application is not threadsafe!

The documentation for this class was generated from the following file: