Mercurial > sdl-ios-xcode
annotate src/video/win32/SDL_win32opengl.h @ 4504:9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 08 Jul 2010 23:07:34 -0700 |
parents | f7b03b6838cb |
children |
rev | line source |
---|---|
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #ifndef _SDL_win32opengl_h |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #define _SDL_win32opengl_h |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
1952
420716272158
Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
1936
diff
changeset
|
27 #if SDL_VIDEO_OPENGL_WGL |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 struct SDL_GLDriverData |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 { |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 int WGL_ARB_pixel_format; |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 void *(WINAPI * wglGetProcAddress) (const char *proc); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 HGLRC(WINAPI * wglCreateContext) (HDC hdc); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 const int *piAttribIList, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 const FLOAT * pfAttribFList, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 UINT nMaxFormats, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 int *piFormats, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 UINT * nNumFormats); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 int iLayerPlane, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 UINT nAttributes, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 const int *piAttributes, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 int *piValues); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 void (WINAPI * wglSwapIntervalEXT) (int interval); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 int (WINAPI * wglGetSwapIntervalEXT) (void); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 }; |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 /* OpenGL functions */ |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 extern int WIN_GL_LoadLibrary(_THIS, const char *path); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 extern void *WIN_GL_GetProcAddress(_THIS, const char *proc); |
3057
089a77aebb7d
Added test program for SDL_CreateWindowFrom()
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
55 extern void WIN_GL_UnloadLibrary(_THIS); |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window, |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 SDL_GLContext context); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 extern int WIN_GL_SetSwapInterval(_THIS, int interval); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 extern int WIN_GL_GetSwapInterval(_THIS); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 extern void WIN_GL_SwapWindow(_THIS, SDL_Window * window); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context); |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 #ifndef WGL_ARB_pixel_format |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 #define WGL_DRAW_TO_WINDOW_ARB 0x2001 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 #define WGL_DRAW_TO_BITMAP_ARB 0x2002 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 #define WGL_ACCELERATION_ARB 0x2003 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 #define WGL_NEED_PALETTE_ARB 0x2004 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 #define WGL_SWAP_METHOD_ARB 0x2007 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 #define WGL_NUMBER_OVERLAYS_ARB 0x2008 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 #define WGL_TRANSPARENT_ARB 0x200A |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 #define WGL_SHARE_DEPTH_ARB 0x200C |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 #define WGL_SHARE_STENCIL_ARB 0x200D |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 #define WGL_SHARE_ACCUM_ARB 0x200E |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 #define WGL_SUPPORT_GDI_ARB 0x200F |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 #define WGL_SUPPORT_OPENGL_ARB 0x2010 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 #define WGL_DOUBLE_BUFFER_ARB 0x2011 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 #define WGL_STEREO_ARB 0x2012 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 #define WGL_PIXEL_TYPE_ARB 0x2013 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 #define WGL_COLOR_BITS_ARB 0x2014 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 #define WGL_RED_BITS_ARB 0x2015 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 #define WGL_RED_SHIFT_ARB 0x2016 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 #define WGL_GREEN_BITS_ARB 0x2017 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 #define WGL_GREEN_SHIFT_ARB 0x2018 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 #define WGL_BLUE_BITS_ARB 0x2019 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 #define WGL_BLUE_SHIFT_ARB 0x201A |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 #define WGL_ALPHA_BITS_ARB 0x201B |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 #define WGL_ALPHA_SHIFT_ARB 0x201C |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 #define WGL_ACCUM_BITS_ARB 0x201D |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 #define WGL_ACCUM_RED_BITS_ARB 0x201E |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 #define WGL_ACCUM_GREEN_BITS_ARB 0x201F |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 #define WGL_DEPTH_BITS_ARB 0x2022 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 #define WGL_STENCIL_BITS_ARB 0x2023 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 #define WGL_AUX_BUFFERS_ARB 0x2024 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 #define WGL_NO_ACCELERATION_ARB 0x2025 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 #define WGL_GENERIC_ACCELERATION_ARB 0x2026 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 #define WGL_FULL_ACCELERATION_ARB 0x2027 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 #define WGL_SWAP_EXCHANGE_ARB 0x2028 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 #define WGL_SWAP_COPY_ARB 0x2029 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 #define WGL_SWAP_UNDEFINED_ARB 0x202A |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 #define WGL_TYPE_RGBA_ARB 0x202B |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 #define WGL_TYPE_COLORINDEX_ARB 0x202C |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 #endif |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 #ifndef WGL_ARB_multisample |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 #define WGL_SAMPLE_BUFFERS_ARB 0x2041 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 #define WGL_SAMPLES_ARB 0x2042 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 #endif |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 |
1952
420716272158
Implemented X11 OpenGL support.
Sam Lantinga <slouken@libsdl.org>
parents:
1936
diff
changeset
|
122 #endif /* SDL_VIDEO_OPENGL_WGL */ |
1913
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 #endif /* _SDL_win32opengl_h */ |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 |
83420da906a5
Implemented Windows OpenGL support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 /* vi: set ts=4 sw=4 expandtab: */ |