Pure virtual base class for MinVR applications.
More...
|
| 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...
|
|
MinVR::AbstractMVRApp::AbstractMVRApp |
( |
) | |
|
|
inline |
virtual MinVR::AbstractMVRApp::~AbstractMVRApp |
( |
) | |
|
|
inlinevirtual |
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] | An | array of events generated by devices, mice, and keyboards |
[in] | The | time that has passed since the application launched in ms. |
- Parameters
-
[in] | A | unique id for the current calling renderthread |
[in] | A | reference to the camera, which can be used to set the current object to world transform. |
[in] | The | window 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] | A | unique thread specific id. Ids will start at zero so that they can be used as indices in an array. |
[in] | The | window 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: