Blender  V2.93
GHOST_ContextWGL.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 //#define WIN32_COMPOSITING
27 
28 #include "GHOST_Context.h"
29 
30 #include <GL/wglew.h>
31 
32 #ifndef GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY
33 # define GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY 0
34 #endif
35 
37  /* XR code needs low level graphics data to send to OpenXR. */
39 
40  public:
44  GHOST_ContextWGL(bool stereoVisual,
45  bool alphaBackground,
46  HWND hWnd,
47  HDC hDC,
48  int contextProfileMask,
49  int contextMajorVersion,
50  int contextMinorVersion,
51  int contextFlags,
52  int contextResetNotificationStrategy);
53 
58 
64 
70 
76 
82 
89 
95  GHOST_TSuccess setSwapInterval(int interval);
96 
102  GHOST_TSuccess getSwapInterval(int &intervalOut);
103 
104  private:
105  int choose_pixel_format(bool stereoVisual, bool needAlpha);
106  int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
107  int _choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha);
108 
109  void initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD);
110 
111  HWND m_hWnd;
112  HDC m_hDC;
113 
114  const int m_contextProfileMask;
115  const int m_contextMajorVersion;
116  const int m_contextMinorVersion;
117  const int m_contextFlags;
118  const bool m_alphaBackground;
119  const int m_contextResetNotificationStrategy;
120 
121  HGLRC m_hGLRC;
122 
123 #ifndef NDEBUG
124  const char *m_dummyVendor;
125  const char *m_dummyRenderer;
126  const char *m_dummyVersion;
127 #endif
128 
129  static HGLRC s_sharedHGLRC;
130  static int s_sharedCount;
131 };
GHOST_TSuccess
Definition: GHOST_Types.h:91
GHOST_ContextWGL(bool stereoVisual, bool alphaBackground, HWND hWnd, HDC hDC, int contextProfileMask, int contextMajorVersion, int contextMinorVersion, int contextFlags, int contextResetNotificationStrategy)
GHOST_TSuccess activateDrawingContext()
GHOST_TSuccess getSwapInterval(int &intervalOut)
GHOST_TSuccess swapBuffers()
GHOST_TSuccess releaseNativeHandles()
GHOST_TSuccess initializeDrawingContext()
GHOST_TSuccess releaseDrawingContext()
GHOST_TSuccess setSwapInterval(int interval)