| 1 |
/* GDK - The GIMP Drawing Kit |
| 2 |
* |
| 3 |
* gdkglcontext-win32-wgl-private.c: Win32 specific OpenGL wrappers |
| 4 |
* |
| 5 |
* Copyright © 2023 Chun-wei Fan |
| 6 |
* |
| 7 |
* This library is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU Library General Public |
| 9 |
* License as published by the Free Software Foundation; either |
| 10 |
* version 2 of the License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This library is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
* Library General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU Library General Public |
| 18 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
/* |
| 22 |
* These wrapper functions are used when we don't want to use the wgl*() core functions |
| 23 |
* that we acquire via libepoxy (such as when we are disposing the underlying WGL context in, |
| 24 |
* GdkGLContext from different threads, so for these calls, we are actually linking to the |
| 25 |
* system's/ICD opengl32.dll directly, so that we are guaranteed that the "right" versions of |
| 26 |
* these WGL calls are carried out. This must be a separate source file because we can't |
| 27 |
* include the system's GL/gl.h with epoxy/(w)gl.h together in a single source file. We |
| 28 |
* should not need to use these when we are creating/initializing a WGL context in GDK, since |
| 29 |
* we should be in the same thread at this point. |
| 30 |
*/ |
| 31 |
|
| 32 |
#define DONT_INCLUDE_LIBEPOXY |
| 33 |
#define WIN32_LEAN_AND_MEAN |
| 34 |
#include <windows.h> |
| 35 |
#include <GL/gl.h> |
| 36 |
|
| 37 |
#include "gdkglcontext-win32.h" |
| 38 |
|
| 39 |
void |
| 40 |
gdk_win32_private_wglDeleteContext (HGLRC hglrc) |
| 41 |
{ |
| 42 |
wglDeleteContext (hglrc); |
| 43 |
} |
| 44 |
|
| 45 |
HGLRC |
| 46 |
gdk_win32_private_wglGetCurrentContext (void) |
| 47 |
{ |
| 48 |
return wglGetCurrentContext (); |
| 49 |
} |
| 50 |
|
| 51 |
BOOL |
| 52 |
gdk_win32_private_wglMakeCurrent (HDC hdc, |
| 53 |
HGLRC hglrc) |
| 54 |
{ |
| 55 |
return wglMakeCurrent (hdc, hglrc); |
| 56 |
} |