-
Notifications
You must be signed in to change notification settings - Fork 477
/
cgeSharedGLContext.h
58 lines (42 loc) · 1.1 KB
/
cgeSharedGLContext.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
/*
* cgeSharedGLContext.h
*
* Created on: 2015-7-9
* Author: Wang Yang
* Mail: [email protected]
*/
#ifndef _CGEJNI_H_
#define _CGEJNI_H_
#include <EGL/egl.h>
#ifndef EGL_CONTEXT_CLIENT_VERSION
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
#endif
#ifndef EGL_RECORDABLE_ANDROID
#define EGL_RECORDABLE_ANDROID 0x3142
#endif
class CGESharedGLContext
{
CGESharedGLContext() {}
public:
enum ContextType
{
PBUFFER,
RECORDABLE_ANDROID
};
static CGESharedGLContext* create();
static CGESharedGLContext* create(int width, int height);
static CGESharedGLContext* create(EGLContext sharedContext, int width, int height, ContextType type);
~CGESharedGLContext();
void makecurrent();
bool swapbuffers();
static void setContextColorBits(int r, int g, int b, int a);
private:
EGLDisplay m_display;
EGLSurface m_surface;
EGLContext m_context;
static EGLint s_bitR, s_bitG, s_bitB, s_bitA;
bool init(EGLContext sharedContext, int width, int height, ContextType type);
void destroy();
};
// bool enableGLFunction(void* arg);
#endif