2010-09-07 11:34:51 -04:00
|
|
|
//========================================================================
|
2015-06-01 16:55:06 -04:00
|
|
|
// GLFW 3.2 - www.glfw.org
|
2010-09-07 11:34:51 -04:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
2016-06-01 10:17:06 -04:00
|
|
|
// Copyright (c) 2006-2016 Camilla Berglund <elmindreda@glfw.org>
|
2010-09-07 11:34:51 -04:00
|
|
|
//
|
|
|
|
// This software is provided 'as-is', without any express or implied
|
|
|
|
// warranty. In no event will the authors be held liable for any damages
|
|
|
|
// arising from the use of this software.
|
|
|
|
//
|
|
|
|
// Permission is granted to anyone to use this software for any purpose,
|
|
|
|
// including commercial applications, and to alter it and redistribute it
|
|
|
|
// freely, subject to the following restrictions:
|
|
|
|
//
|
|
|
|
// 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
// claim that you wrote the original software. If you use this software
|
|
|
|
// in a product, an acknowledgment in the product documentation would
|
|
|
|
// be appreciated but is not required.
|
|
|
|
//
|
|
|
|
// 2. Altered source versions must be plainly marked as such, and must not
|
|
|
|
// be misrepresented as being the original software.
|
|
|
|
//
|
|
|
|
// 3. This notice may not be removed or altered from any source
|
|
|
|
// distribution.
|
|
|
|
//
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
#include "internal.h"
|
|
|
|
|
2016-01-31 11:56:36 -05:00
|
|
|
#include <assert.h>
|
2012-08-02 08:48:06 -04:00
|
|
|
#include <stdio.h>
|
2010-09-08 11:01:39 -04:00
|
|
|
#include <string.h>
|
2011-03-07 07:56:28 -05:00
|
|
|
#include <limits.h>
|
2012-04-25 02:35:02 -04:00
|
|
|
#include <stdio.h>
|
2010-09-08 11:01:39 -04:00
|
|
|
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2012-07-21 19:10:59 -04:00
|
|
|
// Parses the client API version string and extracts the version number
|
2013-02-04 07:22:10 -05:00
|
|
|
//
|
2015-08-23 13:30:04 -04:00
|
|
|
static GLFWbool parseVersionString(int* api, int* major, int* minor, int* rev)
|
2011-03-07 08:55:11 -05:00
|
|
|
{
|
2014-10-07 10:20:49 -04:00
|
|
|
int i;
|
2015-08-11 18:59:26 -04:00
|
|
|
_GLFWwindow* window;
|
2012-07-23 12:40:31 -04:00
|
|
|
const char* version;
|
2012-07-31 13:06:48 -04:00
|
|
|
const char* prefixes[] =
|
|
|
|
{
|
2012-07-31 19:05:57 -04:00
|
|
|
"OpenGL ES-CM ",
|
|
|
|
"OpenGL ES-CL ",
|
|
|
|
"OpenGL ES ",
|
|
|
|
NULL
|
2012-07-31 13:06:48 -04:00
|
|
|
};
|
2011-03-07 08:55:11 -05:00
|
|
|
|
2014-10-07 10:20:49 -04:00
|
|
|
*api = GLFW_OPENGL_API;
|
|
|
|
|
2015-08-11 18:59:26 -04:00
|
|
|
window = _glfwPlatformGetCurrentContext();
|
|
|
|
|
2015-11-09 10:48:55 -05:00
|
|
|
version = (const char*) window->context.GetString(GL_VERSION);
|
2011-03-07 08:55:11 -05:00
|
|
|
if (!version)
|
|
|
|
{
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
2016-03-29 04:49:34 -04:00
|
|
|
"Client API version string retrieval is broken");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2011-03-07 08:55:11 -05:00
|
|
|
}
|
|
|
|
|
2012-07-31 13:06:48 -04:00
|
|
|
for (i = 0; prefixes[i]; i++)
|
2011-03-07 08:55:11 -05:00
|
|
|
{
|
2012-07-31 19:05:57 -04:00
|
|
|
const size_t length = strlen(prefixes[i]);
|
2012-04-25 02:35:02 -04:00
|
|
|
|
2012-07-31 19:05:57 -04:00
|
|
|
if (strncmp(version, prefixes[i], length) == 0)
|
|
|
|
{
|
|
|
|
version += length;
|
2014-10-07 10:20:49 -04:00
|
|
|
*api = GLFW_OPENGL_ES_API;
|
2012-07-31 19:05:57 -04:00
|
|
|
break;
|
|
|
|
}
|
2012-07-31 13:06:48 -04:00
|
|
|
}
|
2012-07-23 12:40:31 -04:00
|
|
|
|
2014-10-07 10:20:49 -04:00
|
|
|
if (!sscanf(version, "%d.%d.%d", major, minor, rev))
|
2012-07-31 13:06:48 -04:00
|
|
|
{
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
2016-03-29 04:49:34 -04:00
|
|
|
"No version found in client API version string");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-07-23 12:40:31 -04:00
|
|
|
}
|
2011-03-07 08:55:11 -05:00
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_TRUE;
|
2011-03-07 08:55:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-09 14:59:50 -04:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
////// GLFW internal API //////
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2016-03-28 07:19:31 -04:00
|
|
|
if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API &&
|
|
|
|
ctxconfig->source != GLFW_EGL_CONTEXT_API)
|
|
|
|
{
|
|
|
|
_glfwInputError(GLFW_INVALID_ENUM,
|
|
|
|
"Invalid context creation API %i",
|
|
|
|
ctxconfig->source);
|
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctxconfig->client != GLFW_NO_API &&
|
|
|
|
ctxconfig->client != GLFW_OPENGL_API &&
|
|
|
|
ctxconfig->client != GLFW_OPENGL_ES_API)
|
2011-03-07 08:55:11 -05:00
|
|
|
{
|
2016-03-29 04:49:34 -04:00
|
|
|
_glfwInputError(GLFW_INVALID_ENUM,
|
|
|
|
"Invalid client API %i",
|
2016-03-28 07:19:31 -04:00
|
|
|
ctxconfig->client);
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2011-03-07 08:55:11 -05:00
|
|
|
}
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
if (ctxconfig->client == GLFW_OPENGL_API)
|
2011-03-07 08:55:11 -05:00
|
|
|
{
|
2014-03-06 14:05:32 -05:00
|
|
|
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
|
|
|
|
(ctxconfig->major == 1 && ctxconfig->minor > 5) ||
|
|
|
|
(ctxconfig->major == 2 && ctxconfig->minor > 1) ||
|
|
|
|
(ctxconfig->major == 3 && ctxconfig->minor > 3))
|
2012-07-21 19:10:59 -04:00
|
|
|
{
|
|
|
|
// OpenGL 1.0 is the smallest valid version
|
|
|
|
// OpenGL 1.x series ended with version 1.5
|
|
|
|
// OpenGL 2.x series ended with version 2.1
|
|
|
|
// OpenGL 3.x series ended with version 3.3
|
2015-03-07 16:33:04 -05:00
|
|
|
// For now, let everything else through
|
2012-12-13 11:07:55 -05:00
|
|
|
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_INVALID_VALUE,
|
2015-03-10 14:51:14 -04:00
|
|
|
"Invalid OpenGL version %i.%i",
|
2014-03-06 14:05:32 -05:00
|
|
|
ctxconfig->major, ctxconfig->minor);
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-07-21 19:10:59 -04:00
|
|
|
}
|
|
|
|
|
2014-03-06 14:05:32 -05:00
|
|
|
if (ctxconfig->profile)
|
2011-03-07 08:55:11 -05:00
|
|
|
{
|
2014-03-06 14:05:32 -05:00
|
|
|
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE &&
|
|
|
|
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
|
2012-07-21 19:10:59 -04:00
|
|
|
{
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_INVALID_ENUM,
|
2016-03-29 04:49:34 -04:00
|
|
|
"Invalid OpenGL profile %i",
|
|
|
|
ctxconfig->profile);
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-07-21 19:10:59 -04:00
|
|
|
}
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2015-10-12 18:39:07 -04:00
|
|
|
if (ctxconfig->major <= 2 ||
|
2014-03-06 14:05:32 -05:00
|
|
|
(ctxconfig->major == 3 && ctxconfig->minor < 2))
|
2012-07-21 19:10:59 -04:00
|
|
|
{
|
|
|
|
// Desktop OpenGL context profiles are only defined for version 3.2
|
|
|
|
// and above
|
|
|
|
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_INVALID_VALUE,
|
2015-03-10 14:51:14 -04:00
|
|
|
"Context profiles are only defined for OpenGL version 3.2 and above");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-07-21 19:10:59 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-12 18:39:07 -04:00
|
|
|
if (ctxconfig->forward && ctxconfig->major <= 2)
|
2012-07-21 19:10:59 -04:00
|
|
|
{
|
|
|
|
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_INVALID_VALUE,
|
2015-03-10 14:51:14 -04:00
|
|
|
"Forward-compatibility is only defined for OpenGL version 3.0 and above");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2011-03-07 08:55:11 -05:00
|
|
|
}
|
|
|
|
}
|
2016-03-28 07:19:31 -04:00
|
|
|
else if (ctxconfig->client == GLFW_OPENGL_ES_API)
|
2010-11-15 13:28:06 -05:00
|
|
|
{
|
2014-03-06 14:05:32 -05:00
|
|
|
if (ctxconfig->major < 1 || ctxconfig->minor < 0 ||
|
|
|
|
(ctxconfig->major == 1 && ctxconfig->minor > 1) ||
|
|
|
|
(ctxconfig->major == 2 && ctxconfig->minor > 0))
|
2011-03-07 08:55:11 -05:00
|
|
|
{
|
2012-07-21 19:10:59 -04:00
|
|
|
// OpenGL ES 1.0 is the smallest valid version
|
|
|
|
// OpenGL ES 1.x series ended with version 1.1
|
2012-12-13 11:07:55 -05:00
|
|
|
// OpenGL ES 2.x series ended with version 2.0
|
2015-03-07 16:33:04 -05:00
|
|
|
// For now, let everything else through
|
2012-12-13 11:07:55 -05:00
|
|
|
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_INVALID_VALUE,
|
2015-03-10 14:51:14 -04:00
|
|
|
"Invalid OpenGL ES version %i.%i",
|
2014-03-06 14:05:32 -05:00
|
|
|
ctxconfig->major, ctxconfig->minor);
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-07-21 19:10:59 -04:00
|
|
|
}
|
2011-03-07 08:55:11 -05:00
|
|
|
}
|
2011-03-07 07:58:02 -05:00
|
|
|
|
2014-03-06 14:05:32 -05:00
|
|
|
if (ctxconfig->robustness)
|
2011-03-07 14:51:34 -05:00
|
|
|
{
|
2014-03-06 14:05:32 -05:00
|
|
|
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
|
|
|
|
ctxconfig->robustness != GLFW_LOSE_CONTEXT_ON_RESET)
|
2011-03-07 14:51:34 -05:00
|
|
|
{
|
2015-03-10 14:51:14 -04:00
|
|
|
_glfwInputError(GLFW_INVALID_ENUM,
|
2016-03-29 04:49:34 -04:00
|
|
|
"Invalid context robustness mode %i",
|
|
|
|
ctxconfig->robustness);
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2011-03-07 14:51:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-21 13:21:45 -04:00
|
|
|
if (ctxconfig->release)
|
|
|
|
{
|
|
|
|
if (ctxconfig->release != GLFW_RELEASE_BEHAVIOR_NONE &&
|
|
|
|
ctxconfig->release != GLFW_RELEASE_BEHAVIOR_FLUSH)
|
|
|
|
{
|
2015-03-10 14:51:14 -04:00
|
|
|
_glfwInputError(GLFW_INVALID_ENUM,
|
2016-03-29 04:49:34 -04:00
|
|
|
"Invalid context release behavior %i",
|
|
|
|
ctxconfig->release);
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2014-08-21 13:21:45 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_TRUE;
|
2011-03-07 08:55:11 -05:00
|
|
|
}
|
2010-09-07 19:57:24 -04:00
|
|
|
|
2013-05-13 09:49:59 -04:00
|
|
|
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|
|
|
const _GLFWfbconfig* alternatives,
|
|
|
|
unsigned int count)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
unsigned int missing, leastMissing = UINT_MAX;
|
|
|
|
unsigned int colorDiff, leastColorDiff = UINT_MAX;
|
|
|
|
unsigned int extraDiff, leastExtraDiff = UINT_MAX;
|
|
|
|
const _GLFWfbconfig* current;
|
|
|
|
const _GLFWfbconfig* closest = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
current = alternatives + i;
|
|
|
|
|
|
|
|
if (desired->stereo > 0 && current->stereo == 0)
|
|
|
|
{
|
|
|
|
// Stereo is a hard constraint
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-04-24 13:21:10 -04:00
|
|
|
if (desired->doublebuffer != current->doublebuffer)
|
|
|
|
{
|
|
|
|
// Double buffering is a hard constraint
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-05-13 09:49:59 -04:00
|
|
|
// Count number of missing buffers
|
|
|
|
{
|
|
|
|
missing = 0;
|
|
|
|
|
|
|
|
if (desired->alphaBits > 0 && current->alphaBits == 0)
|
|
|
|
missing++;
|
|
|
|
|
|
|
|
if (desired->depthBits > 0 && current->depthBits == 0)
|
|
|
|
missing++;
|
|
|
|
|
|
|
|
if (desired->stencilBits > 0 && current->stencilBits == 0)
|
|
|
|
missing++;
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->auxBuffers > 0 &&
|
|
|
|
current->auxBuffers < desired->auxBuffers)
|
|
|
|
{
|
2013-05-13 09:49:59 -04:00
|
|
|
missing += desired->auxBuffers - current->auxBuffers;
|
2014-04-08 12:57:43 -04:00
|
|
|
}
|
2013-05-13 09:49:59 -04:00
|
|
|
|
|
|
|
if (desired->samples > 0 && current->samples == 0)
|
|
|
|
{
|
|
|
|
// Technically, several multisampling buffers could be
|
|
|
|
// involved, but that's a lower level implementation detail and
|
|
|
|
// not important to us here, so we count them as one
|
|
|
|
missing++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// These polynomials make many small channel size differences matter
|
|
|
|
// less than one large channel size difference
|
|
|
|
|
|
|
|
// Calculate color channel size difference value
|
|
|
|
{
|
|
|
|
colorDiff = 0;
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->redBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
colorDiff += (desired->redBits - current->redBits) *
|
|
|
|
(desired->redBits - current->redBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->greenBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
colorDiff += (desired->greenBits - current->greenBits) *
|
|
|
|
(desired->greenBits - current->greenBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->blueBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
colorDiff += (desired->blueBits - current->blueBits) *
|
|
|
|
(desired->blueBits - current->blueBits);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate non-color channel size difference value
|
|
|
|
{
|
|
|
|
extraDiff = 0;
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->alphaBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->alphaBits - current->alphaBits) *
|
|
|
|
(desired->alphaBits - current->alphaBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->depthBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->depthBits - current->depthBits) *
|
|
|
|
(desired->depthBits - current->depthBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->stencilBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->stencilBits - current->stencilBits) *
|
|
|
|
(desired->stencilBits - current->stencilBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->accumRedBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->accumRedBits - current->accumRedBits) *
|
|
|
|
(desired->accumRedBits - current->accumRedBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->accumGreenBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->accumGreenBits - current->accumGreenBits) *
|
|
|
|
(desired->accumGreenBits - current->accumGreenBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->accumBlueBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->accumBlueBits - current->accumBlueBits) *
|
|
|
|
(desired->accumBlueBits - current->accumBlueBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->accumAlphaBits != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->accumAlphaBits - current->accumAlphaBits) *
|
|
|
|
(desired->accumAlphaBits - current->accumAlphaBits);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->samples != GLFW_DONT_CARE)
|
2013-05-13 09:49:59 -04:00
|
|
|
{
|
|
|
|
extraDiff += (desired->samples - current->samples) *
|
|
|
|
(desired->samples - current->samples);
|
|
|
|
}
|
|
|
|
|
2014-04-08 12:57:43 -04:00
|
|
|
if (desired->sRGB && !current->sRGB)
|
|
|
|
extraDiff++;
|
2013-05-13 09:49:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Figure out if the current one is better than the best one found so far
|
|
|
|
// Least number of missing buffers is the most important heuristic,
|
|
|
|
// then color buffer size match and lastly size match for other buffers
|
|
|
|
|
|
|
|
if (missing < leastMissing)
|
|
|
|
closest = current;
|
|
|
|
else if (missing == leastMissing)
|
|
|
|
{
|
|
|
|
if ((colorDiff < leastColorDiff) ||
|
|
|
|
(colorDiff == leastColorDiff && extraDiff < leastExtraDiff))
|
|
|
|
{
|
|
|
|
closest = current;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current == closest)
|
|
|
|
{
|
|
|
|
leastMissing = missing;
|
|
|
|
leastColorDiff = colorDiff;
|
|
|
|
leastExtraDiff = extraDiff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return closest;
|
|
|
|
}
|
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
|
2011-03-07 08:55:11 -05:00
|
|
|
{
|
2012-08-12 08:13:18 -04:00
|
|
|
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
2012-07-21 19:10:59 -04:00
|
|
|
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetIntegerv = (PFNGLGETINTEGERVPROC)
|
2016-07-18 17:31:54 -04:00
|
|
|
window->context.getProcAddress("glGetIntegerv");
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetString = (PFNGLGETSTRINGPROC)
|
2016-07-18 17:31:54 -04:00
|
|
|
window->context.getProcAddress("glGetString");
|
2016-03-28 07:19:31 -04:00
|
|
|
if (!window->context.GetIntegerv || !window->context.GetString)
|
|
|
|
{
|
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Entry point retrieval is broken");
|
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
2015-08-11 18:59:26 -04:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
if (!parseVersionString(&window->context.client,
|
2014-10-07 10:20:49 -04:00
|
|
|
&window->context.major,
|
|
|
|
&window->context.minor,
|
|
|
|
&window->context.revision))
|
2012-08-01 20:41:57 -04:00
|
|
|
{
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-08-02 08:42:24 -04:00
|
|
|
}
|
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
window->context.source = ctxconfig->source;
|
|
|
|
|
2016-03-20 04:39:53 -04:00
|
|
|
if (window->context.major < ctxconfig->major ||
|
|
|
|
(window->context.major == ctxconfig->major &&
|
|
|
|
window->context.minor < ctxconfig->minor))
|
|
|
|
{
|
|
|
|
// The desired OpenGL version is greater than the actual version
|
|
|
|
// This only happens if the machine lacks {GLX|WGL}_ARB_create_context
|
|
|
|
// /and/ the user has requested an OpenGL version greater than 1.0
|
|
|
|
|
|
|
|
// For API consistency, we emulate the behavior of the
|
|
|
|
// {GLX|WGL}_ARB_create_context extension and fail here
|
|
|
|
|
2016-03-29 04:49:34 -04:00
|
|
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
|
|
|
"Requested client API version %i.%i, got version %i.%i",
|
|
|
|
ctxconfig->major, ctxconfig->minor,
|
|
|
|
window->context.major, window->context.minor);
|
2016-03-20 04:39:53 -04:00
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
|
|
|
|
2015-10-12 18:39:07 -04:00
|
|
|
if (window->context.major >= 3)
|
2012-08-02 08:42:24 -04:00
|
|
|
{
|
|
|
|
// OpenGL 3.0+ uses a different function for extension string retrieval
|
|
|
|
// We cache it here instead of in glfwExtensionSupported mostly to alert
|
|
|
|
// users as early as possible that their build may be broken
|
|
|
|
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetStringi = (PFNGLGETSTRINGIPROC)
|
2016-07-18 17:31:54 -04:00
|
|
|
window->context.getProcAddress("glGetStringi");
|
2015-11-09 10:48:55 -05:00
|
|
|
if (!window->context.GetStringi)
|
2012-08-02 08:42:24 -04:00
|
|
|
{
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
|
|
"Entry point retrieval is broken");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-08-02 08:42:24 -04:00
|
|
|
}
|
2012-08-01 20:41:57 -04:00
|
|
|
}
|
2011-03-07 08:55:11 -05:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
if (window->context.client == GLFW_OPENGL_API)
|
2011-07-27 12:20:15 -04:00
|
|
|
{
|
2012-12-13 13:07:19 -05:00
|
|
|
// Read back context flags (OpenGL 3.0 and above)
|
2014-03-06 14:05:32 -05:00
|
|
|
if (window->context.major >= 3)
|
2012-12-13 11:22:19 -05:00
|
|
|
{
|
|
|
|
GLint flags;
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetIntegerv(GL_CONTEXT_FLAGS, &flags);
|
2012-12-13 11:22:19 -05:00
|
|
|
|
|
|
|
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
|
2015-08-23 13:30:04 -04:00
|
|
|
window->context.forward = GLFW_TRUE;
|
2012-12-13 13:07:19 -05:00
|
|
|
|
2012-12-13 11:33:08 -05:00
|
|
|
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
|
2015-08-23 13:30:04 -04:00
|
|
|
window->context.debug = GLFW_TRUE;
|
2014-03-06 08:48:44 -05:00
|
|
|
else if (glfwExtensionSupported("GL_ARB_debug_output") &&
|
2014-03-06 14:05:32 -05:00
|
|
|
ctxconfig->debug)
|
2012-12-13 11:33:08 -05:00
|
|
|
{
|
|
|
|
// HACK: This is a workaround for older drivers (pre KHR_debug)
|
2013-11-10 07:56:27 -05:00
|
|
|
// not setting the debug bit in the context flags for
|
|
|
|
// debug contexts
|
2015-08-23 13:30:04 -04:00
|
|
|
window->context.debug = GLFW_TRUE;
|
2012-12-13 11:33:08 -05:00
|
|
|
}
|
2015-08-10 06:46:14 -04:00
|
|
|
|
|
|
|
if (flags & GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR)
|
|
|
|
window->context.noerror = GLFW_TRUE;
|
2012-12-13 11:22:19 -05:00
|
|
|
}
|
2011-07-27 12:20:15 -04:00
|
|
|
|
2012-12-13 13:07:19 -05:00
|
|
|
// Read back OpenGL context profile (OpenGL 3.2 and above)
|
2015-10-12 18:39:07 -04:00
|
|
|
if (window->context.major >= 4 ||
|
2014-03-06 14:05:32 -05:00
|
|
|
(window->context.major == 3 && window->context.minor >= 2))
|
2012-12-13 11:22:19 -05:00
|
|
|
{
|
|
|
|
GLint mask;
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
|
2012-12-13 11:22:19 -05:00
|
|
|
|
|
|
|
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
|
2014-03-06 14:05:32 -05:00
|
|
|
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
|
2012-12-13 11:22:19 -05:00
|
|
|
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
|
2014-03-06 14:05:32 -05:00
|
|
|
window->context.profile = GLFW_OPENGL_CORE_PROFILE;
|
2013-11-18 06:14:51 -05:00
|
|
|
else if (glfwExtensionSupported("GL_ARB_compatibility"))
|
|
|
|
{
|
|
|
|
// HACK: This is a workaround for the compatibility profile bit
|
|
|
|
// not being set in the context flags if an OpenGL 3.2+
|
|
|
|
// context was created without having requested a specific
|
|
|
|
// version
|
2014-03-06 14:05:32 -05:00
|
|
|
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
|
2013-11-18 06:14:51 -05:00
|
|
|
}
|
2012-12-13 11:22:19 -05:00
|
|
|
}
|
2012-12-13 13:07:19 -05:00
|
|
|
|
|
|
|
// Read back robustness strategy
|
|
|
|
if (glfwExtensionSupported("GL_ARB_robustness"))
|
|
|
|
{
|
|
|
|
// NOTE: We avoid using the context flags for detection, as they are
|
2013-11-10 08:03:07 -05:00
|
|
|
// only present from 3.0 while the extension applies from 1.1
|
2012-12-13 13:07:19 -05:00
|
|
|
|
|
|
|
GLint strategy;
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
|
|
|
|
&strategy);
|
2012-12-13 13:07:19 -05:00
|
|
|
|
|
|
|
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
2014-03-06 14:05:32 -05:00
|
|
|
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
2012-12-13 13:07:19 -05:00
|
|
|
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
2014-03-06 14:05:32 -05:00
|
|
|
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
|
2012-12-13 13:07:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Read back robustness strategy
|
|
|
|
if (glfwExtensionSupported("GL_EXT_robustness"))
|
|
|
|
{
|
|
|
|
// NOTE: The values of these constants match those of the OpenGL ARB
|
2013-11-10 08:03:07 -05:00
|
|
|
// one, so we can reuse them here
|
2012-12-13 13:07:19 -05:00
|
|
|
|
|
|
|
GLint strategy;
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB,
|
|
|
|
&strategy);
|
2012-12-13 13:07:19 -05:00
|
|
|
|
|
|
|
if (strategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
|
2014-03-06 14:05:32 -05:00
|
|
|
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
|
2012-12-13 13:07:19 -05:00
|
|
|
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
|
2014-03-06 14:05:32 -05:00
|
|
|
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
|
2012-12-13 13:07:19 -05:00
|
|
|
}
|
2011-07-27 12:20:15 -04:00
|
|
|
}
|
2014-08-21 13:21:45 -04:00
|
|
|
|
|
|
|
if (glfwExtensionSupported("GL_KHR_context_flush_control"))
|
|
|
|
{
|
|
|
|
GLint behavior;
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetIntegerv(GL_CONTEXT_RELEASE_BEHAVIOR, &behavior);
|
2014-08-21 13:21:45 -04:00
|
|
|
|
|
|
|
if (behavior == GL_NONE)
|
|
|
|
window->context.release = GLFW_RELEASE_BEHAVIOR_NONE;
|
|
|
|
else if (behavior == GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH)
|
|
|
|
window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH;
|
|
|
|
}
|
2011-07-27 12:20:15 -04:00
|
|
|
|
2015-10-24 18:35:16 -04:00
|
|
|
// Clearing the front buffer to black to avoid garbage pixels left over from
|
|
|
|
// previous uses of our bit of VRAM
|
|
|
|
{
|
2016-07-18 17:31:54 -04:00
|
|
|
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
|
|
|
window->context.getProcAddress("glClear");
|
2015-10-24 18:35:16 -04:00
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
2016-03-28 07:19:31 -04:00
|
|
|
window->context.swapBuffers(window);
|
2015-10-24 18:35:16 -04:00
|
|
|
}
|
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_TRUE;
|
2012-08-01 19:18:35 -04:00
|
|
|
}
|
|
|
|
|
2015-11-05 02:58:40 -05:00
|
|
|
GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions)
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2015-07-28 08:12:16 -04:00
|
|
|
const char* start = extensions;
|
2015-06-16 16:16:36 -04:00
|
|
|
|
2010-09-08 08:45:52 -04:00
|
|
|
for (;;)
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2015-07-28 08:12:16 -04:00
|
|
|
const char* where;
|
|
|
|
const char* terminator;
|
2015-06-16 16:16:36 -04:00
|
|
|
|
2015-07-28 08:12:16 -04:00
|
|
|
where = strstr(start, string);
|
2010-09-08 08:45:52 -04:00
|
|
|
if (!where)
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2010-09-07 19:57:24 -04:00
|
|
|
|
2010-09-08 08:45:52 -04:00
|
|
|
terminator = where + strlen(string);
|
|
|
|
if (where == start || *(where - 1) == ' ')
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2010-09-08 08:45:52 -04:00
|
|
|
if (*terminator == ' ' || *terminator == '\0')
|
2010-09-07 11:34:51 -04:00
|
|
|
break;
|
|
|
|
}
|
2010-09-07 19:57:24 -04:00
|
|
|
|
2010-09-07 11:34:51 -04:00
|
|
|
start = terminator;
|
|
|
|
}
|
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_TRUE;
|
2010-09-07 11:34:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-09 14:59:50 -04:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
////// GLFW public API //////
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2013-01-05 15:13:28 -05:00
|
|
|
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
|
2011-07-27 10:01:27 -04:00
|
|
|
{
|
|
|
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
2016-03-28 07:19:31 -04:00
|
|
|
_GLFWwindow* previous = _glfwPlatformGetCurrentContext();
|
2015-06-18 08:03:02 -04:00
|
|
|
|
2013-02-19 18:28:08 -05:00
|
|
|
_GLFW_REQUIRE_INIT();
|
2015-06-18 08:03:02 -04:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
if (window && window->context.client == GLFW_NO_API)
|
2015-06-18 08:03:02 -04:00
|
|
|
{
|
|
|
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
if (previous)
|
|
|
|
{
|
|
|
|
if (!window || window->context.source != previous->context.source)
|
2016-05-25 08:43:51 -04:00
|
|
|
previous->context.makeCurrent(NULL);
|
2016-03-28 07:19:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (window)
|
2016-05-25 08:43:51 -04:00
|
|
|
window->context.makeCurrent(window);
|
2011-07-27 10:01:27 -04:00
|
|
|
}
|
|
|
|
|
2013-01-05 15:13:28 -05:00
|
|
|
GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
|
2011-07-27 10:01:27 -04:00
|
|
|
{
|
2013-02-19 18:28:08 -05:00
|
|
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
2013-01-05 15:13:28 -05:00
|
|
|
return (GLFWwindow*) _glfwPlatformGetCurrentContext();
|
2011-07-27 10:01:27 -04:00
|
|
|
}
|
|
|
|
|
2013-01-05 15:13:28 -05:00
|
|
|
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
|
2011-03-04 08:25:12 -05:00
|
|
|
{
|
2012-08-06 12:13:37 -04:00
|
|
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
2016-03-02 11:58:05 -05:00
|
|
|
assert(window != NULL);
|
2015-06-18 08:03:02 -04:00
|
|
|
|
2013-02-19 18:28:08 -05:00
|
|
|
_GLFW_REQUIRE_INIT();
|
2015-06-18 08:03:02 -04:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
if (window->context.client == GLFW_NO_API)
|
2015-06-18 08:03:02 -04:00
|
|
|
{
|
|
|
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
window->context.swapBuffers(window);
|
2011-03-04 08:25:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
GLFWAPI void glfwSwapInterval(int interval)
|
|
|
|
{
|
2016-03-28 07:19:31 -04:00
|
|
|
_GLFWwindow* window;
|
|
|
|
|
2013-02-19 18:28:08 -05:00
|
|
|
_GLFW_REQUIRE_INIT();
|
2011-03-04 08:25:12 -05:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
window = _glfwPlatformGetCurrentContext();
|
|
|
|
if (!window)
|
2011-03-04 08:25:12 -05:00
|
|
|
{
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
2011-03-04 08:25:12 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
window->context.swapInterval(interval);
|
2011-03-04 08:25:12 -05:00
|
|
|
}
|
|
|
|
|
2010-09-08 09:58:43 -04:00
|
|
|
GLFWAPI int glfwExtensionSupported(const char* extension)
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2010-09-13 18:17:00 -04:00
|
|
|
_GLFWwindow* window;
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2016-03-02 11:58:05 -05:00
|
|
|
assert(extension != NULL);
|
2016-01-31 11:56:36 -05:00
|
|
|
|
2015-08-23 13:30:04 -04:00
|
|
|
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2012-08-12 08:13:18 -04:00
|
|
|
window = _glfwPlatformGetCurrentContext();
|
2010-09-13 18:17:00 -04:00
|
|
|
if (!window)
|
2010-09-09 15:34:42 -04:00
|
|
|
{
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2010-09-09 15:34:42 -04:00
|
|
|
}
|
|
|
|
|
2015-01-06 14:28:15 -05:00
|
|
|
if (*extension == '\0')
|
2012-08-02 09:29:13 -04:00
|
|
|
{
|
2016-03-29 04:49:34 -04:00
|
|
|
_glfwInputError(GLFW_INVALID_VALUE, "Extension name is empty string");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2012-08-02 09:29:13 -04:00
|
|
|
}
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2015-01-06 14:21:00 -05:00
|
|
|
if (window->context.major >= 3)
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2012-08-02 09:31:08 -04:00
|
|
|
int i;
|
|
|
|
GLint count;
|
|
|
|
|
2010-09-07 11:34:51 -04:00
|
|
|
// Check if extension is in the modern OpenGL extensions string list
|
|
|
|
|
2015-11-09 10:48:55 -05:00
|
|
|
window->context.GetIntegerv(GL_NUM_EXTENSIONS, &count);
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2010-09-08 08:45:52 -04:00
|
|
|
for (i = 0; i < count; i++)
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2015-11-09 10:48:55 -05:00
|
|
|
const char* en = (const char*)
|
|
|
|
window->context.GetStringi(GL_EXTENSIONS, i);
|
2013-11-07 09:17:25 -05:00
|
|
|
if (!en)
|
2013-11-01 08:55:33 -04:00
|
|
|
{
|
2013-11-07 09:17:25 -05:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
2016-03-29 04:49:34 -04:00
|
|
|
"Extension string retrieval is broken");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2013-11-01 08:55:33 -04:00
|
|
|
}
|
2013-11-07 09:17:25 -05:00
|
|
|
|
|
|
|
if (strcmp(en, extension) == 0)
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_TRUE;
|
2010-09-07 11:34:51 -04:00
|
|
|
}
|
|
|
|
}
|
2015-01-06 14:21:00 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Check if extension is in the old style OpenGL extensions string
|
|
|
|
|
2015-11-09 10:48:55 -05:00
|
|
|
const char* extensions = (const char*)
|
|
|
|
window->context.GetString(GL_EXTENSIONS);
|
2015-01-06 14:21:00 -05:00
|
|
|
if (!extensions)
|
|
|
|
{
|
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
2016-03-29 04:49:34 -04:00
|
|
|
"Extension string retrieval is broken");
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_FALSE;
|
2015-01-06 14:21:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_glfwStringInExtensionString(extension, extensions))
|
2015-08-23 13:30:04 -04:00
|
|
|
return GLFW_TRUE;
|
2015-01-06 14:21:00 -05:00
|
|
|
}
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2012-08-02 09:32:39 -04:00
|
|
|
// Check if extension is in the platform-specific string
|
2016-03-28 07:19:31 -04:00
|
|
|
return window->context.extensionSupported(extension);
|
2010-09-07 11:34:51 -04:00
|
|
|
}
|
|
|
|
|
2012-06-04 18:16:40 -04:00
|
|
|
GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
|
2010-09-07 11:34:51 -04:00
|
|
|
{
|
2016-03-28 07:19:31 -04:00
|
|
|
_GLFWwindow* window;
|
2016-03-02 11:58:05 -05:00
|
|
|
assert(procname != NULL);
|
2016-01-31 11:56:36 -05:00
|
|
|
|
2013-02-19 18:28:08 -05:00
|
|
|
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
2010-09-09 15:34:42 -04:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
window = _glfwPlatformGetCurrentContext();
|
|
|
|
if (!window)
|
2010-09-09 15:34:42 -04:00
|
|
|
{
|
2012-12-31 15:05:28 -05:00
|
|
|
_glfwInputError(GLFW_NO_CURRENT_CONTEXT, NULL);
|
2010-09-07 11:34:51 -04:00
|
|
|
return NULL;
|
2010-09-09 15:34:42 -04:00
|
|
|
}
|
2010-09-07 11:34:51 -04:00
|
|
|
|
2016-03-28 07:19:31 -04:00
|
|
|
return window->context.getProcAddress(procname);
|
2010-09-07 11:34:51 -04:00
|
|
|
}
|
|
|
|
|