43 const char* prefixes[] =
55 version = (
const char*) window->
GetString(GL_VERSION);
59 "Failed to retrieve context version string");
63 for (i = 0; prefixes[i]; i++)
65 const size_t length = strlen(prefixes[i]);
67 if (strncmp(version, prefixes[i], length) == 0)
75 if (!sscanf(version,
"%d.%d.%d", major, minor, rev))
78 "No version found in context version string");
101 if ((ctxconfig->
major < 1 || ctxconfig->
minor < 0) ||
102 (ctxconfig->
major == 1 && ctxconfig->
minor > 5) ||
103 (ctxconfig->
major == 2 && ctxconfig->
minor > 1) ||
104 (ctxconfig->
major == 3 && ctxconfig->
minor > 3))
113 "Invalid OpenGL version %i.%i",
124 "Invalid OpenGL profile");
128 if (ctxconfig->
major < 3 ||
129 (ctxconfig->
major == 3 && ctxconfig->
minor < 2))
135 "Context profiles are only defined for OpenGL version 3.2 and above");
144 "Forward-compatibility is only defined for OpenGL version 3.0 and above");
150 if (ctxconfig->
major < 1 || ctxconfig->
minor < 0 ||
151 (ctxconfig->
major == 1 && ctxconfig->
minor > 1) ||
152 (ctxconfig->
major == 2 && ctxconfig->
minor > 0))
160 "Invalid OpenGL ES version %i.%i",
172 "Invalid context robustness mode");
183 "Invalid context release behavior");
196 unsigned int missing, leastMissing = UINT_MAX;
197 unsigned int colorDiff, leastColorDiff = UINT_MAX;
198 unsigned int extraDiff, leastExtraDiff = UINT_MAX;
202 for (i = 0; i <
count; i++)
204 current = alternatives + i;
324 if (desired->
sRGB && !current->
sRGB)
332 if (missing < leastMissing)
334 else if (missing == leastMissing)
336 if ((colorDiff < leastColorDiff) ||
337 (colorDiff == leastColorDiff && extraDiff < leastExtraDiff))
343 if (current == closest)
345 leastMissing = missing;
346 leastColorDiff = colorDiff;
347 leastExtraDiff = extraDiff;
370 #if defined(_GLFW_USE_OPENGL) 378 if (!window->GetStringi)
381 "Entry point retrieval is broken");
468 if (behavior == GL_NONE)
473 #endif // _GLFW_USE_OPENGL 502 const char*
start = extensions;
507 const char* terminator;
509 where = strstr(start,
string);
513 terminator = where + strlen(
string);
514 if (where == start || *(where - 1) ==
' ')
516 if (*terminator ==
' ' || *terminator ==
'\0')
577 if (*extension ==
'\0')
583 #if defined(_GLFW_USE_OPENGL) 593 for (i = 0; i <
count; i++)
595 const char* en = (
const char*) window->GetStringi(GL_EXTENSIONS, i);
599 "Failed to retrieve extension string %i", i);
603 if (strcmp(en, extension) == 0)
608 #endif // _GLFW_USE_OPENGL 612 const char* extensions = (
const char*) window->
GetString(GL_EXTENSIONS);
616 "Failed to retrieve extension string");
const GLubyte *APIENTRYP PFNGLGETSTRINGIPROC(GLenum name, GLuint index)
#define GLFW_OPENGL_ES_API
GLboolean _glfwIsValidContext(const _GLFWctxconfig *ctxconfig)
Checks whether the current context fulfils the specified hard constraints.
int _glfwStringInExtensionString(const char *string, const char *extensions)
Searches an extension string for the specified extension.
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
#define GLFW_OPENGL_COMPAT_PROFILE
#define GL_CONTEXT_FLAG_DEBUG_BIT
#define _GLFW_REQUIRE_INIT()
#define GL_CONTEXT_PROFILE_MASK
const _GLFWfbconfig * _glfwChooseFBConfig(const _GLFWfbconfig *desired, const _GLFWfbconfig *alternatives, unsigned int count)
Chooses the framebuffer config that best matches the desired one.
const GLubyte *(APIENTRY * PFNGLGETSTRINGPROC)(GLenum)
#define GLFW_LOSE_CONTEXT_ON_RESET
void(APIENTRY * PFNGLGETINTEGERVPROC)(GLenum, GLint *)
#define GLFW_RELEASE_BEHAVIOR_NONE
PFNGLGETSTRINGPROC GetString
#define GL_NO_RESET_NOTIFICATION_ARB
struct GLFWwindow GLFWwindow
Opaque window object.
#define GL_CONTEXT_CORE_PROFILE_BIT
typedef GLint(APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program
#define GLFW_NO_CURRENT_CONTEXT
No context is current for this thread.
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
#define GL_CONTEXT_RELEASE_BEHAVIOR
#define GL_RESET_NOTIFICATION_STRATEGY_ARB
typedef GLboolean(APIENTRYP PFNGLISQUERYPROC)(GLuint id)
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
GLuint GLuint GLsizei count
PFNGLGETINTEGERVPROC GetIntegerv
GLFWAPI void glfwSwapInterval(int interval)
Sets the swap interval for the current context.
#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT
GLFWAPI void glfwSwapBuffers(GLFWwindow *handle)
Swaps the front and back buffers of the specified window.
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *handle)
Makes the context of the specified window current for the calling thread.
void(APIENTRY * PFNGLCLEARPROC)(GLbitfield)
struct _GLFWwindow::@0 context
#define GLFW_RELEASE_BEHAVIOR_FLUSH
#define GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version is not available.
#define GLFW_INVALID_ENUM
One of the arguments to the function was an invalid enum value.
#define GLFW_INVALID_VALUE
One of the arguments to the function was an invalid value.
GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig *ctxconfig)
Retrieves the attributes of the current context.
GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig *ctxconfig)
Checks whether the desired context attributes are valid.
static GLboolean parseVersionString(int *api, int *major, int *minor, int *rev)
#define GLFW_OPENGL_CORE_PROFILE
GLuint GLsizei GLsizei * length
void _glfwInputError(int error, const char *format,...)
Notifies shared code of an error.
#define GL_LOSE_CONTEXT_ON_RESET_ARB
#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT
GLFWAPI int glfwExtensionSupported(const char *extension)
Returns whether the specified extension is available.
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
Window and context structure.
Framebuffer configuration.
#define GL_NUM_EXTENSIONS
#define GLFW_NO_RESET_NOTIFICATION
GLFWAPI GLFWwindow * glfwGetCurrentContext(void)
Returns the window whose context is current on the calling thread.
void(* GLFWglproc)(void)
Client API function pointer type.