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

Simple example OpenGL application using the OSVR ClientKit display methods in the C++ API headers. More...

#include <osvr/ClientKit/ClientKit.h>
#include <osvr/ClientKit/Display.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::clientkit::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 in the C++ API headers.

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

Definition in file OpenGLSample.cpp.

Function Documentation

void render ( osvr::clientkit::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, eye combination...

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 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 139 of file OpenGLSample.cpp.