mirror of
				https://github.com/glfw/glfw.git
				synced 2025-10-30 20:22:30 +00:00 
			
		
		
		
	Make WGL backend more readable
This commit is contained in:
		
							parent
							
								
									66b462d6e1
								
							
						
					
					
						commit
						0a3b5952e0
					
				| @ -39,21 +39,21 @@ static void loadExtensions(void) | |||||||
|     // Functions for WGL_EXT_extension_string
 |     // Functions for WGL_EXT_extension_string
 | ||||||
|     // NOTE: These are needed by _glfwPlatformExtensionSupported
 |     // NOTE: These are needed by _glfwPlatformExtensionSupported
 | ||||||
|     _glfw.wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) |     _glfw.wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) | ||||||
|         _glfw_wglGetProcAddress("wglGetExtensionsStringEXT"); |         wglGetProcAddress("wglGetExtensionsStringEXT"); | ||||||
|     _glfw.wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC) |     _glfw.wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC) | ||||||
|         _glfw_wglGetProcAddress("wglGetExtensionsStringARB"); |         wglGetProcAddress("wglGetExtensionsStringARB"); | ||||||
| 
 | 
 | ||||||
|     // Functions for WGL_ARB_create_context
 |     // Functions for WGL_ARB_create_context
 | ||||||
|     _glfw.wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) |     _glfw.wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) | ||||||
|         _glfw_wglGetProcAddress("wglCreateContextAttribsARB"); |         wglGetProcAddress("wglCreateContextAttribsARB"); | ||||||
| 
 | 
 | ||||||
|     // Functions for WGL_EXT_swap_control
 |     // Functions for WGL_EXT_swap_control
 | ||||||
|     _glfw.wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) |     _glfw.wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) | ||||||
|         _glfw_wglGetProcAddress("wglSwapIntervalEXT"); |         wglGetProcAddress("wglSwapIntervalEXT"); | ||||||
| 
 | 
 | ||||||
|     // Functions for WGL_ARB_pixel_format
 |     // Functions for WGL_ARB_pixel_format
 | ||||||
|     _glfw.wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC) |     _glfw.wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC) | ||||||
|         _glfw_wglGetProcAddress("wglGetPixelFormatAttribivARB"); |         wglGetProcAddress("wglGetPixelFormatAttribivARB"); | ||||||
| 
 | 
 | ||||||
|     // This needs to include every extension used below except for
 |     // This needs to include every extension used below except for
 | ||||||
|     // WGL_ARB_extensions_string and WGL_EXT_extensions_string
 |     // WGL_ARB_extensions_string and WGL_EXT_extensions_string
 | ||||||
| @ -457,8 +457,7 @@ int _glfwCreateContext(_GLFWwindow* window, | |||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|         window->context.wgl.handle = |         window->context.wgl.handle = wglCreateContext(window->context.wgl.dc); | ||||||
|             _glfw_wglCreateContext(window->context.wgl.dc); |  | ||||||
|         if (!window->context.wgl.handle) |         if (!window->context.wgl.handle) | ||||||
|         { |         { | ||||||
|             _glfwInputError(GLFW_VERSION_UNAVAILABLE, |             _glfwInputError(GLFW_VERSION_UNAVAILABLE, | ||||||
| @ -468,7 +467,7 @@ int _glfwCreateContext(_GLFWwindow* window, | |||||||
| 
 | 
 | ||||||
|         if (share) |         if (share) | ||||||
|         { |         { | ||||||
|             if (!_glfw_wglShareLists(share, window->context.wgl.handle)) |             if (!wglShareLists(share, window->context.wgl.handle)) | ||||||
|             { |             { | ||||||
|                 _glfwInputError(GLFW_PLATFORM_ERROR, |                 _glfwInputError(GLFW_PLATFORM_ERROR, | ||||||
|                                 "WGL: Failed to enable sharing with specified OpenGL context"); |                                 "WGL: Failed to enable sharing with specified OpenGL context"); | ||||||
| @ -488,7 +487,7 @@ void _glfwDestroyContext(_GLFWwindow* window) | |||||||
| { | { | ||||||
|     if (window->context.wgl.handle) |     if (window->context.wgl.handle) | ||||||
|     { |     { | ||||||
|         _glfw_wglDeleteContext(window->context.wgl.handle); |         wglDeleteContext(window->context.wgl.handle); | ||||||
|         window->context.wgl.handle = NULL; |         window->context.wgl.handle = NULL; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -597,12 +596,9 @@ int _glfwAnalyzeContext(_GLFWwindow* window, | |||||||
| void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) | void _glfwPlatformMakeContextCurrent(_GLFWwindow* window) | ||||||
| { | { | ||||||
|     if (window) |     if (window) | ||||||
|     { |         wglMakeCurrent(window->context.wgl.dc, window->context.wgl.handle); | ||||||
|         _glfw_wglMakeCurrent(window->context.wgl.dc, |  | ||||||
|                              window->context.wgl.handle); |  | ||||||
|     } |  | ||||||
|     else |     else | ||||||
|         _glfw_wglMakeCurrent(NULL, NULL); |         wglMakeCurrent(NULL, NULL); | ||||||
| 
 | 
 | ||||||
|     _glfwSetContextTLS(window); |     _glfwSetContextTLS(window); | ||||||
| } | } | ||||||
| @ -666,7 +662,7 @@ int _glfwPlatformExtensionSupported(const char* extension) | |||||||
| 
 | 
 | ||||||
| GLFWglproc _glfwPlatformGetProcAddress(const char* procname) | GLFWglproc _glfwPlatformGetProcAddress(const char* procname) | ||||||
| { | { | ||||||
|     const GLFWglproc proc = (GLFWglproc) _glfw_wglGetProcAddress(procname); |     const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname); | ||||||
|     if (proc) |     if (proc) | ||||||
|         return proc; |         return proc; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -86,11 +86,11 @@ typedef BOOL (WINAPI * WGLMAKECURRENT_T)(HDC,HGLRC); | |||||||
| typedef BOOL (WINAPI * WGLSHARELISTS_T)(HGLRC,HGLRC); | typedef BOOL (WINAPI * WGLSHARELISTS_T)(HGLRC,HGLRC); | ||||||
| 
 | 
 | ||||||
| // opengl32.dll function pointer typedefs
 | // opengl32.dll function pointer typedefs
 | ||||||
| #define _glfw_wglCreateContext _glfw.wgl.CreateContext | #define wglCreateContext _glfw.wgl.CreateContext | ||||||
| #define _glfw_wglDeleteContext _glfw.wgl.DeleteContext | #define wglDeleteContext _glfw.wgl.DeleteContext | ||||||
| #define _glfw_wglGetProcAddress _glfw.wgl.GetProcAddress | #define wglGetProcAddress _glfw.wgl.GetProcAddress | ||||||
| #define _glfw_wglMakeCurrent _glfw.wgl.MakeCurrent | #define wglMakeCurrent _glfw.wgl.MakeCurrent | ||||||
| #define _glfw_wglShareLists _glfw.wgl.ShareLists | #define wglShareLists _glfw.wgl.ShareLists | ||||||
| 
 | 
 | ||||||
| #define _GLFW_RECREATION_NOT_NEEDED 0 | #define _GLFW_RECREATION_NOT_NEEDED 0 | ||||||
| #define _GLFW_RECREATION_REQUIRED   1 | #define _GLFW_RECREATION_REQUIRED   1 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user