1 | /* GDK - The GIMP Drawing Kit |
2 | * |
3 | * gdkglcontext.h: GL context abstraction |
4 | * |
5 | * Copyright © 2014 Emmanuele Bassi |
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 | #ifndef __GDK_GL_CONTEXT_H__ |
22 | #define __GDK_GL_CONTEXT_H__ |
23 | |
24 | #if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION) |
25 | #error "Only <gdk/gdk.h> can be included directly." |
26 | #endif |
27 | |
28 | #include <gdk/gdkversionmacros.h> |
29 | #include <gdk/gdktypes.h> |
30 | |
31 | G_BEGIN_DECLS |
32 | |
33 | /** |
34 | * GdkGLAPI: |
35 | * @GDK_GL_API_GL: The OpenGL API |
36 | * @GDK_GL_API_GLES: The OpenGL ES API |
37 | * |
38 | * The list of the different APIs that GdkGLContext can potentially support. |
39 | * |
40 | * Since: 4.6 |
41 | */ |
42 | typedef enum { /*< underscore_name=GDK_GL_API >*/ |
43 | GDK_GL_API_GL = 1 << 0, |
44 | GDK_GL_API_GLES = 1 << 1 |
45 | } GdkGLAPI; |
46 | |
47 | #define GDK_TYPE_GL_CONTEXT (gdk_gl_context_get_type ()) |
48 | #define GDK_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContext)) |
49 | #define GDK_IS_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_GL_CONTEXT)) |
50 | |
51 | #define GDK_GL_ERROR (gdk_gl_error_quark ()) |
52 | |
53 | GDK_AVAILABLE_IN_ALL |
54 | GQuark gdk_gl_error_quark (void); |
55 | |
56 | GDK_AVAILABLE_IN_ALL |
57 | GType gdk_gl_context_get_type (void) G_GNUC_CONST; |
58 | |
59 | GDK_AVAILABLE_IN_ALL |
60 | GdkDisplay * gdk_gl_context_get_display (GdkGLContext *context); |
61 | GDK_AVAILABLE_IN_ALL |
62 | GdkSurface * gdk_gl_context_get_surface (GdkGLContext *context); |
63 | GDK_DEPRECATED_IN_4_4_FOR(gdk_gl_context_is_shared) |
64 | GdkGLContext * gdk_gl_context_get_shared_context (GdkGLContext *context); |
65 | GDK_AVAILABLE_IN_ALL |
66 | void gdk_gl_context_get_version (GdkGLContext *context, |
67 | int *major, |
68 | int *minor); |
69 | GDK_AVAILABLE_IN_ALL |
70 | gboolean gdk_gl_context_is_legacy (GdkGLContext *context); |
71 | GDK_AVAILABLE_IN_4_4 |
72 | gboolean gdk_gl_context_is_shared (GdkGLContext *self, |
73 | GdkGLContext *other); |
74 | |
75 | GDK_AVAILABLE_IN_ALL |
76 | void gdk_gl_context_set_required_version (GdkGLContext *context, |
77 | int major, |
78 | int minor); |
79 | GDK_AVAILABLE_IN_ALL |
80 | void gdk_gl_context_get_required_version (GdkGLContext *context, |
81 | int *major, |
82 | int *minor); |
83 | GDK_AVAILABLE_IN_ALL |
84 | void gdk_gl_context_set_debug_enabled (GdkGLContext *context, |
85 | gboolean enabled); |
86 | GDK_AVAILABLE_IN_ALL |
87 | gboolean gdk_gl_context_get_debug_enabled (GdkGLContext *context); |
88 | GDK_AVAILABLE_IN_ALL |
89 | void gdk_gl_context_set_forward_compatible (GdkGLContext *context, |
90 | gboolean compatible); |
91 | GDK_AVAILABLE_IN_ALL |
92 | gboolean gdk_gl_context_get_forward_compatible (GdkGLContext *context); |
93 | GDK_AVAILABLE_IN_4_6 |
94 | void gdk_gl_context_set_allowed_apis (GdkGLContext *self, |
95 | GdkGLAPI apis); |
96 | GDK_AVAILABLE_IN_4_6 |
97 | GdkGLAPI gdk_gl_context_get_allowed_apis (GdkGLContext *self); |
98 | GDK_AVAILABLE_IN_4_6 |
99 | GdkGLAPI gdk_gl_context_get_api (GdkGLContext *self); |
100 | GDK_DEPRECATED_IN_4_6_FOR(gdk_gl_context_set_allowed_apis) |
101 | void gdk_gl_context_set_use_es (GdkGLContext *context, |
102 | int use_es); |
103 | GDK_AVAILABLE_IN_ALL |
104 | gboolean gdk_gl_context_get_use_es (GdkGLContext *context); |
105 | |
106 | GDK_AVAILABLE_IN_ALL |
107 | gboolean gdk_gl_context_realize (GdkGLContext *context, |
108 | GError **error); |
109 | |
110 | GDK_AVAILABLE_IN_ALL |
111 | void gdk_gl_context_make_current (GdkGLContext *context); |
112 | GDK_AVAILABLE_IN_ALL |
113 | GdkGLContext * gdk_gl_context_get_current (void); |
114 | GDK_AVAILABLE_IN_ALL |
115 | void gdk_gl_context_clear_current (void); |
116 | |
117 | G_END_DECLS |
118 | |
119 | #endif /* __GDK_GL_CONTEXT_H__ */ |
120 | |