mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 16:44:11 +00:00
Add GLFW_NO_API for creating context-less windows
This commit is contained in:
+18
-1
@@ -89,7 +89,8 @@ static GLFWbool parseVersionString(int* api, int* major, int* minor, int* rev)
|
||||
|
||||
GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
|
||||
{
|
||||
if (ctxconfig->api != GLFW_OPENGL_API &&
|
||||
if (ctxconfig->api != GLFW_NO_API &&
|
||||
ctxconfig->api != GLFW_OPENGL_API &&
|
||||
ctxconfig->api != GLFW_OPENGL_ES_API)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid client API");
|
||||
@@ -536,7 +537,15 @@ int _glfwStringInExtensionString(const char* string, const char* extensions)
|
||||
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (window->context.api == GLFW_NO_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwPlatformMakeContextCurrent(window);
|
||||
}
|
||||
|
||||
@@ -549,7 +558,15 @@ GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
|
||||
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
|
||||
{
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
|
||||
_GLFW_REQUIRE_INIT();
|
||||
|
||||
if (window->context.api == GLFW_NO_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwPlatformSwapBuffers(window);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user