Blender  V2.93
GHOST_ContextSDL.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) 2014 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "GHOST_Context.h"
27 
28 extern "C" {
29 #include "SDL.h"
30 }
31 
32 #ifndef GHOST_OPENGL_SDL_CONTEXT_FLAGS
33 # ifdef WITH_GPU_DEBUG
34 # define GHOST_OPENGL_SDL_CONTEXT_FLAGS SDL_GL_CONTEXT_DEBUG_FLAG
35 # else
36 # define GHOST_OPENGL_SDL_CONTEXT_FLAGS 0
37 # endif
38 #endif
39 
40 #ifndef GHOST_OPENGL_SDL_RESET_NOTIFICATION_STRATEGY
41 # define GHOST_OPENGL_SDL_RESET_NOTIFICATION_STRATEGY 0
42 #endif
43 
45  public:
49  GHOST_ContextSDL(bool stereoVisual,
50  SDL_Window *window,
51  int contextProfileMask,
52  int contextMajorVersion,
53  int contextMinorVersion,
54  int contextFlags,
55  int contextResetNotificationStrategy);
56 
61 
67 
73 
79 
85 
92 
98  GHOST_TSuccess setSwapInterval(int interval);
99 
105  GHOST_TSuccess getSwapInterval(int &intervalOut);
106 
107  private:
108  SDL_Window *m_window;
109  SDL_Window *m_hidden_window;
110 
111  const int m_contextProfileMask;
112  const int m_contextMajorVersion;
113  const int m_contextMinorVersion;
114  const int m_contextFlags;
115  const int m_contextResetNotificationStrategy;
116 
117  SDL_GLContext m_context; /* m_sdl_glcontext */
118 
120  static SDL_GLContext s_sharedContext;
121  static int s_sharedCount;
122 };
GHOST_TSuccess
Definition: GHOST_Types.h:91
GHOST_TSuccess swapBuffers()
GHOST_TSuccess initializeDrawingContext()
GHOST_TSuccess releaseNativeHandles()
GHOST_TSuccess getSwapInterval(int &intervalOut)
GHOST_ContextSDL(bool stereoVisual, SDL_Window *window, int contextProfileMask, int contextMajorVersion, int contextMinorVersion, int contextFlags, int contextResetNotificationStrategy)
GHOST_TSuccess activateDrawingContext()
GHOST_TSuccess releaseDrawingContext()
GHOST_TSuccess setSwapInterval(int interval)