Blender  V2.93
GHOST_ContextEGL.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2013 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "GHOST_Context.h"
27 
28 #include <GL/eglew.h>
29 
30 #ifndef GHOST_OPENGL_EGL_CONTEXT_FLAGS
31 # define GHOST_OPENGL_EGL_CONTEXT_FLAGS 0
32 #endif
33 
34 #ifndef GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY
35 # define GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY 0
36 #endif
37 
39  public:
43  GHOST_ContextEGL(bool stereoVisual,
44  EGLNativeWindowType nativeWindow,
45  EGLNativeDisplayType nativeDisplay,
46  EGLint contextProfileMask,
47  EGLint contextMajorVersion,
48  EGLint contextMinorVersion,
49  EGLint contextFlags,
50  EGLint contextResetNotificationStrategy,
51  EGLenum api);
52 
57 
63 
69 
75 
81 
88 
94  GHOST_TSuccess setSwapInterval(int interval);
95 
101  GHOST_TSuccess getSwapInterval(int &intervalOut);
102 
103  private:
104  bool initContextEGLEW();
105 
106  EGLNativeDisplayType m_nativeDisplay;
107  EGLNativeWindowType m_nativeWindow;
108 
109  const EGLint m_contextProfileMask;
110  const EGLint m_contextMajorVersion;
111  const EGLint m_contextMinorVersion;
112  const EGLint m_contextFlags;
113  const EGLint m_contextResetNotificationStrategy;
114 
115  const EGLenum m_api;
116 
117  EGLContext m_context;
118  EGLSurface m_surface;
119  EGLDisplay m_display;
120 
121  EGLint m_swap_interval;
122 
123  EGLContext &m_sharedContext;
124  EGLint &m_sharedCount;
125 
126  static EGLContext s_gl_sharedContext;
127  static EGLint s_gl_sharedCount;
128 
129  static EGLContext s_gles_sharedContext;
130  static EGLint s_gles_sharedCount;
131 
132  static EGLContext s_vg_sharedContext;
133  static EGLint s_vg_sharedCount;
134 
135 #ifdef WITH_GL_ANGLE
136  static HMODULE s_d3dcompiler;
137 #endif
138 };
GHOST_TSuccess
Definition: GHOST_Types.h:91
GHOST_TSuccess releaseDrawingContext()
GHOST_TSuccess activateDrawingContext()
GHOST_TSuccess getSwapInterval(int &intervalOut)
GHOST_TSuccess initializeDrawingContext()
GHOST_TSuccess setSwapInterval(int interval)
GHOST_ContextEGL(bool stereoVisual, EGLNativeWindowType nativeWindow, EGLNativeDisplayType nativeDisplay, EGLint contextProfileMask, EGLint contextMajorVersion, EGLint contextMinorVersion, EGLint contextFlags, EGLint contextResetNotificationStrategy, EGLenum api)
GHOST_TSuccess releaseNativeHandles()
GHOST_TSuccess swapBuffers()