1 //======================================================================== 2 // GLFW 3.2 WGL - www.glfw.org 3 //------------------------------------------------------------------------ 4 // Copyright (c) 2002-2006 Marcus Geelnard 5 // Copyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.org> 6 // 7 // This software is provided 'as-is', without any express or implied 8 // warranty. In no event will the authors be held liable for any damages 9 // arising from the use of this software. 10 // 11 // Permission is granted to anyone to use this software for any purpose, 12 // including commercial applications, and to alter it and redistribute it 13 // freely, subject to the following restrictions: 14 // 15 // 1. The origin of this software must not be misrepresented; you must not 16 // claim that you wrote the original software. If you use this software 17 // in a product, an acknowledgment in the product documentation would 18 // be appreciated but is not required. 19 // 20 // 2. Altered source versions must be plainly marked as such, and must not 21 // be misrepresented as being the original software. 22 // 23 // 3. This notice may not be removed or altered from any source 24 // distribution. 25 // 26 //======================================================================== 27 28 #ifndef _glfw3_wgl_context_h_ 29 #define _glfw3_wgl_context_h_ 30 31 32 #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 33 #define WGL_SUPPORT_OPENGL_ARB 0x2010 34 #define WGL_DRAW_TO_WINDOW_ARB 0x2001 35 #define WGL_PIXEL_TYPE_ARB 0x2013 36 #define WGL_TYPE_RGBA_ARB 0x202b 37 #define WGL_ACCELERATION_ARB 0x2003 38 #define WGL_NO_ACCELERATION_ARB 0x2025 39 #define WGL_RED_BITS_ARB 0x2015 40 #define WGL_RED_SHIFT_ARB 0x2016 41 #define WGL_GREEN_BITS_ARB 0x2017 42 #define WGL_GREEN_SHIFT_ARB 0x2018 43 #define WGL_BLUE_BITS_ARB 0x2019 44 #define WGL_BLUE_SHIFT_ARB 0x201a 45 #define WGL_ALPHA_BITS_ARB 0x201b 46 #define WGL_ALPHA_SHIFT_ARB 0x201c 47 #define WGL_ACCUM_BITS_ARB 0x201d 48 #define WGL_ACCUM_RED_BITS_ARB 0x201e 49 #define WGL_ACCUM_GREEN_BITS_ARB 0x201f 50 #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 51 #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 52 #define WGL_DEPTH_BITS_ARB 0x2022 53 #define WGL_STENCIL_BITS_ARB 0x2023 54 #define WGL_AUX_BUFFERS_ARB 0x2024 55 #define WGL_STEREO_ARB 0x2012 56 #define WGL_DOUBLE_BUFFER_ARB 0x2011 57 #define WGL_SAMPLES_ARB 0x2042 58 #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9 59 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 60 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 61 #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 62 #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 63 #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 64 #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 65 #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 66 #define WGL_CONTEXT_FLAGS_ARB 0x2094 67 #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 68 #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 69 #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 70 #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 71 #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 72 #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 73 #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 74 #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 75 76 #define ERROR_INVALID_VERSION_ARB 0x2095 77 #define ERROR_INVALID_PROFILE_ARB 0x2096 78 79 typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int); 80 typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*); 81 typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void); 82 typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC); 83 typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*); 84 85 typedef HGLRC (WINAPI * WGLCREATECONTEXT_T)(HDC); 86 typedef BOOL (WINAPI * WGLDELETECONTEXT_T)(HGLRC); 87 typedef PROC (WINAPI * WGLGETPROCADDRESS_T)(LPCSTR); 88 typedef HDC (WINAPI * WGLGETCURRENTDC_T)(void); 89 typedef BOOL (WINAPI * WGLMAKECURRENT_T)(HDC,HGLRC); 90 typedef BOOL (WINAPI * WGLSHARELISTS_T)(HGLRC,HGLRC); 91 92 // opengl32.dll function pointer typedefs 93 #define wglCreateContext _glfw.wgl.CreateContext 94 #define wglDeleteContext _glfw.wgl.DeleteContext 95 #define wglGetProcAddress _glfw.wgl.GetProcAddress 96 #define wglGetCurrentDC _glfw.wgl.GetCurrentDC 97 #define wglMakeCurrent _glfw.wgl.MakeCurrent 98 #define wglShareLists _glfw.wgl.ShareLists 99 100 #define _GLFW_RECREATION_NOT_NEEDED 0 101 #define _GLFW_RECREATION_REQUIRED 1 102 #define _GLFW_RECREATION_IMPOSSIBLE 2 103 104 #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl 105 #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl 106 107 108 // WGL-specific per-context data 109 // 110 typedef struct _GLFWcontextWGL 111 { 112 HDC dc; 113 HGLRC handle; 114 int interval; 115 116 } _GLFWcontextWGL; 117 118 // WGL-specific global data 119 // 120 typedef struct _GLFWlibraryWGL 121 { 122 HINSTANCE instance; 123 WGLCREATECONTEXT_T CreateContext; 124 WGLDELETECONTEXT_T DeleteContext; 125 WGLGETPROCADDRESS_T GetProcAddress; 126 WGLGETCURRENTDC_T GetCurrentDC; 127 WGLMAKECURRENT_T MakeCurrent; 128 WGLSHARELISTS_T ShareLists; 129 130 GLFWbool extensionsLoaded; 131 132 PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT; 133 PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB; 134 PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT; 135 PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB; 136 PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; 137 GLFWbool EXT_swap_control; 138 GLFWbool ARB_multisample; 139 GLFWbool ARB_framebuffer_sRGB; 140 GLFWbool EXT_framebuffer_sRGB; 141 GLFWbool ARB_pixel_format; 142 GLFWbool ARB_create_context; 143 GLFWbool ARB_create_context_profile; 144 GLFWbool EXT_create_context_es2_profile; 145 GLFWbool ARB_create_context_robustness; 146 GLFWbool ARB_context_flush_control; 147 148 } _GLFWlibraryWGL; 149 150 151 GLFWbool _glfwInitWGL(void); 152 void _glfwTerminateWGL(void); 153 GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, 154 const _GLFWctxconfig* ctxconfig, 155 const _GLFWfbconfig* fbconfig); 156 157 #endif // _glfw3_wgl_context_h_ 158