1 /* 2 * Copyright (C) 2001-2015, AdaCore 3 * Copyright (C) 1998 Janne L�f <jlof@mail.student.oulu.fi> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public 16 * License along with this library; if not, write to the Free 17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 #ifndef __GDK_GL_H__ 21 #define __GDK_GL_H__ 22 23 #include <glib.h> 24 #include <cairo/cairo.h> 25 26 #ifdef G_OS_WIN32 27 /* The GL/gl.h on Windows requires you to include <windows.h> 28 * anyway, so we might as well include it here. 29 */ 30 #include <windows.h> 31 #endif 32 33 #include <gdk/gdk.h> 34 35 G_BEGIN_DECLS 36 37 /* 38 * These definitions are duplicated from GL/glx.h that comes with Mesa. 39 * I don't want every program to include GL/glx.h because GtkGLArea 40 * supports lecacy systems like Windows. You can still use GLX_xxxx 41 * attributes with these, but then you lose portability. 42 */ 43 enum _GDK_GL_CONFIGS { 44 GDK_GL_NONE = 0, 45 GDK_GL_USE_GL = 1, 46 GDK_GL_BUFFER_SIZE = 2, 47 GDK_GL_LEVEL = 3, 48 GDK_GL_RGBA = 4, 49 GDK_GL_DOUBLEBUFFER = 5, 50 GDK_GL_STEREO = 6, 51 GDK_GL_AUX_BUFFERS = 7, 52 GDK_GL_RED_SIZE = 8, 53 GDK_GL_GREEN_SIZE = 9, 54 GDK_GL_BLUE_SIZE = 10, 55 GDK_GL_ALPHA_SIZE = 11, 56 GDK_GL_DEPTH_SIZE = 12, 57 GDK_GL_STENCIL_SIZE = 13, 58 GDK_GL_ACCUM_RED_SIZE = 14, 59 GDK_GL_ACCUM_GREEN_SIZE = 15, 60 GDK_GL_ACCUM_BLUE_SIZE = 16, 61 GDK_GL_ACCUM_ALPHA_SIZE = 17, 62 63 /* GLX_EXT_visual_info extension */ 64 GDK_GL_X_VISUAL_TYPE_EXT = 0x22, 65 GDK_GL_TRANSPARENT_TYPE_EXT = 0x23, 66 GDK_GL_TRANSPARENT_INDEX_VALUE_EXT = 0x24, 67 GDK_GL_TRANSPARENT_RED_VALUE_EXT = 0x25, 68 GDK_GL_TRANSPARENT_GREEN_VALUE_EXT = 0x26, 69 GDK_GL_TRANSPARENT_BLUE_VALUE_EXT = 0x27, 70 GDK_GL_TRANSPARENT_ALPHA_VALUE_EXT = 0x28 71 }; 72 73 74 #define GDK_TYPE_GL_CONTEXT (gdk_gl_context_get_type()) 75 #define GDK_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContext)) 76 #define GDK_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, GDK_TYPE_GL_CONTEXT, GdkGLContextClass)) 77 #define GDK_IS_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_GL_CONTEXT)) 78 #define GDK_IS_GL_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GL_CONTEXT)) 79 #define GDK_GL_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GL_CONTEXT, GdkGLContext)) 80 81 typedef struct _GdkGLContext GdkGLContext; 82 83 84 gint gdk_gl_query(void); 85 gchar *gdk_gl_get_info(void); 86 87 GdkVisual *gdk_gl_choose_visual(int *attrlist); 88 int gdk_gl_get_config(GdkVisual *visual, int attrib); 89 90 GType gdk_gl_context_get_type(void); 91 GdkGLContext *gdk_gl_context_new(GdkVisual *visual); 92 GdkGLContext *gdk_gl_context_share_new(GdkVisual *visual, GdkGLContext *sharelist, gint direct); 93 GdkGLContext *gdk_gl_context_attrlist_share_new(int *attrlist, GdkGLContext *sharelist, gint direct); 94 95 gint gdk_gl_make_current(GdkWindow *window, GdkGLContext *context); 96 void gdk_gl_swap_buffers(GdkWindow *window); 97 98 99 void gdk_gl_wait_gdk(void); 100 void gdk_gl_wait_gl(void); 101 102 /* fonts */ 103 // void gdk_gl_use_gdk_font(GdkFont *font, int first, int count, int list_base); 104 105 106 #ifndef GTKGL_DISABLE_DEPRECATED 107 # define gdk_gl_context_ref(context) g_object_ref(context) 108 # define gdk_gl_context_unref(context) g_object_unref(context) 109 # define gdk_gl_pixmap_ref(pixmap) g_object_ref(pixmap) 110 # define gdk_gl_pixmap_unref(pixmap) g_object_unref(pixmap) 111 #endif 112 113 G_END_DECLS 114 115 #endif /* __GDK_GL_H__ */ 116 117