EGLplus (0.52.0) a C++ wrapper for EGL

display.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef EGLPLUS_DISPLAY_1305291005_HPP
14 #define EGLPLUS_DISPLAY_1305291005_HPP
15 
16 #include <eglplus/eglfunc.hpp>
17 #include <eglplus/error/basic.hpp>
18 
19 namespace eglplus {
20 
21 class EGLInitializer;
22 
23 class Display;
24 ::EGLDisplay GetEGLHandle(const Display&);
25 
27 class Display
28 {
29 private:
30  ::EGLDisplay _handle;
31 
32  friend ::EGLDisplay GetEGLHandle(const Display&);
33 public:
35 
40  Display(void)
41  : _handle(EGLPLUS_EGLFUNC(GetDisplay)(EGL_DEFAULT_DISPLAY))
42  {
43  EGLPLUS_CHECK_SIMPLE(GetDisplay);
44  }
45 
47 
51  Display(::EGLNativeDisplayType display_id)
52  : _handle(EGLPLUS_EGLFUNC(GetDisplay)(display_id))
53  {
54  EGLPLUS_CHECK_SIMPLE(GetDisplay);
55  }
56 
58 
62  bool SwapInterval(EGLint interval)
63  {
64  EGLBoolean result = EGLPLUS_EGLFUNC(SwapInterval)(
65  _handle,
66  interval
67  );
68  EGLPLUS_CHECK_SIMPLE(SwapInterval);
69  return result == EGL_TRUE;
70  }
71 
73 
77  bool ReleaseContext(void)
78  {
79  EGLBoolean result = EGLPLUS_EGLFUNC(MakeCurrent)(
80  _handle,
81  EGL_NO_SURFACE,
82  EGL_NO_SURFACE,
83  EGL_NO_CONTEXT
84  );
85  EGLPLUS_CHECK_SIMPLE(MakeCurrent);
86  return result == EGL_TRUE;
87  }
88 };
89 
90 inline ::EGLDisplay GetEGLHandle(const Display& display)
91 {
92  return display._handle;
93 }
94 
95 } // namespace eglplus
96 
97 #endif // include guard
Helper macro expanding into EGL function name.
Wrapper around EGLDisplay.
Definition: display.hpp:27
bool SwapInterval(EGLint interval)
Sets the SwapInterval for the current display.
Definition: display.hpp:62
Display(::EGLNativeDisplayType display_id)
Opens the display specified by display_id.
Definition: display.hpp:51
Display(void)
Opens the default display.
Definition: display.hpp:40
bool ReleaseContext(void)
Releases the current context without assigning a new one.
Definition: display.hpp:77

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).