OGLplus
(0.52.0)
a C++ wrapper for
OpenGL
Tweet
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
include
oglplus
native
surface_glx.hpp
Go to the documentation of this file.
1
12
#pragma once
13
#ifndef OGLPLUS_NATIVE_SURFACE_1404232057_HPP
14
#define OGLPLUS_NATIVE_SURFACE_1404232057_HPP
15
// NOTE: the include guard is intentionally without the _GLX suffix so that
16
// different native surface implementation cannot be included simultaneously.
17
18
#define OGLPLUS_NATIVE_GLX 1
19
20
#include <
oglplus/native/common_glx.hpp
>
21
#include <GL/glx.h>
22
23
namespace
oglplus {
24
namespace
native {
25
27
class
SurfaceGLX
28
{
29
private
:
30
::Display* _display;
31
::GLXDrawable _drawable;
32
33
friend
class
ContextGLX
;
34
35
struct
Current_ { };
36
37
SurfaceGLX
(Current_)
38
: _display(::glXGetCurrentDisplay())
39
, _drawable(::glXGetCurrentDrawable())
40
{
41
if
(!_display) HandleNoGLXDisplay();
42
if
(!_drawable) HandleNoGLXDrawable();
43
}
44
45
unsigned
_query(
int
param)
const
46
{
47
unsigned
result = 0;
48
::glXQueryDrawable(
49
_display,
50
_drawable,
51
param,
52
&result
53
);
54
return
result;
55
}
56
public
:
58
63
static
SurfaceGLX
Current
(
void
)
64
{
65
return
SurfaceGLX
(Current_());
66
}
67
69
int
Width
(
void
)
const
70
{
71
return
int(_query(GLX_WIDTH));
72
}
73
75
int
Height
(
void
)
const
76
{
77
return
int(_query(GLX_HEIGHT));
78
}
79
81
void
SwapBuffers
(
void
)
82
{
83
::glXSwapBuffers(_display, _drawable);
84
}
85
};
86
87
typedef
SurfaceGLX Surface;
88
89
}
// namespace native
90
}
// namespace oglplus
91
92
#endif // include guard
oglplus::native::SurfaceGLX::Height
int Height(void) const
Returns the height of the surface.
Definition:
surface_glx.hpp:75
oglplus::native::ContextGLX
Wrapper for a valid GLX context handle.
Definition:
context_glx.hpp:24
common_glx.hpp
Declaration of common functions used by GLX object wrappers.
oglplus::native::SurfaceGLX::Width
int Width(void) const
Returns the width of the surface.
Definition:
surface_glx.hpp:69
oglplus::native::SurfaceGLX
Wrapper for GLX (drawable) surface handle.
Definition:
surface_glx.hpp:27
oglplus::native::SurfaceGLX::Current
static SurfaceGLX Current(void)
Returns a wrapper for the currently bound GLX surface.
Definition:
surface_glx.hpp:63
oglplus::native::SurfaceGLX::SwapBuffers
void SwapBuffers(void)
Swaps the front and back buffers.
Definition:
surface_glx.hpp:81
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).