OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
OpenGLSampleCAPI.cpp File Reference

Simple example OpenGL application using the OSVR ClientKit display methods. This example shows the use of the C API display methods, even though it is in C++. See OpenGLSample.cpp for a more idiomatic-C++ sample using the C++ API headers. More...

#include <osvr/ClientKit/ClientKit.h>
#include <osvr/ClientKit/DisplayC.h>
#include "SDL2Helpers.h"
#include "OpenGLCube.h"
#include <SDL.h>
#include <SDL_opengl.h>
#include <iostream>

Go to the source code of this file.

Functions

void render (OSVR_DisplayConfig disp)
 The "wrapper" for rendering to a device described by OSVR. More...
 
void renderScene ()
 A simple dummy "draw" function - note that drawing occurs in "room space" by default. (that is, in this example, the modelview matrix when this function is called is initialized such that it transforms from world space to view space)
 

Detailed Description

Simple example OpenGL application using the OSVR ClientKit display methods. This example shows the use of the C API display methods, even though it is in C++. See OpenGLSample.cpp for a more idiomatic-C++ sample using the C++ API headers.

Date
2015
Author
Sensics, Inc. http://sensics.com/osvr

Definition in file OpenGLSampleCAPI.cpp.

Function Documentation

void render ( OSVR_DisplayConfig  disp)

The "wrapper" for rendering to a device described by OSVR.

This function will set up viewport, initialize view and projection matrices to current values, then call renderScene() as needed (e.g. once for each eye, for a simple HMD.)

For each viewer...

For each eye of the given viewer...

Try retrieving the view matrix (based on eye pose) from OSVR

Initialize the ModelView transform with the view matrix we received

For each display surface seen by the given eye of the given viewer...

Set the OpenGL viewport based on the one we computed.

Set the OpenGL projection matrix based on the one we computed.

Set the matrix mode to ModelView, so render code doesn't mess with the projection matrix on accident.

Call out to render our scene.

Successfully completed a frame render.

Definition at line 142 of file OpenGLSampleCAPI.cpp.