-
Notifications
You must be signed in to change notification settings - Fork 1
/
EGLX11Display.h
76 lines (59 loc) · 1.52 KB
/
EGLX11Display.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* EGLBenchmark
*
* Author: Jarkko Vatjus-Anttila <[email protected]>
*
* For conditions of distribution and use, see copyright notice in license.txt
*/
#ifndef EGLX11DISPLAY_H
#define EGLX11DISPLAY_H
#include <iostream>
#include <sys/time.h>
#include <string.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
#include "GLWrapper.h"
const EGLint attr[] = { // some attributes to set up our egl-interface
EGL_BUFFER_SIZE, 16,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
//EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 8,
EGL_NONE
};
const EGLint ctxattr[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
// Class definition
class EGLX11Display
{
public:
EGLX11Display();
~EGLX11Display();
public:
// Benchmark class helper methods for EGL context handling
int createEGLDisplay(int width, int height, bool fullscreen);
int destroyEGLDisplay(void);
Display *getXDisplay(void);
EGLDisplay getEGLDisplay(void);
EGLSurface getEGLSurface(void);
unsigned int getDisplayWidth(void);
unsigned int getDisplayHeight(void);
private:
// Variables EGL
EGLContext egl_context;
// Logical render window properties
unsigned int w_width;
unsigned int w_height;
bool w_fullscreen;
// X11 related
Window win;
Display *x_display;
EGLDisplay egl_display;
EGLSurface egl_surface;
};
#endif // EGLX11DISPLAY_H