Blender  V2.93
GHOST_ContextGLX.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 #include <GL/glxew.h>
29 
30 #ifndef GHOST_OPENGL_GLX_CONTEXT_FLAGS
31 /* leave as convenience define for the future */
32 # define GHOST_OPENGL_GLX_CONTEXT_FLAGS 0
33 #endif
34 
35 #ifndef GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY
36 # define GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY 0
37 #endif
38 
40  /* XR code needs low level graphics data to send to OpenXR. */
42 
43  public:
47  GHOST_ContextGLX(bool stereoVisual,
48  Window window,
49  Display *display,
50  GLXFBConfig fbconfig,
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  void initContextGLXEW();
109 
110  Display *m_display;
111  GLXFBConfig m_fbconfig;
112  Window m_window;
113 
114  const int m_contextProfileMask;
115  const int m_contextMajorVersion;
116  const int m_contextMinorVersion;
117  const int m_contextFlags;
118  const int m_contextResetNotificationStrategy;
119 
120  GLXContext m_context;
121 
123  static GLXContext s_sharedContext;
124  static int s_sharedCount;
125 };
126 
127 /* used to get GLX info */
129  int *attribs, int attribs_max, bool is_stereo_visual, bool need_alpha, bool for_fb_config);
int GHOST_X11_GL_GetAttributes(int *attribs, int attribs_max, bool is_stereo_visual, bool need_alpha, bool for_fb_config)
GHOST_TSuccess
Definition: GHOST_Types.h:91
GHOST_TSuccess releaseDrawingContext()
GHOST_TSuccess getSwapInterval(int &intervalOut)
GHOST_TSuccess initializeDrawingContext()
GHOST_TSuccess activateDrawingContext()
GHOST_TSuccess setSwapInterval(int interval)
GHOST_TSuccess releaseNativeHandles()
GHOST_TSuccess swapBuffers()
GHOST_ContextGLX(bool stereoVisual, Window window, Display *display, GLXFBConfig fbconfig, int contextProfileMask, int contextMajorVersion, int contextMinorVersion, int contextFlags, int contextResetNotificationStrategy)