Add GLFW_OSMESA_CONTEXT_API

This allows the creation of OpenGL contexts via OSMesa on existing
platforms.  It does not add a compile- or link-time dependency on
OSMesa.

Fixes #281.
This commit is contained in:
Camilla Löwy
2017-02-28 19:23:25 +01:00
parent a44f2c0e65
commit e9560ef021
18 changed files with 96 additions and 39 deletions

View File

@@ -43,6 +43,7 @@
#define API_NAME_NATIVE "native"
#define API_NAME_EGL "egl"
#define API_NAME_OSMESA "osmesa"
#define PROFILE_NAME_CORE "core"
#define PROFILE_NAME_COMPAT "compat"
@@ -65,7 +66,8 @@ static void usage(void)
BEHAVIOR_NAME_FLUSH ")\n");
printf(" -c, --context-api=API the context creation API to use ("
API_NAME_NATIVE " or "
API_NAME_EGL ")\n");
API_NAME_EGL " or "
API_NAME_OSMESA ")\n");
printf(" -d, --debug request a debug context\n");
printf(" -f, --forward require a forward-compatible context\n");
printf(" -h, --help show this help\n");
@@ -452,6 +454,8 @@ int main(int argc, char** argv)
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
else if (strcasecmp(optarg, API_NAME_EGL) == 0)
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
else if (strcasecmp(optarg, API_NAME_OSMESA) == 0)
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_OSMESA_CONTEXT_API);
else
{
usage();