OSVR-Core
0.6-1962-g59773924
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
ViewerEyeSurfaces.cpp
Go to the documentation of this file.
1
11
// Copyright 2015 Sensics, Inc.
12
//
13
// Licensed under the Apache License, Version 2.0 (the "License");
14
// you may not use this file except in compliance with the License.
15
// You may obtain a copy of the License at
16
//
17
// http://www.apache.org/licenses/LICENSE-2.0
18
//
19
// Unless required by applicable law or agreed to in writing, software
20
// distributed under the License is distributed on an "AS IS" BASIS,
21
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
// See the License for the specific language governing permissions and
23
// limitations under the License.
24
25
// Internal Includes
26
#include <
osvr/ClientKit/Context.h
>
27
#include <
osvr/ClientKit/Display.h
>
28
29
// Library/third-party includes
30
// - none
31
32
// Standard includes
33
#include <iostream>
34
35
int
main() {
36
// Start OSVR and get OSVR display config
37
osvr::clientkit::ClientContext
ctx(
"com.osvr.example.ViewerEyeSurfaces"
);
38
osvr::clientkit::DisplayConfig
display;
39
40
// This is in a loop in case we don't have a display config right away.
41
do
{
42
std::cout <<
"Trying to get the display config"
<< std::endl;
43
ctx.update();
44
display =
osvr::clientkit::DisplayConfig
(ctx);
45
}
while
(!display.
valid
());
46
47
// Once we have a valid display config, go through each level with a lambda.
48
display.
forEachViewer
([](
osvr::clientkit::Viewer
viewer){
49
std::cout <<
"Viewer "
<< viewer.getViewerID() <<
"\n"
;
50
viewer.
forEachEye
([](
osvr::clientkit::Eye
eye) {
51
std::cout <<
"\tEye "
<< int(eye.getEyeID()) <<
"\n"
;
52
eye.
forEachSurface
([](
osvr::clientkit::Surface
surface) {
53
std::cout <<
"\t\tSurface "
<< surface.getSurfaceID() <<
"\n"
;
54
});
55
});
56
});
57
58
std::cout <<
"Library shut down, exiting."
<< std::endl;
59
return
0;
60
}
osvr::clientkit::Eye::forEachSurface
void forEachSurface(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition:
Display.h:308
osvr::clientkit::ClientContext
Client context object: Create and keep one in your application. Handles lifetime management and provi...
Definition:
Context_decl.h:57
Display.h
Header.
osvr::clientkit::Surface
Wrapper for a viewer, eye, and surface bound to a display config. DOES NOT provide lifetime managemen...
Definition:
Display.h:117
Context.h
Header.
osvr::clientkit::Eye
Wrapper for a viewer and eye bound to a display config. DOES NOT provide lifetime management for the ...
Definition:
Display.h:248
osvr::clientkit::DisplayConfig
Class wrapping OSVR_DisplayConfig objects, optionally managing shared ownership.
Definition:
Display.h:409
osvr::clientkit::DisplayConfig::valid
bool valid() const
Checks the validity of the contained pointer.
Definition:
Display.h:438
osvr::clientkit::DisplayConfig::forEachViewer
void forEachViewer(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition:
Display.h:524
osvr::clientkit::Viewer
Wrapper for a viewer bound to a display config. DOES NOT provide lifetime management for the associat...
Definition:
Display.h:332
osvr::clientkit::Viewer::forEachEye
void forEachEye(F OSVR_CLIENTKIT_FUNCTOR_REF functor)
Definition:
Display.h:381
examples
clients
ViewerEyeSurfaces.cpp
Generated on Tue May 16 2017 15:22:39 for OSVR-Core by
Doxygen
1.8.8