1 /* GdkGLExt - OpenGL Extension to GDK
2  * Copyright (C) 2002-2004  Naofumi Yasufuku
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
17  */
18 
19 #ifndef __GDK_GL_CONFIG_H__
20 #define __GDK_GL_CONFIG_H__
21 
22 #include <gdk/gdkgldefs.h>
23 #include <gdk/gdkgltypes.h>
24 
25 #include <gdk/gdkwindow.h>
26 
27 G_BEGIN_DECLS
28 
29 /*
30  * Display mode bit masks.
31  */
32 typedef enum
33 {
34   GDK_GL_MODE_RGB         = 0,
35   GDK_GL_MODE_RGBA        = 0,       /* same as RGB */
36   GDK_GL_MODE_INDEX       = 1 << 0,
37   GDK_GL_MODE_SINGLE      = 0,
38   GDK_GL_MODE_DOUBLE      = 1 << 1,
39   GDK_GL_MODE_STEREO      = 1 << 2,
40   GDK_GL_MODE_ALPHA       = 1 << 3,
41   GDK_GL_MODE_DEPTH       = 1 << 4,
42   GDK_GL_MODE_STENCIL     = 1 << 5,
43   GDK_GL_MODE_ACCUM       = 1 << 6,
44   GDK_GL_MODE_MULTISAMPLE = 1 << 7   /* not supported yet */
45 } GdkGLConfigMode;
46 
47 typedef struct _GdkGLConfigClass GdkGLConfigClass;
48 
49 #define GDK_TYPE_GL_CONFIG              (gdk_gl_config_get_type ())
50 #define GDK_GL_CONFIG(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GL_CONFIG, GdkGLConfig))
51 #define GDK_GL_CONFIG_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GL_CONFIG, GdkGLConfigClass))
52 #define GDK_IS_GL_CONFIG(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GL_CONFIG))
53 #define GDK_IS_GL_CONFIG_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONFIG))
54 #define GDK_GL_CONFIG_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONFIG, GdkGLConfigClass))
55 
56 struct _GdkGLConfig
57 {
58   GObject parent_instance;
59 
60   gint layer_plane;
61 
62   gint n_aux_buffers;
63 
64   gint n_sample_buffers;
65 
66   guint is_rgba            : 1;
67   guint is_double_buffered : 1;
68   guint as_single_mode     : 1;
69   guint is_stereo          : 1;
70   guint has_alpha          : 1;
71   guint has_depth_buffer   : 1;
72   guint has_stencil_buffer : 1;
73   guint has_accum_buffer   : 1;
74 };
75 
76 struct _GdkGLConfigClass
77 {
78   GObjectClass parent_class;
79 };
80 
81 GType        gdk_gl_config_get_type               (void);
82 
83 #ifndef GDK_MULTIHEAD_SAFE
84 GdkGLConfig *gdk_gl_config_new                    (const int       *attrib_list);
85 #endif /* GDK_MULTIHEAD_SAFE */
86 
87 #ifdef GDKGLEXT_MULTIHEAD_SUPPORT
88 GdkGLConfig *gdk_gl_config_new_for_screen         (GdkScreen       *screen,
89                                                    const int       *attrib_list);
90 #endif /* GDKGLEXT_MULTIHEAD_SUPPORT */
91 
92 #ifndef GDK_MULTIHEAD_SAFE
93 GdkGLConfig *gdk_gl_config_new_by_mode            (GdkGLConfigMode  mode);
94 #endif /* GDK_MULTIHEAD_SAFE */
95 
96 #ifdef GDKGLEXT_MULTIHEAD_SUPPORT
97 GdkGLConfig *gdk_gl_config_new_by_mode_for_screen (GdkScreen       *screen,
98                                                    GdkGLConfigMode  mode);
99 #endif /* GDKGLEXT_MULTIHEAD_SUPPORT */
100 
101 GdkScreen   *gdk_gl_config_get_screen             (GdkGLConfig     *glconfig);
102 
103 gboolean     gdk_gl_config_get_attrib             (GdkGLConfig     *glconfig,
104                                                    int              attribute,
105                                                    int             *value);
106 
107 GdkColormap *gdk_gl_config_get_colormap           (GdkGLConfig     *glconfig);
108 
109 GdkVisual   *gdk_gl_config_get_visual             (GdkGLConfig     *glconfig);
110 
111 gint         gdk_gl_config_get_depth              (GdkGLConfig     *glconfig);
112 
113 gint         gdk_gl_config_get_layer_plane        (GdkGLConfig     *glconfig);
114 
115 gint         gdk_gl_config_get_n_aux_buffers      (GdkGLConfig     *glconfig);
116 
117 gint         gdk_gl_config_get_n_sample_buffers   (GdkGLConfig     *glconfig);
118 
119 gboolean     gdk_gl_config_is_rgba                (GdkGLConfig     *glconfig);
120 
121 gboolean     gdk_gl_config_is_double_buffered     (GdkGLConfig     *glconfig);
122 
123 gboolean     gdk_gl_config_is_stereo              (GdkGLConfig     *glconfig);
124 
125 gboolean     gdk_gl_config_has_alpha              (GdkGLConfig     *glconfig);
126 
127 gboolean     gdk_gl_config_has_depth_buffer       (GdkGLConfig     *glconfig);
128 
129 gboolean     gdk_gl_config_has_stencil_buffer     (GdkGLConfig     *glconfig);
130 
131 gboolean     gdk_gl_config_has_accum_buffer       (GdkGLConfig     *glconfig);
132 
133 G_END_DECLS
134 
135 #endif /* __GDK_GL_CONFIG_H__ */
136