Blender  V3.3
GHOST_ContextWGL.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2013 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 //#define WIN32_COMPOSITING
11 
12 #include "GHOST_Context.h"
13 
14 #include <GL/wglew.h>
15 
16 #ifndef GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY
17 # define GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY 0
18 #endif
19 
21  /* XR code needs low level graphics data to send to OpenXR. */
23 
24  public:
28  GHOST_ContextWGL(bool stereoVisual,
29  bool alphaBackground,
30  HWND hWnd,
31  HDC hDC,
32  int contextProfileMask,
33  int contextMajorVersion,
34  int contextMinorVersion,
35  int contextFlags,
36  int contextResetNotificationStrategy);
37 
42 
48 
54 
60 
66 
73 
79  GHOST_TSuccess setSwapInterval(int interval);
80 
86  GHOST_TSuccess getSwapInterval(int &intervalOut);
87 
88  private:
89  int choose_pixel_format(bool stereoVisual, bool needAlpha);
90  int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
91  int _choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha);
92 
93  void initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD);
94 
95  HWND m_hWnd;
96  HDC m_hDC;
97 
98  const int m_contextProfileMask;
99  const int m_contextMajorVersion;
100  const int m_contextMinorVersion;
101  const int m_contextFlags;
102  const bool m_alphaBackground;
103  const int m_contextResetNotificationStrategy;
104 
105  HGLRC m_hGLRC;
106 
107 #ifndef NDEBUG
108  const char *m_dummyVendor;
109  const char *m_dummyRenderer;
110  const char *m_dummyVersion;
111 #endif
112 
113  static HGLRC s_sharedHGLRC;
114  static int s_sharedCount;
115 };
GHOST_TSuccess
Definition: GHOST_Types.h:74
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)