Mercurial > sdl-ios-xcode
annotate src/video/wincommon/SDL_wingl.c @ 656:864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 22 Jul 2003 15:33:28 +0000 |
parents | 9c42ee1b7d77 |
children | 338a62f9a528 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 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 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
28 #include <string.h> |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
29 |
0 | 30 /* WGL implementation of SDL OpenGL support */ |
31 | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
450
diff
changeset
|
32 #ifdef HAVE_OPENGL |
327
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
33 #include "SDL_opengl.h" |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
450
diff
changeset
|
34 #endif |
0 | 35 #include "SDL_error.h" |
36 #include "SDL_lowvideo.h" | |
37 #include "SDL_wingl_c.h" | |
38 | |
39 #ifdef HAVE_OPENGL | |
40 #define DEFAULT_GL_DRIVER_PATH "OPENGL32.DLL" | |
41 #endif | |
42 | |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
43 /* If setting the HDC fails, we may need to recreate the window (MSDN) */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
44 static int WIN_GL_ResetWindow(_THIS) |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
45 { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
46 int status = 0; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
47 int can_reset = 1; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
48 |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
49 /* If we were passed a window, then we can't create a new one */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
50 if ( SDL_windowid ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
51 can_reset = 0; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
52 } |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
53 #ifndef _WIN32_WCE /* FIXME WinCE needs the UNICODE version of CreateWindow() */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
54 if ( can_reset ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
55 /* Save the existing window attributes */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
56 LONG style; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
57 RECT rect = { 0, 0, 0, 0 }; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
58 style = GetWindowLong(SDL_Window, GWL_STYLE); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
59 GetWindowRect(SDL_Window, &rect); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
60 DestroyWindow(SDL_Window); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
61 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
62 style, |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
63 rect.left, rect.top, |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
64 (rect.right-rect.left)+1, |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
65 (rect.top-rect.bottom)+1, |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
66 NULL, NULL, SDL_Instance, NULL); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
67 if ( SDL_Window ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
68 this->SetCaption(this, this->wm_title, this->wm_icon); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
69 } else { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
70 SDL_SetError("Couldn't create window"); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
71 status = -1; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
72 } |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
73 } else |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
74 #endif /* !_WIN32_WCE */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
75 { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
76 SDL_SetError("Unable to reset window for OpenGL context"); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
77 status = -1; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
78 } |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
79 return(status); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
80 } |
0 | 81 |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
82 static int Init_WGL_ARB_extensions(_THIS) |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
83 { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
84 HWND hwnd; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
85 HDC hdc; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
86 HGLRC hglrc; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
87 int pformat; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
88 const char * (WINAPI *wglGetExtensionsStringARB)(HDC) = 0; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
89 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
90 hwnd = CreateWindow(NULL, "PFormat", WS_POPUP | WS_DISABLED, |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
91 0, 0, 10, 10, |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
92 NULL, NULL, SDL_Instance,NULL); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
93 hdc = GetDC(hwnd); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
94 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
95 pformat = ChoosePixelFormat(hdc, &GL_pfd); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
96 SetPixelFormat(hdc, pformat, &GL_pfd); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
97 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
98 hglrc = this->gl_data->wglCreateContext(hdc); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
99 this->gl_data->wglMakeCurrent(hdc, hglrc); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
100 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
101 wglGetExtensionsStringARB = (const char * (WINAPI *)(HDC)) |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
102 this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB"); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
103 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
104 if(wglGetExtensionsStringARB && strstr(wglGetExtensionsStringARB(hdc),"WGL_ARB_pixel_format")) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
105 this->gl_data->wglChoosePixelFormatARB = |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
106 (BOOL (WINAPI *)(HDC, const int *, const FLOAT *, UINT, int *, UINT *)) |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
107 this->gl_data->wglGetProcAddress("wglChoosePixelFormatARB"); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
108 this->gl_data->wglGetPixelFormatAttribivARB = |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
109 (BOOL (WINAPI *)(HDC, int, int, UINT, const int *, int *)) |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
110 this->gl_data->wglGetProcAddress("wglGetPixelFormatAttribivARB"); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
111 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
112 if( (this->gl_data->wglChoosePixelFormatARB != NULL) && |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
113 (this->gl_data->wglGetPixelFormatAttribivARB != NULL) ) |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
114 this->gl_data->wgl_arb_pixel_format = 1; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
115 else |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
116 this->gl_data->wgl_arb_pixel_format = 0; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
117 } else { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
118 this->gl_data->wgl_arb_pixel_format = 0; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
119 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
120 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
121 this->gl_data->wglMakeCurrent(NULL, NULL); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
122 this->gl_data->wglDeleteContext(hglrc); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
123 ReleaseDC(hwnd, hdc); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
124 DestroyWindow(hwnd); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
125 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
126 |
0 | 127 int WIN_GL_SetupWindow(_THIS) |
128 { | |
129 int retval; | |
130 #ifdef HAVE_OPENGL | |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
131 int i; |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
132 unsigned int matching; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
133 int iAttribs[64]; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
134 int *iAttr; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
135 float fAttribs[1] = { 0 }; |
0 | 136 |
137 /* load the gl driver from a default path */ | |
138 if ( ! this->gl_config.driver_loaded ) { | |
139 /* no driver has been loaded, use default (ourselves) */ | |
140 if ( WIN_GL_LoadLibrary(this, NULL) < 0 ) { | |
141 return(-1); | |
142 } | |
143 } | |
144 | |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
145 for ( i=0; ; ++i ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
146 /* Get the window device context for our OpenGL drawing */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
147 GL_hdc = GetDC(SDL_Window); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
148 if ( GL_hdc == NULL ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
149 SDL_SetError("Unable to get DC for SDL_Window"); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
150 return(-1); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
151 } |
0 | 152 |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
153 /* Set up the pixel format descriptor with our needed format */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
154 memset(&GL_pfd, 0, sizeof(GL_pfd)); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
155 GL_pfd.nSize = sizeof(GL_pfd); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
156 GL_pfd.nVersion = 1; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
157 GL_pfd.dwFlags = (PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
158 if ( this->gl_config.double_buffer ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
159 GL_pfd.dwFlags |= PFD_DOUBLEBUFFER; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
160 } |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
161 if ( this->gl_config.stereo ) { |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
162 GL_pfd.dwFlags |= PFD_STEREO; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
163 } |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
164 GL_pfd.iPixelType = PFD_TYPE_RGBA; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
165 GL_pfd.cColorBits = this->gl_config.buffer_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
166 GL_pfd.cRedBits = this->gl_config.red_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
167 GL_pfd.cGreenBits = this->gl_config.green_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
168 GL_pfd.cBlueBits = this->gl_config.blue_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
169 GL_pfd.cAlphaBits = this->gl_config.alpha_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
170 GL_pfd.cAccumRedBits = this->gl_config.accum_red_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
171 GL_pfd.cAccumGreenBits = this->gl_config.accum_green_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
172 GL_pfd.cAccumBlueBits = this->gl_config.accum_blue_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
173 GL_pfd.cAccumAlphaBits = this->gl_config.accum_alpha_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
174 GL_pfd.cAccumBits = |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
175 (GL_pfd.cAccumRedBits + GL_pfd.cAccumGreenBits + |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
176 GL_pfd.cAccumBlueBits + GL_pfd.cAccumAlphaBits); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
177 GL_pfd.cDepthBits = this->gl_config.depth_size; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
178 GL_pfd.cStencilBits = this->gl_config.stencil_size; |
0 | 179 |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
180 /* initialize WGL_ARB_pixel_format */ |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
181 Init_WGL_ARB_extensions(this); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
182 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
183 /* setup WGL_ARB_pixel_format attribs */ |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
184 iAttr = &iAttribs[0]; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
185 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
186 *iAttr++ = WGL_DRAW_TO_WINDOW_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
187 *iAttr++ = GL_TRUE; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
188 *iAttr++ = WGL_ACCELERATION_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
189 *iAttr++ = WGL_FULL_ACCELERATION_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
190 *iAttr++ = WGL_RED_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
191 *iAttr++ = this->gl_config.red_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
192 *iAttr++ = WGL_GREEN_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
193 *iAttr++ = this->gl_config.green_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
194 *iAttr++ = WGL_BLUE_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
195 *iAttr++ = this->gl_config.blue_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
196 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
197 if ( this->gl_config.alpha_size ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
198 *iAttr++ = WGL_ALPHA_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
199 *iAttr++ = this->gl_config.alpha_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
200 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
201 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
202 if ( this->gl_config.double_buffer ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
203 *iAttr ++ = WGL_DOUBLE_BUFFER_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
204 *iAttr ++ = GL_TRUE; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
205 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
206 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
207 *iAttr++ = WGL_DEPTH_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
208 *iAttr++ = this->gl_config.depth_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
209 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
210 if ( this->gl_config.stencil_size ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
211 *iAttr++ = WGL_STENCIL_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
212 *iAttr++ = this->gl_config.stencil_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
213 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
214 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
215 if ( this->gl_config.accum_red_size ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
216 *iAttr++ = WGL_ACCUM_RED_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
217 *iAttr++ = this->gl_config.accum_red_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
218 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
219 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
220 if ( this->gl_config.accum_green_size ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
221 *iAttr++ = WGL_ACCUM_GREEN_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
222 *iAttr++ = this->gl_config.accum_green_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
223 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
224 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
225 if ( this->gl_config.accum_blue_size ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
226 *iAttr++ = WGL_ACCUM_BLUE_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
227 *iAttr++ = this->gl_config.accum_blue_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
228 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
229 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
230 if ( this->gl_config.accum_alpha_size ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
231 *iAttr++ = WGL_ACCUM_ALPHA_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
232 *iAttr++ = this->gl_config.accum_alpha_size; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
233 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
234 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
235 if ( this->gl_config.stereo ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
236 *iAttr++ = WGL_STEREO_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
237 *iAttr++ = this->gl_config.stereo; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
238 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
239 |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
240 if ( this->gl_config.multisamplebuffers ) { |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
241 *iAttr++ = WGL_SAMPLE_BUFFERS_ARB; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
242 *iAttr++ = this->gl_config.multisamplebuffers; |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
243 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
244 |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
245 if ( this->gl_config.multisamplesamples ) { |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
246 *iAttr++ = WGL_SAMPLES_ARB; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
247 *iAttr++ = this->gl_config.multisamplesamples; |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
248 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
249 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
250 *iAttr = 0; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
251 |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
252 /* Choose and set the closest available pixel format */ |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
253 if ( !this->gl_data->wgl_arb_pixel_format || |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
254 !this->gl_data->wglChoosePixelFormatARB(GL_hdc, iAttribs, fAttribs, 1, &pixel_format, &matching) || |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
255 !matching ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
256 pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
257 this->gl_data->wgl_arb_pixel_format = 0; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
258 } |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
259 if ( !pixel_format ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
260 SDL_SetError("No matching GL pixel format available"); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
261 return(-1); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
262 } |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
263 if ( !SetPixelFormat(GL_hdc, pixel_format, &GL_pfd) ) { |
373
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
264 if ( i == 0 ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
265 /* First time through, try resetting the window */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
266 if ( WIN_GL_ResetWindow(this) < 0 ) { |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
267 return(-1); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
268 } |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
269 continue; |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
270 } |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
271 SDL_SetError("Unable to set HDC pixel format"); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
272 return(-1); |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
273 } |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
274 /* We either succeeded or failed by this point */ |
c638fde8a824
Fixed setting OpenGL mode multiple times on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
327
diff
changeset
|
275 break; |
0 | 276 } |
277 DescribePixelFormat(GL_hdc, pixel_format, sizeof(GL_pfd), &GL_pfd); | |
278 | |
279 GL_hrc = this->gl_data->wglCreateContext(GL_hdc); | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
280 if ( GL_hrc == NULL ) { |
0 | 281 SDL_SetError("Unable to create GL context"); |
282 return(-1); | |
283 } | |
284 gl_active = 1; | |
285 #else | |
286 SDL_SetError("WIN driver not configured with OpenGL"); | |
287 #endif | |
288 if ( gl_active ) { | |
289 retval = 0; | |
290 } else { | |
291 retval = -1; | |
292 } | |
293 return(retval); | |
294 } | |
295 | |
296 void WIN_GL_ShutDown(_THIS) | |
297 { | |
298 #ifdef HAVE_OPENGL | |
299 /* Clean up OpenGL */ | |
300 if ( GL_hrc ) { | |
301 this->gl_data->wglMakeCurrent(NULL, NULL); | |
302 this->gl_data->wglDeleteContext(GL_hrc); | |
303 GL_hrc = NULL; | |
304 } | |
305 if ( GL_hdc ) { | |
306 ReleaseDC(SDL_Window, GL_hdc); | |
307 GL_hdc = NULL; | |
308 } | |
309 gl_active = 0; | |
310 | |
311 WIN_GL_UnloadLibrary(this); | |
312 #endif /* HAVE_OPENGL */ | |
313 } | |
314 | |
315 #ifdef HAVE_OPENGL | |
316 | |
317 /* Make the current context active */ | |
318 int WIN_GL_MakeCurrent(_THIS) | |
319 { | |
320 int retval; | |
321 | |
322 retval = 0; | |
323 if ( ! this->gl_data->wglMakeCurrent(GL_hdc, GL_hrc) ) { | |
324 SDL_SetError("Unable to make GL context current"); | |
325 retval = -1; | |
326 } | |
327 return(retval); | |
328 } | |
329 | |
330 /* Get attribute data from glX. */ | |
331 int WIN_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) | |
332 { | |
333 int retval; | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
334 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
335 if ( this->gl_data->wgl_arb_pixel_format ) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
336 int wgl_attrib; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
337 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
338 switch(attrib) { |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
339 case SDL_GL_RED_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
340 wgl_attrib = WGL_RED_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
341 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
342 case SDL_GL_GREEN_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
343 wgl_attrib = WGL_GREEN_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
344 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
345 case SDL_GL_BLUE_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
346 wgl_attrib = WGL_BLUE_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
347 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
348 case SDL_GL_ALPHA_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
349 wgl_attrib = WGL_ALPHA_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
350 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
351 case SDL_GL_DOUBLEBUFFER: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
352 wgl_attrib = WGL_DOUBLE_BUFFER_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
353 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
354 case SDL_GL_BUFFER_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
355 wgl_attrib = WGL_COLOR_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
356 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
357 case SDL_GL_DEPTH_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
358 wgl_attrib = WGL_DEPTH_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
359 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
360 case SDL_GL_STENCIL_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
361 wgl_attrib = WGL_STENCIL_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
362 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
363 case SDL_GL_ACCUM_RED_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
364 wgl_attrib = WGL_ACCUM_RED_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
365 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
366 case SDL_GL_ACCUM_GREEN_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
367 wgl_attrib = WGL_ACCUM_GREEN_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
368 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
369 case SDL_GL_ACCUM_BLUE_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
370 wgl_attrib = WGL_ACCUM_BLUE_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
371 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
372 case SDL_GL_ACCUM_ALPHA_SIZE: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
373 wgl_attrib = WGL_ACCUM_ALPHA_BITS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
374 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
375 case SDL_GL_STEREO: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
376 wgl_attrib = WGL_STEREO_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
377 break; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
378 case SDL_GL_MULTISAMPLEBUFFERS: |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
379 wgl_attrib = WGL_SAMPLE_BUFFERS_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
380 break; |
656
864e2d2a9a55
Merged in Ryan's multisample code for MacOS, and changed the constants to match.
Sam Lantinga <slouken@libsdl.org>
parents:
655
diff
changeset
|
381 case SDL_GL_MULTISAMPLESAMPLES: |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
382 wgl_attrib = WGL_SAMPLES_ARB; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
383 break; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
384 default: |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
385 return(-1); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
386 } |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
387 this->gl_data->wglGetPixelFormatAttribivARB(GL_hdc, pixel_format, 0, 1, &wgl_attrib, value); |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
388 |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
389 return 0; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
390 } |
0 | 391 |
392 retval = 0; | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
393 switch ( attrib ) { |
0 | 394 case SDL_GL_RED_SIZE: |
395 *value = GL_pfd.cRedBits; | |
396 break; | |
397 case SDL_GL_GREEN_SIZE: | |
398 *value = GL_pfd.cGreenBits; | |
399 break; | |
400 case SDL_GL_BLUE_SIZE: | |
401 *value = GL_pfd.cBlueBits; | |
402 break; | |
403 case SDL_GL_ALPHA_SIZE: | |
404 *value = GL_pfd.cAlphaBits; | |
405 break; | |
406 case SDL_GL_DOUBLEBUFFER: | |
407 if ( GL_pfd.dwFlags & PFD_DOUBLEBUFFER ) { | |
408 *value = 1; | |
409 } else { | |
410 *value = 0; | |
411 } | |
412 break; | |
413 case SDL_GL_BUFFER_SIZE: | |
414 *value = GL_pfd.cColorBits; | |
415 break; | |
416 case SDL_GL_DEPTH_SIZE: | |
417 *value = GL_pfd.cDepthBits; | |
418 break; | |
419 case SDL_GL_STENCIL_SIZE: | |
420 *value = GL_pfd.cStencilBits; | |
421 break; | |
422 case SDL_GL_ACCUM_RED_SIZE: | |
423 *value = GL_pfd.cAccumRedBits; | |
424 break; | |
425 case SDL_GL_ACCUM_GREEN_SIZE: | |
426 *value = GL_pfd.cAccumGreenBits; | |
427 break; | |
428 case SDL_GL_ACCUM_BLUE_SIZE: | |
429 *value = GL_pfd.cAccumBlueBits; | |
430 break; | |
431 case SDL_GL_ACCUM_ALPHA_SIZE: | |
432 *value = GL_pfd.cAccumAlphaBits; | |
433 break; | |
450
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
434 case SDL_GL_STEREO: |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
435 if ( GL_pfd.dwFlags & PFD_STEREO ) { |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
436 *value = 1; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
437 } else { |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
438 *value = 0; |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
439 } |
8a43e0cbf02f
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
Sam Lantinga <slouken@libsdl.org>
parents:
373
diff
changeset
|
440 break; |
0 | 441 default: |
442 retval = -1; | |
443 break; | |
444 } | |
445 return retval; | |
446 } | |
447 | |
448 void WIN_GL_SwapBuffers(_THIS) | |
449 { | |
450 SwapBuffers(GL_hdc); | |
451 } | |
452 | |
453 void WIN_GL_UnloadLibrary(_THIS) | |
454 { | |
455 if ( this->gl_config.driver_loaded ) { | |
456 FreeLibrary((HMODULE)this->gl_config.dll_handle); | |
457 | |
458 this->gl_data->wglGetProcAddress = NULL; | |
459 this->gl_data->wglCreateContext = NULL; | |
460 this->gl_data->wglDeleteContext = NULL; | |
461 this->gl_data->wglMakeCurrent = NULL; | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
462 this->gl_data->wglChoosePixelFormatARB = NULL; |
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
463 this->gl_data->wglGetPixelFormatAttribivARB = NULL; |
0 | 464 |
465 this->gl_config.dll_handle = NULL; | |
466 this->gl_config.driver_loaded = 0; | |
467 } | |
468 } | |
469 | |
470 /* Passing a NULL path means load pointers from the application */ | |
471 int WIN_GL_LoadLibrary(_THIS, const char* path) | |
472 { | |
473 HMODULE handle; | |
474 | |
475 if ( gl_active ) { | |
476 SDL_SetError("OpenGL context already created"); | |
477 return -1; | |
478 } | |
479 | |
480 if ( path == NULL ) { | |
481 path = DEFAULT_GL_DRIVER_PATH; | |
482 } | |
483 handle = LoadLibrary(path); | |
484 if ( handle == NULL ) { | |
485 SDL_SetError("Could not load OpenGL library"); | |
486 return -1; | |
487 } | |
488 | |
489 /* Unload the old driver and reset the pointers */ | |
490 WIN_GL_UnloadLibrary(this); | |
491 | |
492 /* Load new function pointers */ | |
655
9c42ee1b7d77
Date: Thu, 24 Apr 2003 15:13:47 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
493 memset(this->gl_data, 0, sizeof(*this->gl_data)); |
0 | 494 this->gl_data->wglGetProcAddress = (void * (WINAPI *)(const char *)) |
495 GetProcAddress(handle, "wglGetProcAddress"); | |
496 this->gl_data->wglCreateContext = (HGLRC (WINAPI *)(HDC)) | |
497 GetProcAddress(handle, "wglCreateContext"); | |
498 this->gl_data->wglDeleteContext = (BOOL (WINAPI *)(HGLRC)) | |
499 GetProcAddress(handle, "wglDeleteContext"); | |
500 this->gl_data->wglMakeCurrent = (BOOL (WINAPI *)(HDC, HGLRC)) | |
501 GetProcAddress(handle, "wglMakeCurrent"); | |
502 | |
503 if ( (this->gl_data->wglGetProcAddress == NULL) || | |
504 (this->gl_data->wglCreateContext == NULL) || | |
505 (this->gl_data->wglDeleteContext == NULL) || | |
506 (this->gl_data->wglMakeCurrent == NULL) ) { | |
507 SDL_SetError("Could not retrieve OpenGL functions"); | |
508 FreeLibrary(handle); | |
509 return -1; | |
510 } | |
511 | |
512 this->gl_config.dll_handle = handle; | |
513 strcpy(this->gl_config.driver_path, path); | |
514 this->gl_config.driver_loaded = 1; | |
515 return 0; | |
516 } | |
517 | |
518 void *WIN_GL_GetProcAddress(_THIS, const char* proc) | |
519 { | |
520 void *func; | |
521 | |
522 /* This is to pick up extensions */ | |
523 func = this->gl_data->wglGetProcAddress(proc); | |
524 if ( ! func ) { | |
525 /* This is probably a normal GL function */ | |
526 func = GetProcAddress(this->gl_config.dll_handle, proc); | |
527 } | |
528 return func; | |
529 } | |
530 | |
531 #endif /* HAVE_OPENGL */ |