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_WIN32_H__
20 #define __GDK_GL_WIN32_H__
21 
22 #include <gdk/gdkwin32.h>
23 
24 #ifndef STRICT
25 #define STRICT                  /* We want strict type checks */
26 #endif
27 #define WIN32_LEAN_AND_MEAN 1
28 #include <windows.h>
29 
30 #include <GL/gl.h>
31 
32 #include <gdk/win32/gdkglwglext.h>
33 
34 /* MinGW's wingdi.h bug. */
35 #ifndef PFD_SWAP_LAYER_BUFFERS
36 #define PFD_SWAP_LAYER_BUFFERS      0x00000800
37 #endif
38 
39 G_BEGIN_DECLS
40 
41 gboolean               gdk_win32_gl_query_wgl_extension     (GdkGLConfig   *glconfig,
42                                                              const char    *extension);
43 
44 GdkGLConfig           *gdk_win32_gl_config_new_from_pixel_format (int pixel_format);
45 
46 PIXELFORMATDESCRIPTOR *gdk_win32_gl_config_get_pfd          (GdkGLConfig   *glconfig);
47 
48 GdkGLContext          *gdk_win32_gl_context_foreign_new     (GdkGLConfig   *glconfig,
49                                                              GdkGLContext  *share_list,
50                                                              HGLRC          hglrc);
51 
52 HGLRC                  gdk_win32_gl_context_get_hglrc       (GdkGLContext  *glcontext);
53 
54 HDC                    gdk_win32_gl_drawable_hdc_get        (GdkGLDrawable *gldrawable);
55 void                   gdk_win32_gl_drawable_hdc_release    (GdkGLDrawable *gldrawable);
56 
57 PIXELFORMATDESCRIPTOR *gdk_win32_gl_pixmap_get_pfd          (GdkGLPixmap   *glpixmap);
58 int                    gdk_win32_gl_pixmap_get_pixel_format (GdkGLPixmap   *glpixmap);
59 
60 PIXELFORMATDESCRIPTOR *gdk_win32_gl_window_get_pfd          (GdkGLWindow   *glwindow);
61 int                    gdk_win32_gl_window_get_pixel_format (GdkGLWindow   *glwindow);
62 
63 #ifdef INSIDE_GDK_GL_WIN32
64 
65 #define GDK_GL_CONFIG_PFD(glconfig)          (&(GDK_GL_CONFIG_IMPL_WIN32 (glconfig)->pfd))
66 #define GDK_GL_CONTEXT_HGLRC(glcontext)      (GDK_GL_CONTEXT_IMPL_WIN32 (glcontext)->hglrc)
67 #define GDK_GL_PIXMAP_PFD(glpixmap)          (&(GDK_GL_PIXMAP_IMPL_WIN32 (glpixmap)->pfd))
68 #define GDK_GL_PIXMAP_PIXEL_FORMAT(glpixmap) (GDK_GL_PIXMAP_IMPL_WIN32 (glpixmap)->pixel_format)
69 #define GDK_GL_WINDOW_PFD(glwindow)          (&(GDK_GL_WINDOW_IMPL_WIN32 (glwindow)->pfd))
70 #define GDK_GL_WINDOW_PIXEL_FORMAT(glwindow) (GDK_GL_WINDOW_IMPL_WIN32 (glwindow)->pixel_format)
71 
72 #else
73 
74 #define GDK_GL_CONFIG_PFD(glconfig)          (gdk_win32_gl_config_get_pfd (glconfig))
75 #define GDK_GL_CONTEXT_HGLRC(glcontext)      (gdk_win32_gl_context_get_hglrc (glcontext))
76 #define GDK_GL_PIXMAP_PFD(glpixmap)          (gdk_win32_gl_pixmap_get_pfd (glpixmap))
77 #define GDK_GL_PIXMAP_PIXEL_FORMAT(glpixmap) (gdk_win32_gl_pixmap_get_pixel_format (glpixmap))
78 #define GDK_GL_WINDOW_PFD(glwindow)          (gdk_win32_gl_window_get_pfd (glwindow))
79 #define GDK_GL_WINDOW_PIXEL_FORMAT(glwindow) (gdk_win32_gl_window_get_pixel_format (glwindow))
80 
81 #endif
82 
83 G_END_DECLS
84 
85 #endif /* __GDK_GL_WIN32_H__ */
86