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_X_H__
20 #define __GDK_GL_X_H__
21 
22 #include <gdk/gdkx.h>
23 
24 #include <X11/Xlib.h>
25 #include <X11/Xutil.h>
26 
27 #include <GL/gl.h>
28 #include <GL/glx.h>
29 
30 #include <gdk/x11/gdkglglxext.h>
31 
32 G_BEGIN_DECLS
33 
34 gboolean      gdk_x11_gl_query_glx_extension      (GdkGLConfig  *glconfig,
35                                                    const char   *extension);
36 
37 #ifndef GDK_MULTIHEAD_SAFE
38 GdkGLConfig  *gdk_x11_gl_config_new_from_visualid            (VisualID   xvisualid);
39 #endif /* GDK_MULTIHEAD_SAFE */
40 #ifdef GDKGLEXT_MULTIHEAD_SUPPORT
41 GdkGLConfig  *gdk_x11_gl_config_new_from_visualid_for_screen (GdkScreen *screen,
42                                                               VisualID   xvisualid);
43 #endif /* GDKGLEXT_MULTIHEAD_SUPPORT */
44 
45 Display      *gdk_x11_gl_config_get_xdisplay      (GdkGLConfig  *glconfig);
46 int           gdk_x11_gl_config_get_screen_number (GdkGLConfig  *glconfig);
47 XVisualInfo  *gdk_x11_gl_config_get_xvinfo        (GdkGLConfig  *glconfig);
48 gboolean      gdk_x11_gl_config_is_mesa_glx       (GdkGLConfig  *glconfig);
49 
50 GdkGLContext *gdk_x11_gl_context_foreign_new      (GdkGLConfig  *glconfig,
51                                                    GdkGLContext *share_list,
52                                                    GLXContext    glxcontext);
53 
54 GLXContext    gdk_x11_gl_context_get_glxcontext   (GdkGLContext *glcontext);
55 
56 GLXPixmap     gdk_x11_gl_pixmap_get_glxpixmap     (GdkGLPixmap  *glpixmap);
57 
58 Window        gdk_x11_gl_window_get_glxwindow     (GdkGLWindow  *glwindow);
59 
60 #ifdef INSIDE_GDK_GL_X11
61 
62 #define GDK_GL_CONFIG_XDISPLAY(glconfig)       (GDK_GL_CONFIG_IMPL_X11 (glconfig)->xdisplay)
63 #define GDK_GL_CONFIG_SCREEN_XNUMBER(glconfig) (GDK_GL_CONFIG_IMPL_X11 (glconfig)->screen_num)
64 #define GDK_GL_CONFIG_XVINFO(glconfig)         (GDK_GL_CONFIG_IMPL_X11 (glconfig)->xvinfo)
65 #define GDK_GL_CONFIG_XCOLORMAP(glconfig)      (GDK_COLORMAP_XCOLORMAP (GDK_GL_CONFIG_IMPL_X11 (glconfig)->colormap))
66 #define GDK_GL_CONTEXT_GLXCONTEXT(glcontext)   (GDK_GL_CONTEXT_IMPL_X11 (glcontext)->glxcontext)
67 #define GDK_GL_PIXMAP_GLXPIXMAP(glpixmap)      (GDK_GL_PIXMAP_IMPL_X11 (glpixmap)->glxpixmap)
68 #define GDK_GL_WINDOW_GLXWINDOW(glwindow)      (GDK_GL_WINDOW_IMPL_X11 (glwindow)->glxwindow)
69 
70 #else
71 
72 #define GDK_GL_CONFIG_XDISPLAY(glconfig)       (gdk_x11_gl_config_get_xdisplay (glconfig))
73 #define GDK_GL_CONFIG_SCREEN_XNUMBER(glconfig) (gdk_x11_gl_config_get_screen_number (glconfig))
74 #define GDK_GL_CONFIG_XVINFO(glconfig)         (gdk_x11_gl_config_get_xvinfo (glconfig))
75 #define GDK_GL_CONFIG_XCOLORMAP(glconfig)      (GDK_COLORMAP_XCOLORMAP (gdk_gl_config_get_colormap (glconfig)))
76 #define GDK_GL_CONTEXT_GLXCONTEXT(glcontext)   (gdk_x11_gl_context_get_glxcontext (glcontext))
77 #define GDK_GL_PIXMAP_GLXPIXMAP(glpixmap)      (gdk_x11_gl_pixmap_get_glxpixmap (glpixmap))
78 #define GDK_GL_WINDOW_GLXWINDOW(glwindow)      (gdk_x11_gl_window_get_glxwindow (glwindow))
79 
80 #endif
81 
82 G_END_DECLS
83 
84 #endif /* __GDK_GL_X_H__ */
85