2014-12-17 04:32:04 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
*
|
|
|
|
* gdkglcontext-win32.h: Private Win32 specific OpenGL wrappers
|
|
|
|
*
|
|
|
|
* Copyright © 2014 Chun-wei Fan
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GDK_WIN32_GL_CONTEXT__
|
|
|
|
#define __GDK_WIN32_GL_CONTEXT__
|
|
|
|
|
|
|
|
#include <epoxy/gl.h>
|
|
|
|
#include <epoxy/wgl.h>
|
|
|
|
|
2021-10-07 07:26:49 +00:00
|
|
|
#ifdef HAVE_EGL
|
2018-07-31 10:11:26 +00:00
|
|
|
# include <epoxy/egl.h>
|
|
|
|
#endif
|
|
|
|
|
2014-12-17 04:32:04 +00:00
|
|
|
#include "gdkglcontextprivate.h"
|
|
|
|
#include "gdkdisplayprivate.h"
|
2018-03-20 10:46:11 +00:00
|
|
|
#include "gdksurface.h"
|
2014-12-17 04:32:04 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
Split out WGL/EGL stuff and simplify things
This commit attempts to split GdkWin32GLContext into two parts, one for
WGL and the other for EGL (ANGLE), and attempts to simplify things a
bit, by:
* We are already creating a Win32 window to capture display changes,
so we can just use that to act as our dummy window that we use to
find out the pixel format that the system supports for WGL. We also
use it to obtain the dummy legacy WGL context that we will always
require to create our more advanced Core WGL contexts.
* Like what is done in X11, store up the WGL pixel format or the
EGLConfig in our GdkWin32Display.
* Ensure we do not create the dummy WGL context unnecessarily.
In this way, we can successfully create the WGL/EGL contexts, however
there are some issues at this point:
* For WGL, the code successfully initializes and realizes the WGL
Contexts, but for some reason things became invisible. When running
gtk4-demo, this can be verified by seeing the mouse cursor changing
when moved to spots where one can resize the window, although they
were invisible.
* For EGL, the code initializes EGL but could not realize the EGL
context as shaders failed to compile. It seems like the shader issue
is definitely outside the scope of this MR.
2021-07-14 09:46:31 +00:00
|
|
|
#define GDK_WIN32_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_GL_CONTEXT, GdkWin32GLContextClass))
|
|
|
|
#define GDK_WIN32_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_GL_CONTEXT, GdkWin32GLContextClass))
|
|
|
|
#define GDK_WIN32_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_GL_CONTEXT))
|
|
|
|
|
2014-12-17 04:32:04 +00:00
|
|
|
struct _GdkWin32GLContext
|
|
|
|
{
|
|
|
|
GdkGLContext parent_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GdkWin32GLContextClass
|
|
|
|
{
|
|
|
|
GdkGLContextClass parent_class;
|
|
|
|
};
|
|
|
|
|
Split out WGL/EGL stuff and simplify things
This commit attempts to split GdkWin32GLContext into two parts, one for
WGL and the other for EGL (ANGLE), and attempts to simplify things a
bit, by:
* We are already creating a Win32 window to capture display changes,
so we can just use that to act as our dummy window that we use to
find out the pixel format that the system supports for WGL. We also
use it to obtain the dummy legacy WGL context that we will always
require to create our more advanced Core WGL contexts.
* Like what is done in X11, store up the WGL pixel format or the
EGLConfig in our GdkWin32Display.
* Ensure we do not create the dummy WGL context unnecessarily.
In this way, we can successfully create the WGL/EGL contexts, however
there are some issues at this point:
* For WGL, the code successfully initializes and realizes the WGL
Contexts, but for some reason things became invisible. When running
gtk4-demo, this can be verified by seeing the mouse cursor changing
when moved to spots where one can resize the window, although they
were invisible.
* For EGL, the code initializes EGL but could not realize the EGL
context as shaders failed to compile. It seems like the shader issue
is definitely outside the scope of this MR.
2021-07-14 09:46:31 +00:00
|
|
|
/* WGL */
|
|
|
|
#define GDK_TYPE_WIN32_GL_CONTEXT_WGL (gdk_win32_gl_context_wgl_get_type())
|
|
|
|
#define GDK_WIN32_GL_CONTEXT_WGL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WIN32_GL_CONTEXT_WGL, GdkWin32GLContextWGL))
|
|
|
|
#define GDK_IS_WIN32_GL_CONTEXT_WGL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WIN32_GL_CONTEXT_WGL))
|
|
|
|
|
|
|
|
typedef struct _GdkWin32GLContextWGL GdkWin32GLContextWGL;
|
|
|
|
|
|
|
|
gboolean gdk_win32_display_init_wgl (GdkDisplay *display,
|
|
|
|
GError **error);
|
|
|
|
void gdk_win32_gl_context_wgl_bind_surface (GdkWin32GLContextWGL *ctx,
|
|
|
|
GdkWin32Surface *win32_surface);
|
|
|
|
|
|
|
|
GType gdk_win32_gl_context_wgl_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
/* EGL */
|
|
|
|
#define GDK_TYPE_WIN32_GL_CONTEXT_EGL (gdk_win32_gl_context_egl_get_type())
|
|
|
|
#define GDK_WIN32_GL_CONTEXT_EGL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WIN32_GL_CONTEXT_EGL, GdkWin32GLContextEGL))
|
|
|
|
#define GDK_IS_WIN32_GL_CONTEXT_EGL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WIN32_GL_CONTEXT_EGL))
|
|
|
|
|
|
|
|
typedef struct _GdkWin32GLContextEGL GdkWin32GLContextEGL;
|
|
|
|
|
|
|
|
gboolean gdk_win32_display_init_egl (GdkDisplay *display,
|
|
|
|
GError **error);
|
|
|
|
void gdk_win32_surface_destroy_egl_surface (GdkWin32Surface *self);
|
|
|
|
|
|
|
|
GType gdk_win32_gl_context_egl_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2018-07-31 10:11:26 +00:00
|
|
|
void
|
|
|
|
_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface);
|
2014-12-17 04:32:04 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GDK_WIN32_GL_CONTEXT__ */
|