Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 1 | //======================================================================== |
Camilla Berglund | 6e553c7 | 2011-03-06 01:46:39 +0100 | [diff] [blame] | 2 | // GLFW - An OpenGL library |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 3 | // Platform: Any |
Camilla Berglund | 38b0ccb | 2010-09-07 17:41:26 +0200 | [diff] [blame] | 4 | // API version: 3.0 |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 5 | // WWW: http://www.glfw.org/ |
| 6 | //------------------------------------------------------------------------ |
| 7 | // Copyright (c) 2002-2006 Marcus Geelnard |
| 8 | // Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org> |
| 9 | // |
| 10 | // This software is provided 'as-is', without any express or implied |
| 11 | // warranty. In no event will the authors be held liable for any damages |
| 12 | // arising from the use of this software. |
| 13 | // |
| 14 | // Permission is granted to anyone to use this software for any purpose, |
| 15 | // including commercial applications, and to alter it and redistribute it |
| 16 | // freely, subject to the following restrictions: |
| 17 | // |
| 18 | // 1. The origin of this software must not be misrepresented; you must not |
| 19 | // claim that you wrote the original software. If you use this software |
| 20 | // in a product, an acknowledgment in the product documentation would |
| 21 | // be appreciated but is not required. |
| 22 | // |
| 23 | // 2. Altered source versions must be plainly marked as such, and must not |
| 24 | // be misrepresented as being the original software. |
| 25 | // |
| 26 | // 3. This notice may not be removed or altered from any source |
| 27 | // distribution. |
| 28 | // |
| 29 | //======================================================================== |
| 30 | |
| 31 | #include "internal.h" |
| 32 | |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 33 | #include <stdio.h> |
Camilla Berglund | cdfbbaf | 2010-09-08 17:01:39 +0200 | [diff] [blame] | 34 | #include <string.h> |
Camilla Berglund | 596f56f | 2011-03-07 13:56:28 +0100 | [diff] [blame] | 35 | #include <limits.h> |
Camilla Berglund | cdfbbaf | 2010-09-08 17:01:39 +0200 | [diff] [blame] | 36 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 37 | |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 38 | //======================================================================== |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 39 | // Parses the client API version string and extracts the version number |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 40 | //======================================================================== |
| 41 | |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 42 | static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev) |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 43 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 44 | int i, _api = GLFW_OPENGL_API, _major, _minor = 0, _rev = 0; |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 45 | const char* version; |
| 46 | const char* prefixes[] = |
| 47 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 48 | "OpenGL ES-CM ", |
| 49 | "OpenGL ES-CL ", |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 50 | "OpenGL ES ", |
| 51 | NULL |
| 52 | }; |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 53 | |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 54 | version = (const char*) glGetString(GL_VERSION); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 55 | if (!version) |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 56 | { |
| 57 | _glfwSetError(GLFW_PLATFORM_ERROR, "Failed to retrieve version string"); |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 58 | return GL_FALSE; |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 59 | } |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 60 | |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 61 | for (i = 0; prefixes[i]; i++) |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 62 | { |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 63 | const size_t length = strlen(prefixes[i]); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 64 | |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 65 | if (strncmp(version, prefixes[i], length) == 0) |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 66 | { |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 67 | version += length; |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 68 | _api = GLFW_OPENGL_ES_API; |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 69 | break; |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 70 | } |
| 71 | } |
| 72 | |
Camilla Berglund | 208377d | 2012-08-02 14:48:06 +0200 | [diff] [blame] | 73 | if (!sscanf(version, "%d.%d.%d", &_major, &_minor, &_rev)) |
| 74 | { |
| 75 | _glfwSetError(GLFW_PLATFORM_ERROR, "No version found in version string"); |
| 76 | return GL_FALSE; |
| 77 | } |
| 78 | |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 79 | *api = _api; |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 80 | *major = _major; |
| 81 | *minor = _minor; |
| 82 | *rev = _rev; |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 83 | |
| 84 | return GL_TRUE; |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | |
Camilla Berglund | 1723c4a | 2010-09-09 20:59:50 +0200 | [diff] [blame] | 88 | ////////////////////////////////////////////////////////////////////////// |
| 89 | ////// GLFW internal API ////// |
| 90 | ////////////////////////////////////////////////////////////////////////// |
| 91 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 92 | //======================================================================== |
Camilla Berglund | 596f56f | 2011-03-07 13:56:28 +0100 | [diff] [blame] | 93 | // Return the available framebuffer config closest to the desired values |
| 94 | // This is based on the manual GLX Visual selection from 2.6 |
| 95 | //======================================================================== |
| 96 | |
| 97 | const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, |
| 98 | const _GLFWfbconfig* alternatives, |
| 99 | unsigned int count) |
| 100 | { |
| 101 | unsigned int i; |
| 102 | unsigned int missing, leastMissing = UINT_MAX; |
| 103 | unsigned int colorDiff, leastColorDiff = UINT_MAX; |
| 104 | unsigned int extraDiff, leastExtraDiff = UINT_MAX; |
| 105 | const _GLFWfbconfig* current; |
| 106 | const _GLFWfbconfig* closest = NULL; |
| 107 | |
| 108 | for (i = 0; i < count; i++) |
| 109 | { |
| 110 | current = alternatives + i; |
| 111 | |
| 112 | if (desired->stereo > 0 && current->stereo == 0) |
| 113 | { |
| 114 | // Stereo is a hard constraint |
| 115 | continue; |
| 116 | } |
| 117 | |
| 118 | // Count number of missing buffers |
| 119 | { |
| 120 | missing = 0; |
| 121 | |
| 122 | if (desired->alphaBits > 0 && current->alphaBits == 0) |
| 123 | missing++; |
| 124 | |
| 125 | if (desired->depthBits > 0 && current->depthBits == 0) |
| 126 | missing++; |
| 127 | |
| 128 | if (desired->stencilBits > 0 && current->stencilBits == 0) |
| 129 | missing++; |
| 130 | |
| 131 | if (desired->auxBuffers > 0 && current->auxBuffers < desired->auxBuffers) |
| 132 | missing += desired->auxBuffers - current->auxBuffers; |
| 133 | |
| 134 | if (desired->samples > 0 && current->samples == 0) |
| 135 | { |
| 136 | // Technically, several multisampling buffers could be |
| 137 | // involved, but that's a lower level implementation detail and |
| 138 | // not important to us here, so we count them as one |
| 139 | missing++; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // These polynomials make many small channel size differences matter |
| 144 | // less than one large channel size difference |
| 145 | |
| 146 | // Calculate color channel size difference value |
| 147 | { |
| 148 | colorDiff = 0; |
| 149 | |
| 150 | if (desired->redBits > 0) |
| 151 | { |
| 152 | colorDiff += (desired->redBits - current->redBits) * |
| 153 | (desired->redBits - current->redBits); |
| 154 | } |
| 155 | |
| 156 | if (desired->greenBits > 0) |
| 157 | { |
| 158 | colorDiff += (desired->greenBits - current->greenBits) * |
| 159 | (desired->greenBits - current->greenBits); |
| 160 | } |
| 161 | |
| 162 | if (desired->blueBits > 0) |
| 163 | { |
| 164 | colorDiff += (desired->blueBits - current->blueBits) * |
| 165 | (desired->blueBits - current->blueBits); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | // Calculate non-color channel size difference value |
| 170 | { |
| 171 | extraDiff = 0; |
| 172 | |
| 173 | if (desired->alphaBits > 0) |
| 174 | { |
| 175 | extraDiff += (desired->alphaBits - current->alphaBits) * |
| 176 | (desired->alphaBits - current->alphaBits); |
| 177 | } |
| 178 | |
| 179 | if (desired->depthBits > 0) |
| 180 | { |
| 181 | extraDiff += (desired->depthBits - current->depthBits) * |
| 182 | (desired->depthBits - current->depthBits); |
| 183 | } |
| 184 | |
| 185 | if (desired->stencilBits > 0) |
| 186 | { |
| 187 | extraDiff += (desired->stencilBits - current->stencilBits) * |
| 188 | (desired->stencilBits - current->stencilBits); |
| 189 | } |
| 190 | |
| 191 | if (desired->accumRedBits > 0) |
| 192 | { |
| 193 | extraDiff += (desired->accumRedBits - current->accumRedBits) * |
| 194 | (desired->accumRedBits - current->accumRedBits); |
| 195 | } |
| 196 | |
| 197 | if (desired->accumGreenBits > 0) |
| 198 | { |
| 199 | extraDiff += (desired->accumGreenBits - current->accumGreenBits) * |
| 200 | (desired->accumGreenBits - current->accumGreenBits); |
| 201 | } |
| 202 | |
| 203 | if (desired->accumBlueBits > 0) |
| 204 | { |
| 205 | extraDiff += (desired->accumBlueBits - current->accumBlueBits) * |
| 206 | (desired->accumBlueBits - current->accumBlueBits); |
| 207 | } |
| 208 | |
| 209 | if (desired->accumAlphaBits > 0) |
| 210 | { |
| 211 | extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) * |
| 212 | (desired->accumAlphaBits - current->accumAlphaBits); |
| 213 | } |
| 214 | |
| 215 | if (desired->samples > 0) |
| 216 | { |
| 217 | extraDiff += (desired->samples - current->samples) * |
| 218 | (desired->samples - current->samples); |
| 219 | } |
Camilla Berglund | 69a9005 | 2012-12-02 16:10:00 +0100 | [diff] [blame] | 220 | |
| 221 | if (desired->sRGB) |
| 222 | { |
| 223 | if (!current->sRGB) |
| 224 | extraDiff++; |
| 225 | } |
Camilla Berglund | 596f56f | 2011-03-07 13:56:28 +0100 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | // Figure out if the current one is better than the best one found so far |
| 229 | // Least number of missing buffers is the most important heuristic, |
| 230 | // then color buffer size match and lastly size match for other buffers |
| 231 | |
| 232 | if (missing < leastMissing) |
| 233 | closest = current; |
| 234 | else if (missing == leastMissing) |
| 235 | { |
| 236 | if ((colorDiff < leastColorDiff) || |
| 237 | (colorDiff == leastColorDiff && extraDiff < leastExtraDiff)) |
| 238 | { |
| 239 | closest = current; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | if (current == closest) |
| 244 | { |
| 245 | leastMissing = missing; |
| 246 | leastColorDiff = colorDiff; |
| 247 | leastExtraDiff = extraDiff; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | return closest; |
| 252 | } |
| 253 | |
| 254 | |
| 255 | //======================================================================== |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 256 | // Checks whether the OpenGL part of the window config is sane |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 257 | // It blames glfwCreateWindow because that's the only caller |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 258 | //======================================================================== |
| 259 | |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 260 | GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 261 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 262 | if (wndconfig->clientAPI != GLFW_OPENGL_API && |
| 263 | wndconfig->clientAPI != GLFW_OPENGL_ES_API) |
Camilla Berglund | 8819405 | 2010-11-15 19:28:06 +0100 | [diff] [blame] | 264 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 265 | _glfwSetError(GLFW_INVALID_ENUM, |
| 266 | "glfwCreateWindow: Invalid client API requested"); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 267 | return GL_FALSE; |
| 268 | } |
Camilla Berglund | 8819405 | 2010-11-15 19:28:06 +0100 | [diff] [blame] | 269 | |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 270 | if (wndconfig->clientAPI == GLFW_OPENGL_API) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 271 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 272 | if (wndconfig->glMajor < 1 || wndconfig->glMinor < 0) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 273 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 274 | // OpenGL 1.0 is the smallest valid version |
Camilla Berglund | e4027f1 | 2011-07-27 17:48:56 +0200 | [diff] [blame] | 275 | _glfwSetError(GLFW_INVALID_VALUE, |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 276 | "glfwCreateWindow: Invalid OpenGL version requested"); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 277 | return GL_FALSE; |
| 278 | } |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 279 | if (wndconfig->glMajor == 1 && wndconfig->glMinor > 5) |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 280 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 281 | // OpenGL 1.x series ended with version 1.5 |
Camilla Berglund | e4027f1 | 2011-07-27 17:48:56 +0200 | [diff] [blame] | 282 | _glfwSetError(GLFW_INVALID_VALUE, |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 283 | "glfwCreateWindow: Invalid OpenGL version requested"); |
| 284 | return GL_FALSE; |
| 285 | } |
| 286 | else if (wndconfig->glMajor == 2 && wndconfig->glMinor > 1) |
| 287 | { |
| 288 | // OpenGL 2.x series ended with version 2.1 |
| 289 | _glfwSetError(GLFW_INVALID_VALUE, |
| 290 | "glfwCreateWindow: Invalid OpenGL version requested"); |
| 291 | return GL_FALSE; |
| 292 | } |
| 293 | else if (wndconfig->glMajor == 3 && wndconfig->glMinor > 3) |
| 294 | { |
| 295 | // OpenGL 3.x series ended with version 3.3 |
| 296 | _glfwSetError(GLFW_INVALID_VALUE, |
| 297 | "glfwCreateWindow: Invalid OpenGL version requested"); |
| 298 | return GL_FALSE; |
| 299 | } |
| 300 | else |
| 301 | { |
| 302 | // For now, let everything else through |
| 303 | } |
| 304 | |
| 305 | if (wndconfig->glProfile) |
| 306 | { |
| 307 | if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE && |
| 308 | wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE) |
| 309 | { |
| 310 | _glfwSetError(GLFW_INVALID_ENUM, |
| 311 | "glfwCreateWindow: Invalid OpenGL profile requested"); |
| 312 | return GL_FALSE; |
| 313 | } |
| 314 | |
| 315 | if (wndconfig->glMajor < 3 || |
| 316 | (wndconfig->glMajor == 3 && wndconfig->glMinor < 2)) |
| 317 | { |
| 318 | // Desktop OpenGL context profiles are only defined for version 3.2 |
| 319 | // and above |
| 320 | |
| 321 | _glfwSetError(GLFW_INVALID_VALUE, |
| 322 | "glfwCreateWindow: Context profiles only exist for " |
| 323 | "OpenGL version 3.2 and above"); |
| 324 | return GL_FALSE; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | if (wndconfig->glForward && wndconfig->glMajor < 3) |
| 329 | { |
| 330 | // Forward-compatible contexts are only defined for OpenGL version 3.0 and above |
| 331 | _glfwSetError(GLFW_INVALID_VALUE, |
| 332 | "glfwCreateWindow: Forward compatibility only exist " |
| 333 | "for OpenGL version 3.0 and above"); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 334 | return GL_FALSE; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 335 | } |
| 336 | } |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 337 | else if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 338 | { |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 339 | if (wndconfig->glMajor < 1 || wndconfig->glMinor < 0) |
| 340 | { |
| 341 | // OpenGL ES 1.0 is the smallest valid version |
| 342 | _glfwSetError(GLFW_INVALID_VALUE, |
| 343 | "glfwCreateWindow: Invalid OpenGL ES version requested"); |
| 344 | return GL_FALSE; |
| 345 | } |
| 346 | if (wndconfig->glMajor == 1 && wndconfig->glMinor > 1) |
| 347 | { |
| 348 | // OpenGL ES 1.x series ended with version 1.1 |
| 349 | _glfwSetError(GLFW_INVALID_VALUE, |
| 350 | "glfwCreateWindow: Invalid OpenGL ES version requested"); |
| 351 | return GL_FALSE; |
| 352 | } |
| 353 | else |
| 354 | { |
| 355 | // For now, let everything else through |
| 356 | } |
| 357 | |
| 358 | if (wndconfig->glProfile) |
| 359 | { |
| 360 | // OpenGL ES does not support profiles |
| 361 | _glfwSetError(GLFW_INVALID_VALUE, |
| 362 | "glfwCreateWindow: Context profiles are not supported " |
| 363 | "by OpenGL ES"); |
| 364 | return GL_FALSE; |
| 365 | } |
| 366 | |
| 367 | if (wndconfig->glForward) |
| 368 | { |
| 369 | // OpenGL ES does not support forward-compatibility |
| 370 | _glfwSetError(GLFW_INVALID_VALUE, |
| 371 | "glfwCreateWindow: Forward compatibility is not " |
| 372 | "supported by OpenGL ES"); |
| 373 | return GL_FALSE; |
| 374 | } |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 375 | } |
| 376 | |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 377 | if (wndconfig->glRobustness) |
| 378 | { |
| 379 | if (wndconfig->glRobustness != GLFW_OPENGL_NO_RESET_NOTIFICATION && |
| 380 | wndconfig->glRobustness != GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) |
| 381 | { |
Camilla Berglund | e4027f1 | 2011-07-27 17:48:56 +0200 | [diff] [blame] | 382 | _glfwSetError(GLFW_INVALID_VALUE, |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 383 | "glfwCreateWindow: Invalid OpenGL robustness mode " |
| 384 | "requested"); |
Camilla Berglund | d43e0b5 | 2011-03-07 20:51:34 +0100 | [diff] [blame] | 385 | return GL_FALSE; |
| 386 | } |
| 387 | } |
| 388 | |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 389 | return GL_TRUE; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 390 | } |
| 391 | |
Camilla Berglund | 65f074d | 2011-10-08 23:57:03 +0200 | [diff] [blame] | 392 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 393 | //======================================================================== |
Camilla Berglund | 053737e | 2012-08-02 01:18:35 +0200 | [diff] [blame] | 394 | // Reads back context properties |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 395 | // It blames glfwCreateWindow because that's the only caller |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 396 | //======================================================================== |
| 397 | |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 398 | GLboolean _glfwRefreshContextParams(void) |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 399 | { |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 400 | _GLFWwindow* window = _glfwPlatformGetCurrentContext(); |
Camilla Berglund | 053737e | 2012-08-02 01:18:35 +0200 | [diff] [blame] | 401 | |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 402 | if (!parseGLVersion(&window->clientAPI, |
| 403 | &window->glMajor, |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 404 | &window->glMinor, |
| 405 | &window->glRevision)) |
| 406 | { |
| 407 | return GL_FALSE; |
| 408 | } |
| 409 | |
| 410 | if (window->glMajor > 2) |
| 411 | { |
| 412 | // OpenGL 3.0+ uses a different function for extension string retrieval |
| 413 | // We cache it here instead of in glfwExtensionSupported mostly to alert |
| 414 | // users as early as possible that their build may be broken |
| 415 | |
| 416 | window->GetStringi = (PFNGLGETSTRINGIPROC) glfwGetProcAddress("glGetStringi"); |
| 417 | if (!window->GetStringi) |
| 418 | { |
| 419 | _glfwSetError(GLFW_PLATFORM_ERROR, |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 420 | "glfwCreateWindow: Entry point retrieval is broken"); |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 421 | return GL_FALSE; |
| 422 | } |
| 423 | } |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 424 | |
Camilla Berglund | c233e00 | 2011-07-27 18:20:15 +0200 | [diff] [blame] | 425 | // Read back forward-compatibility flag |
| 426 | { |
| 427 | window->glForward = GL_FALSE; |
| 428 | |
Camilla Berglund | 38cad9a | 2012-09-30 15:32:50 +0200 | [diff] [blame] | 429 | if (window->clientAPI == GLFW_OPENGL_API && window->glMajor >= 3) |
Camilla Berglund | c233e00 | 2011-07-27 18:20:15 +0200 | [diff] [blame] | 430 | { |
| 431 | GLint flags; |
| 432 | glGetIntegerv(GL_CONTEXT_FLAGS, &flags); |
| 433 | |
| 434 | if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) |
| 435 | window->glForward = GL_TRUE; |
Camilla Berglund | 302037d | 2012-07-31 23:52:23 +0200 | [diff] [blame] | 436 | if (flags & 0) |
| 437 | window->glDebug = GL_TRUE; |
Camilla Berglund | c233e00 | 2011-07-27 18:20:15 +0200 | [diff] [blame] | 438 | } |
| 439 | } |
| 440 | |
| 441 | // Read back OpenGL context profile |
| 442 | { |
| 443 | window->glProfile = 0; |
| 444 | |
| 445 | if (window->glMajor > 3 || (window->glMajor == 3 && window->glMinor >= 2)) |
| 446 | { |
| 447 | GLint mask; |
| 448 | glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask); |
| 449 | |
| 450 | if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) |
| 451 | window->glProfile = GLFW_OPENGL_COMPAT_PROFILE; |
| 452 | else if (mask & GL_CONTEXT_CORE_PROFILE_BIT) |
| 453 | window->glProfile = GLFW_OPENGL_CORE_PROFILE; |
| 454 | } |
| 455 | } |
| 456 | |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 457 | return GL_TRUE; |
Camilla Berglund | 053737e | 2012-08-02 01:18:35 +0200 | [diff] [blame] | 458 | } |
| 459 | |
| 460 | |
| 461 | //======================================================================== |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 462 | // Checks whether the current context fulfils the specified requirements |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 463 | // It blames glfwCreateWindow because that's the only caller |
Camilla Berglund | 053737e | 2012-08-02 01:18:35 +0200 | [diff] [blame] | 464 | //======================================================================== |
| 465 | |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 466 | GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig) |
Camilla Berglund | 053737e | 2012-08-02 01:18:35 +0200 | [diff] [blame] | 467 | { |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 468 | _GLFWwindow* window = _glfwPlatformGetCurrentContext(); |
Camilla Berglund | 59896c3 | 2012-08-02 14:42:24 +0200 | [diff] [blame] | 469 | |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 470 | if (window->glMajor < wndconfig->glMajor || |
| 471 | (window->glMajor == wndconfig->glMajor && |
| 472 | window->glMinor < wndconfig->glMinor)) |
| 473 | { |
| 474 | // The desired OpenGL version is greater than the actual version |
| 475 | // This only happens if the machine lacks {GLX|WGL}_ARB_create_context |
| 476 | // /and/ the user has requested an OpenGL version greater than 1.0 |
| 477 | |
| 478 | // For API consistency, we emulate the behavior of the |
| 479 | // {GLX|WGL}_ARB_create_context extension and fail here |
| 480 | |
Camilla Berglund | e4027f1 | 2011-07-27 17:48:56 +0200 | [diff] [blame] | 481 | _glfwSetError(GLFW_VERSION_UNAVAILABLE, |
Camilla Berglund | aff30d0 | 2012-08-06 17:56:41 +0200 | [diff] [blame] | 482 | "glfwCreateWindow: The requested OpenGL version is not available"); |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 483 | return GL_FALSE; |
| 484 | } |
| 485 | |
Camilla Berglund | 19be24a | 2011-03-07 14:55:11 +0100 | [diff] [blame] | 486 | return GL_TRUE; |
| 487 | } |
| 488 | |
| 489 | |
| 490 | //======================================================================== |
Camilla Berglund | 1baf233 | 2010-09-07 17:50:43 +0200 | [diff] [blame] | 491 | // Check if a string can be found in an OpenGL extension string |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 492 | //======================================================================== |
| 493 | |
Camilla Berglund | a4d888c | 2010-09-08 15:58:43 +0200 | [diff] [blame] | 494 | int _glfwStringInExtensionString(const char* string, |
| 495 | const GLubyte* extensions) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 496 | { |
Camilla Berglund | a4d888c | 2010-09-08 15:58:43 +0200 | [diff] [blame] | 497 | const GLubyte* start; |
| 498 | GLubyte* where; |
| 499 | GLubyte* terminator; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 500 | |
| 501 | // It takes a bit of care to be fool-proof about parsing the |
| 502 | // OpenGL extensions string. Don't be fooled by sub-strings, |
| 503 | // etc. |
| 504 | start = extensions; |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 505 | for (;;) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 506 | { |
Camilla Berglund | a4d888c | 2010-09-08 15:58:43 +0200 | [diff] [blame] | 507 | where = (GLubyte*) strstr((const char*) start, string); |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 508 | if (!where) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 509 | return GL_FALSE; |
Camilla Berglund | 105e927 | 2010-09-08 01:57:24 +0200 | [diff] [blame] | 510 | |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 511 | terminator = where + strlen(string); |
| 512 | if (where == start || *(where - 1) == ' ') |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 513 | { |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 514 | if (*terminator == ' ' || *terminator == '\0') |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 515 | break; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 516 | } |
Camilla Berglund | 105e927 | 2010-09-08 01:57:24 +0200 | [diff] [blame] | 517 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 518 | start = terminator; |
| 519 | } |
| 520 | |
| 521 | return GL_TRUE; |
| 522 | } |
| 523 | |
| 524 | |
Camilla Berglund | 1723c4a | 2010-09-09 20:59:50 +0200 | [diff] [blame] | 525 | ////////////////////////////////////////////////////////////////////////// |
| 526 | ////// GLFW public API ////// |
| 527 | ////////////////////////////////////////////////////////////////////////// |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 528 | |
| 529 | //======================================================================== |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 530 | // Make the OpenGL context associated with the specified window current |
| 531 | //======================================================================== |
| 532 | |
| 533 | GLFWAPI void glfwMakeContextCurrent(GLFWwindow handle) |
| 534 | { |
| 535 | _GLFWwindow* window = (_GLFWwindow*) handle; |
| 536 | |
| 537 | if (!_glfwInitialized) |
| 538 | { |
| 539 | _glfwSetError(GLFW_NOT_INITIALIZED, NULL); |
| 540 | return; |
| 541 | } |
| 542 | |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 543 | if (_glfwPlatformGetCurrentContext() == window) |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 544 | return; |
| 545 | |
| 546 | _glfwPlatformMakeContextCurrent(window); |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | |
| 550 | //======================================================================== |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 551 | // Return the window object whose context is current |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 552 | //======================================================================== |
| 553 | |
| 554 | GLFWAPI GLFWwindow glfwGetCurrentContext(void) |
| 555 | { |
| 556 | if (!_glfwInitialized) |
| 557 | { |
| 558 | _glfwSetError(GLFW_NOT_INITIALIZED, NULL); |
Camilla Berglund | 9696321 | 2012-08-27 13:52:10 +0200 | [diff] [blame] | 559 | return NULL; |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 560 | } |
| 561 | |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 562 | return _glfwPlatformGetCurrentContext(); |
Camilla Berglund | c1ab73b | 2011-07-27 16:01:27 +0200 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | |
| 566 | //======================================================================== |
Camilla Berglund | aae8999 | 2011-03-04 14:25:12 +0100 | [diff] [blame] | 567 | // Swap buffers (double-buffering) |
| 568 | //======================================================================== |
| 569 | |
Camilla Berglund | 585a840 | 2012-08-06 18:13:37 +0200 | [diff] [blame] | 570 | GLFWAPI void glfwSwapBuffers(GLFWwindow handle) |
Camilla Berglund | aae8999 | 2011-03-04 14:25:12 +0100 | [diff] [blame] | 571 | { |
Camilla Berglund | 585a840 | 2012-08-06 18:13:37 +0200 | [diff] [blame] | 572 | _GLFWwindow* window = (_GLFWwindow*) handle; |
| 573 | |
Camilla Berglund | aae8999 | 2011-03-04 14:25:12 +0100 | [diff] [blame] | 574 | if (!_glfwInitialized) |
| 575 | { |
| 576 | _glfwSetError(GLFW_NOT_INITIALIZED, NULL); |
| 577 | return; |
| 578 | } |
| 579 | |
Camilla Berglund | 585a840 | 2012-08-06 18:13:37 +0200 | [diff] [blame] | 580 | _glfwPlatformSwapBuffers(window); |
Camilla Berglund | aae8999 | 2011-03-04 14:25:12 +0100 | [diff] [blame] | 581 | } |
| 582 | |
| 583 | |
| 584 | //======================================================================== |
| 585 | // Set double buffering swap interval (0 = vsync off) |
| 586 | //======================================================================== |
| 587 | |
| 588 | GLFWAPI void glfwSwapInterval(int interval) |
| 589 | { |
| 590 | if (!_glfwInitialized) |
| 591 | { |
| 592 | _glfwSetError(GLFW_NOT_INITIALIZED, NULL); |
| 593 | return; |
| 594 | } |
| 595 | |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 596 | if (!_glfwPlatformGetCurrentContext()) |
Camilla Berglund | aae8999 | 2011-03-04 14:25:12 +0100 | [diff] [blame] | 597 | { |
Camilla Berglund | 957ecdc | 2012-08-02 15:36:15 +0200 | [diff] [blame] | 598 | _glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL); |
Camilla Berglund | aae8999 | 2011-03-04 14:25:12 +0100 | [diff] [blame] | 599 | return; |
| 600 | } |
| 601 | |
| 602 | _glfwPlatformSwapInterval(interval); |
| 603 | } |
| 604 | |
| 605 | |
| 606 | //======================================================================== |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 607 | // Check if an OpenGL extension is available at runtime |
| 608 | //======================================================================== |
| 609 | |
Camilla Berglund | a4d888c | 2010-09-08 15:58:43 +0200 | [diff] [blame] | 610 | GLFWAPI int glfwExtensionSupported(const char* extension) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 611 | { |
Camilla Berglund | a4d888c | 2010-09-08 15:58:43 +0200 | [diff] [blame] | 612 | const GLubyte* extensions; |
Camilla Berglund | 973ff49 | 2010-09-14 00:17:00 +0200 | [diff] [blame] | 613 | _GLFWwindow* window; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 614 | |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 615 | if (!_glfwInitialized) |
| 616 | { |
Camilla Berglund | f1e7d7c | 2010-11-23 17:45:23 +0100 | [diff] [blame] | 617 | _glfwSetError(GLFW_NOT_INITIALIZED, NULL); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 618 | return GL_FALSE; |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 619 | } |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 620 | |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 621 | window = _glfwPlatformGetCurrentContext(); |
Camilla Berglund | 973ff49 | 2010-09-14 00:17:00 +0200 | [diff] [blame] | 622 | if (!window) |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 623 | { |
Camilla Berglund | 957ecdc | 2012-08-02 15:36:15 +0200 | [diff] [blame] | 624 | _glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL); |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 625 | return GL_FALSE; |
| 626 | } |
| 627 | |
Camilla Berglund | ee3304c | 2012-08-02 15:29:13 +0200 | [diff] [blame] | 628 | if (extension == NULL || *extension == '\0') |
| 629 | { |
| 630 | _glfwSetError(GLFW_INVALID_VALUE, NULL); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 631 | return GL_FALSE; |
Camilla Berglund | ee3304c | 2012-08-02 15:29:13 +0200 | [diff] [blame] | 632 | } |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 633 | |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 634 | if (window->glMajor < 3) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 635 | { |
| 636 | // Check if extension is in the old style OpenGL extensions string |
| 637 | |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 638 | extensions = glGetString(GL_EXTENSIONS); |
| 639 | if (extensions != NULL) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 640 | { |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 641 | if (_glfwStringInExtensionString(extension, extensions)) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 642 | return GL_TRUE; |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 643 | } |
| 644 | } |
| 645 | else |
| 646 | { |
Camilla Berglund | 1bad573 | 2012-08-02 15:31:08 +0200 | [diff] [blame] | 647 | int i; |
| 648 | GLint count; |
| 649 | |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 650 | // Check if extension is in the modern OpenGL extensions string list |
| 651 | |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 652 | glGetIntegerv(GL_NUM_EXTENSIONS, &count); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 653 | |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 654 | for (i = 0; i < count; i++) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 655 | { |
Camilla Berglund | 135194a | 2010-09-09 18:15:32 +0200 | [diff] [blame] | 656 | if (strcmp((const char*) window->GetStringi(GL_EXTENSIONS, i), |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 657 | extension) == 0) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 658 | { |
| 659 | return GL_TRUE; |
| 660 | } |
| 661 | } |
| 662 | } |
| 663 | |
Camilla Berglund | a916997 | 2012-08-02 15:32:39 +0200 | [diff] [blame] | 664 | // Check if extension is in the platform-specific string |
| 665 | return _glfwPlatformExtensionSupported(extension); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 666 | } |
| 667 | |
| 668 | |
| 669 | //======================================================================== |
Camilla Berglund | 1baf233 | 2010-09-07 17:50:43 +0200 | [diff] [blame] | 670 | // Get the function pointer to an OpenGL function. |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 671 | // This function can be used to get access to extended OpenGL functions. |
| 672 | //======================================================================== |
| 673 | |
Camilla Berglund | bf42c3c | 2012-06-05 00:16:40 +0200 | [diff] [blame] | 674 | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname) |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 675 | { |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 676 | if (!_glfwInitialized) |
| 677 | { |
Camilla Berglund | f1e7d7c | 2010-11-23 17:45:23 +0100 | [diff] [blame] | 678 | _glfwSetError(GLFW_NOT_INITIALIZED, NULL); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 679 | return NULL; |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 680 | } |
| 681 | |
Camilla Berglund | 9e4bc36 | 2012-08-12 14:13:18 +0200 | [diff] [blame] | 682 | if (!_glfwPlatformGetCurrentContext()) |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 683 | { |
Camilla Berglund | 957ecdc | 2012-08-02 15:36:15 +0200 | [diff] [blame] | 684 | _glfwSetError(GLFW_NO_CURRENT_CONTEXT, NULL); |
Camilla Berglund | 922cd10 | 2010-09-09 21:34:42 +0200 | [diff] [blame] | 685 | return NULL; |
| 686 | } |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 687 | |
Camilla Berglund | 9e4137c | 2010-09-08 14:45:52 +0200 | [diff] [blame] | 688 | return _glfwPlatformGetProcAddress(procname); |
Camilla Berglund | 3249f81 | 2010-09-07 17:34:51 +0200 | [diff] [blame] | 689 | } |
| 690 | |