2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
2011-03-06 01:46:39 +01:00
|
|
|
// GLFW - An OpenGL library
|
2010-09-07 17:34:51 +02:00
|
|
|
// Platform: X11/GLX
|
2010-09-07 17:41:26 +02:00
|
|
|
// API version: 3.0
|
2010-09-07 17:34:51 +02:00
|
|
|
// WWW: http://www.glfw.org/
|
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2002-2006 Marcus Geelnard
|
|
|
|
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
|
|
//
|
|
|
|
// 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"
|
|
|
|
|
2012-06-03 16:33:48 +02:00
|
|
|
#include <string.h>
|
2012-04-23 12:48:57 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-02-01 22:00:07 +01:00
|
|
|
// This is the only glXGetProcAddress variant not declared by glxext.h
|
2010-09-08 15:58:43 +02:00
|
|
|
void (*glXGetProcAddressEXT(const GLubyte* procName))();
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
|
2012-12-30 18:13:04 +01:00
|
|
|
#ifndef GLXBadProfileARB
|
|
|
|
#define GLXBadProfileARB 13
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2012-08-13 16:03:44 +02:00
|
|
|
//========================================================================
|
|
|
|
// Thread local storage attribute macro
|
|
|
|
//========================================================================
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define _GLFW_TLS __thread
|
|
|
|
#else
|
|
|
|
#define _GLFW_TLS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2012-12-30 18:13:04 +01:00
|
|
|
//========================================================================
|
|
|
|
// The X error code as provided to the X error handler
|
|
|
|
//========================================================================
|
|
|
|
static unsigned long _glfwErrorCode = Success;
|
|
|
|
|
|
|
|
|
2012-08-12 14:13:18 +02:00
|
|
|
//========================================================================
|
|
|
|
// The per-thread current context/window pointer
|
|
|
|
//========================================================================
|
2012-08-13 16:03:44 +02:00
|
|
|
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
|
2012-08-12 14:13:18 +02:00
|
|
|
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-04-23 12:48:57 +02:00
|
|
|
//========================================================================
|
|
|
|
// Returns the specified attribute of the specified GLXFBConfig
|
|
|
|
// NOTE: Do not call this unless we have found GLX 1.3+ or GLX_SGIX_fbconfig
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
static int getFBConfigAttrib(_GLFWwindow* window, GLXFBConfig fbconfig, int attrib)
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SGIX_fbconfig)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.GetFBConfigAttribSGIX(_glfw.x11.display,
|
|
|
|
fbconfig, attrib, &value);
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
|
|
|
else
|
2013-01-02 01:40:42 +01:00
|
|
|
glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// Return a list of available and usable framebuffer configs
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|
|
|
{
|
|
|
|
GLXFBConfig* fbconfigs;
|
|
|
|
_GLFWfbconfig* result;
|
|
|
|
int i, count = 0;
|
2012-06-03 16:31:56 +02:00
|
|
|
const char* vendor;
|
|
|
|
GLboolean trustWindowBit = GL_TRUE;
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
*found = 0;
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.versionMajor == 1 && _glfw.glx.versionMinor < 3)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
if (!_glfw.glx.SGIX_fbconfig)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
|
|
|
"GLX: GLXFBConfig support not found");
|
2012-04-23 12:48:57 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
|
2012-06-03 16:31:56 +02:00
|
|
|
|
|
|
|
if (strcmp(vendor, "Chromium") == 0)
|
|
|
|
{
|
2012-11-23 12:02:09 +01:00
|
|
|
// HACK: This is a (hopefully temporary) workaround for Chromium
|
|
|
|
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
2012-06-03 16:31:56 +02:00
|
|
|
trustWindowBit = GL_FALSE;
|
|
|
|
}
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SGIX_fbconfig)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
fbconfigs = _glfw.glx.ChooseFBConfigSGIX(_glfw.x11.display,
|
|
|
|
_glfw.x11.screen,
|
|
|
|
NULL,
|
|
|
|
&count);
|
2012-04-23 12:48:57 +02:00
|
|
|
if (!count)
|
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
|
|
|
"GLX: No GLXFBConfigs returned");
|
2012-04-23 12:48:57 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
fbconfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen, &count);
|
2012-04-23 12:48:57 +02:00
|
|
|
if (!count)
|
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
|
|
|
"GLX: No GLXFBConfigs returned");
|
2012-04-23 12:48:57 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
result = (_GLFWfbconfig*) malloc(sizeof(_GLFWfbconfig) * count);
|
|
|
|
if (!result)
|
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_OUT_OF_MEMORY, NULL);
|
2012-04-23 12:48:57 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
2012-06-03 16:40:54 +02:00
|
|
|
_GLFWfbconfig* f = result + *found;
|
|
|
|
|
2012-04-23 12:48:57 +02:00
|
|
|
if (!getFBConfigAttrib(window, fbconfigs[i], GLX_DOUBLEBUFFER) ||
|
|
|
|
!getFBConfigAttrib(window, fbconfigs[i], GLX_VISUAL_ID))
|
|
|
|
{
|
|
|
|
// Only consider double-buffered GLXFBConfigs with associated visuals
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(getFBConfigAttrib(window,
|
|
|
|
fbconfigs[i],
|
|
|
|
GLX_RENDER_TYPE) & GLX_RGBA_BIT))
|
|
|
|
{
|
|
|
|
// Only consider RGBA GLXFBConfigs
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(getFBConfigAttrib(window, fbconfigs[i], GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
|
|
|
|
{
|
2012-06-03 16:31:56 +02:00
|
|
|
if (trustWindowBit)
|
|
|
|
{
|
|
|
|
// Only consider window GLXFBConfigs
|
|
|
|
continue;
|
|
|
|
}
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
|
|
|
|
2012-06-03 16:40:54 +02:00
|
|
|
f->redBits = getFBConfigAttrib(window, fbconfigs[i], GLX_RED_SIZE);
|
|
|
|
f->greenBits = getFBConfigAttrib(window, fbconfigs[i], GLX_GREEN_SIZE);
|
|
|
|
f->blueBits = getFBConfigAttrib(window, fbconfigs[i], GLX_BLUE_SIZE);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-06-03 16:40:54 +02:00
|
|
|
f->alphaBits = getFBConfigAttrib(window, fbconfigs[i], GLX_ALPHA_SIZE);
|
|
|
|
f->depthBits = getFBConfigAttrib(window, fbconfigs[i], GLX_DEPTH_SIZE);
|
|
|
|
f->stencilBits = getFBConfigAttrib(window, fbconfigs[i], GLX_STENCIL_SIZE);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-06-03 16:40:54 +02:00
|
|
|
f->accumRedBits = getFBConfigAttrib(window, fbconfigs[i], GLX_ACCUM_RED_SIZE);
|
|
|
|
f->accumGreenBits = getFBConfigAttrib(window, fbconfigs[i], GLX_ACCUM_GREEN_SIZE);
|
|
|
|
f->accumBlueBits = getFBConfigAttrib(window, fbconfigs[i], GLX_ACCUM_BLUE_SIZE);
|
|
|
|
f->accumAlphaBits = getFBConfigAttrib(window, fbconfigs[i], GLX_ACCUM_ALPHA_SIZE);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-06-03 16:40:54 +02:00
|
|
|
f->auxBuffers = getFBConfigAttrib(window, fbconfigs[i], GLX_AUX_BUFFERS);
|
|
|
|
f->stereo = getFBConfigAttrib(window, fbconfigs[i], GLX_STEREO);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.ARB_multisample)
|
2012-06-03 16:40:54 +02:00
|
|
|
f->samples = getFBConfigAttrib(window, fbconfigs[i], GLX_SAMPLES);
|
2012-04-23 12:48:57 +02:00
|
|
|
else
|
2012-06-03 16:40:54 +02:00
|
|
|
f->samples = 0;
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.ARB_framebuffer_sRGB)
|
2012-12-02 16:10:00 +01:00
|
|
|
f->sRGB = getFBConfigAttrib(window, fbconfigs[i], GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
|
|
|
|
else
|
|
|
|
f->sRGB = GL_FALSE;
|
|
|
|
|
2012-06-03 16:40:54 +02:00
|
|
|
f->platformID = (GLFWintptr) getFBConfigAttrib(window, fbconfigs[i], GLX_FBCONFIG_ID);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
(*found)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
XFree(fbconfigs);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
2012-12-30 18:13:04 +01:00
|
|
|
// Error handler used when creating a context with the GLX_ARB_create_context
|
|
|
|
// extension set
|
2012-04-23 12:48:57 +02:00
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
static int errorHandler(Display *display, XErrorEvent* event)
|
|
|
|
{
|
2012-12-30 18:13:04 +01:00
|
|
|
_glfwErrorCode = event->error_code;
|
2012-04-23 12:48:57 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
2012-12-30 18:13:04 +01:00
|
|
|
// Create the OpenGL context using legacy API
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
static void createLegacyContext(_GLFWwindow* window,
|
|
|
|
const _GLFWwndconfig* wndconfig,
|
|
|
|
GLXFBConfig fbconfig,
|
|
|
|
GLXContext share)
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SGIX_fbconfig)
|
2012-12-30 18:13:04 +01:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
window->glx.context =
|
|
|
|
_glfw.glx.CreateContextWithConfigSGIX(_glfw.x11.display,
|
|
|
|
fbconfig,
|
|
|
|
GLX_RGBA_TYPE,
|
|
|
|
share,
|
|
|
|
True);
|
2012-12-30 18:13:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
window->glx.context = glXCreateNewContext(_glfw.x11.display,
|
2012-12-30 18:13:04 +01:00
|
|
|
fbconfig,
|
|
|
|
GLX_RGBA_TYPE,
|
|
|
|
share,
|
|
|
|
True);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// Create the OpenGL context
|
2012-04-23 12:48:57 +02:00
|
|
|
//========================================================================
|
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
#define setGLXattrib(attribName, attribValue) \
|
2012-04-23 12:48:57 +02:00
|
|
|
attribs[index++] = attribName; \
|
|
|
|
attribs[index++] = attribValue;
|
|
|
|
|
|
|
|
static int createContext(_GLFWwindow* window,
|
|
|
|
const _GLFWwndconfig* wndconfig,
|
|
|
|
GLXFBConfigID fbconfigID)
|
|
|
|
{
|
|
|
|
int attribs[40];
|
|
|
|
GLXFBConfig* fbconfig;
|
|
|
|
GLXContext share = NULL;
|
|
|
|
|
|
|
|
if (wndconfig->share)
|
2013-01-02 01:40:42 +01:00
|
|
|
share = wndconfig->share->glx.context;
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
// Retrieve the previously selected GLXFBConfig
|
|
|
|
{
|
2012-12-13 20:43:15 +01:00
|
|
|
int dummy, index = 0;
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
setGLXattrib(GLX_FBCONFIG_ID, (int) fbconfigID);
|
|
|
|
setGLXattrib(None, None);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SGIX_fbconfig)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
fbconfig = _glfw.glx.ChooseFBConfigSGIX(_glfw.x11.display,
|
|
|
|
_glfw.x11.screen,
|
2012-12-13 20:43:15 +01:00
|
|
|
attribs,
|
|
|
|
&dummy);
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
fbconfig = glXChooseFBConfig(_glfw.x11.display,
|
|
|
|
_glfw.x11.screen,
|
2012-04-23 12:48:57 +02:00
|
|
|
attribs,
|
|
|
|
&dummy);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fbconfig == NULL)
|
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
|
|
"GLX: Failed to retrieve the selected GLXFBConfig");
|
2012-04-23 12:48:57 +02:00
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Retrieve the corresponding visual
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SGIX_fbconfig)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
window->glx.visual =
|
|
|
|
_glfw.glx.GetVisualFromFBConfigSGIX(_glfw.x11.display, *fbconfig);
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display,
|
2012-04-23 12:48:57 +02:00
|
|
|
*fbconfig);
|
|
|
|
}
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (window->glx.visual == NULL)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
|
|
|
XFree(fbconfig);
|
|
|
|
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
|
|
"GLX: Failed to retrieve visual for GLXFBConfig");
|
2012-04-23 12:48:57 +02:00
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
if (!_glfw.glx.ARB_create_context ||
|
|
|
|
!_glfw.glx.ARB_create_context_profile ||
|
|
|
|
!_glfw.glx.EXT_create_context_es2_profile)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
|
|
|
"GLX: OpenGL ES requested but "
|
|
|
|
"GLX_EXT_create_context_es2_profile is unavailable");
|
2012-12-13 20:43:15 +01:00
|
|
|
return GL_FALSE;
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
2012-12-13 20:43:15 +01:00
|
|
|
}
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->glForward)
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
if (!_glfw.glx.ARB_create_context)
|
2012-07-22 01:10:59 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
|
|
|
"GLX: Forward compatibility requested but "
|
|
|
|
"GLX_ARB_create_context_profile is unavailable");
|
2012-12-13 20:43:15 +01:00
|
|
|
return GL_FALSE;
|
2012-07-22 01:10:59 +02:00
|
|
|
}
|
2012-12-13 20:43:15 +01:00
|
|
|
}
|
2012-07-22 01:10:59 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->glProfile)
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
if (!_glfw.glx.ARB_create_context ||
|
|
|
|
!_glfw.glx.ARB_create_context_profile)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
|
|
|
|
"GLX: An OpenGL profile requested but "
|
|
|
|
"GLX_ARB_create_context_profile is unavailable");
|
2012-12-13 20:43:15 +01:00
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.ARB_create_context)
|
2012-12-13 20:43:15 +01:00
|
|
|
{
|
|
|
|
int index = 0, mask = 0, flags = 0, strategy = 0;
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->clientAPI == GLFW_OPENGL_API)
|
|
|
|
{
|
2012-04-23 12:48:57 +02:00
|
|
|
if (wndconfig->glForward)
|
|
|
|
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
|
|
|
|
|
|
|
if (wndconfig->glDebug)
|
|
|
|
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->glProfile)
|
|
|
|
{
|
|
|
|
if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE)
|
|
|
|
mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
|
|
|
else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE)
|
|
|
|
mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
|
|
|
}
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
2012-12-13 20:43:15 +01:00
|
|
|
else
|
|
|
|
mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->glRobustness != GLFW_NO_ROBUSTNESS)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.ARB_create_context_robustness)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION)
|
|
|
|
strategy = GLX_NO_RESET_NOTIFICATION_ARB;
|
|
|
|
else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET)
|
|
|
|
strategy = GLX_LOSE_CONTEXT_ON_RESET_ARB;
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
|
|
|
|
}
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2012-12-13 20:43:15 +01:00
|
|
|
// NOTE: Only request an explicitly versioned context when
|
|
|
|
// necessary, as explicitly requesting version 1.0 does not always
|
|
|
|
// return the highest available version
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
|
|
|
|
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
|
|
|
|
}
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (mask)
|
|
|
|
setGLXattrib(GLX_CONTEXT_PROFILE_MASK_ARB, mask);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
if (flags)
|
|
|
|
setGLXattrib(GLX_CONTEXT_FLAGS_ARB, flags);
|
|
|
|
|
|
|
|
if (strategy)
|
|
|
|
setGLXattrib(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB, strategy);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
2012-12-13 20:43:15 +01:00
|
|
|
setGLXattrib(None, None);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
// This is the only place we set an Xlib error handler, and we only do
|
|
|
|
// it because glXCreateContextAttribsARB generates a BadMatch error if
|
|
|
|
// the requested OpenGL version is unavailable (instead of a civilized
|
|
|
|
// response like returning NULL)
|
2012-12-30 18:13:04 +01:00
|
|
|
_glfwErrorCode = Success;
|
2012-04-23 12:48:57 +02:00
|
|
|
XSetErrorHandler(errorHandler);
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
window->glx.context =
|
|
|
|
_glfw.glx.CreateContextAttribsARB(_glfw.x11.display,
|
|
|
|
*fbconfig,
|
|
|
|
share,
|
|
|
|
True,
|
|
|
|
attribs);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
// We are done, so unset the error handler again (see above)
|
|
|
|
XSetErrorHandler(NULL);
|
2012-12-30 18:13:04 +01:00
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (window->glx.context == NULL)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2012-12-30 18:13:04 +01:00
|
|
|
// HACK: This is a fallback for the broken Mesa implementation of
|
|
|
|
// GLX_ARB_create_context_profile, which fails default 1.0 context
|
|
|
|
// creation with a GLXBadProfileARB error in violation of the spec
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfwErrorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
2012-12-30 18:13:04 +01:00
|
|
|
wndconfig->clientAPI == GLFW_OPENGL_API &&
|
|
|
|
wndconfig->glProfile == GLFW_OPENGL_NO_PROFILE &&
|
|
|
|
wndconfig->glForward == GL_FALSE)
|
|
|
|
{
|
|
|
|
createLegacyContext(window, wndconfig, *fbconfig, share);
|
|
|
|
}
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
|
|
|
}
|
2012-12-30 18:13:04 +01:00
|
|
|
else
|
|
|
|
createLegacyContext(window, wndconfig, *fbconfig, share);
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
XFree(fbconfig);
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (window->glx.context == NULL)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to create context");
|
2012-04-23 12:48:57 +02:00
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GL_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef setGLXattrib
|
|
|
|
|
|
|
|
|
2010-09-15 16:44:43 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
////// GLFW internal API //////
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2010-09-07 17:34:51 +02:00
|
|
|
|
2012-04-23 13:00:49 +02:00
|
|
|
//========================================================================
|
|
|
|
// Initialize GLX
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
int _glfwInitOpenGL(void)
|
|
|
|
{
|
|
|
|
#ifdef _GLFW_DLOPEN_LIBGL
|
|
|
|
int i;
|
|
|
|
char* libGL_names[ ] =
|
|
|
|
{
|
|
|
|
"libGL.so",
|
|
|
|
"libGL.so.1",
|
|
|
|
"/usr/lib/libGL.so",
|
|
|
|
"/usr/lib/libGL.so.1",
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
for (i = 0; libGL_names[i] != NULL; i++)
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.libGL = dlopen(libGL_names[i], RTLD_LAZY | RTLD_GLOBAL);
|
|
|
|
if (_glfw.glx.libGL)
|
2012-04-23 13:00:49 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (!_glfw.glx.libGL)
|
2012-04-23 13:00:49 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to find libGL");
|
2012-04-23 13:00:49 +02:00
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Check if GLX is supported on this display
|
2013-01-02 01:40:42 +01:00
|
|
|
if (!glXQueryExtension(_glfw.x11.display,
|
|
|
|
&_glfw.glx.errorBase,
|
|
|
|
&_glfw.glx.eventBase))
|
2012-04-23 13:00:49 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX support not found");
|
2012-04-23 13:00:49 +02:00
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (!glXQueryVersion(_glfw.x11.display,
|
|
|
|
&_glfw.glx.versionMajor,
|
|
|
|
&_glfw.glx.versionMinor))
|
2012-04-23 13:00:49 +02:00
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_API_UNAVAILABLE,
|
|
|
|
"GLX: Failed to query GLX version");
|
2012-04-23 13:00:49 +02:00
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-04-23 13:08:34 +02:00
|
|
|
if (_glfwPlatformExtensionSupported("GLX_EXT_swap_control"))
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
|
2012-04-23 13:08:34 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXSwapIntervalEXT");
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SwapIntervalEXT)
|
|
|
|
_glfw.glx.EXT_swap_control = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_glfwPlatformExtensionSupported("GLX_SGI_swap_control"))
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
|
2012-04-23 13:08:34 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXSwapIntervalSGI");
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SwapIntervalSGI)
|
|
|
|
_glfw.glx.SGI_swap_control = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
}
|
|
|
|
|
2012-07-15 16:48:39 +02:00
|
|
|
if (_glfwPlatformExtensionSupported("GLX_MESA_swap_control"))
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
|
2012-07-15 16:48:39 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXSwapIntervalMESA");
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.SwapIntervalMESA)
|
|
|
|
_glfw.glx.MESA_swap_control = GL_TRUE;
|
2012-07-15 16:48:39 +02:00
|
|
|
}
|
|
|
|
|
2012-04-23 13:08:34 +02:00
|
|
|
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)
|
2012-04-23 13:08:34 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXGetFBConfigAttribSGIX");
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.ChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)
|
2012-04-23 13:08:34 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXChooseFBConfigSGIX");
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.CreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)
|
2012-04-23 13:08:34 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXCreateContextWithConfigSGIX");
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.GetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)
|
2012-04-23 13:08:34 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXGetVisualFromFBConfigSGIX");
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.GetFBConfigAttribSGIX &&
|
|
|
|
_glfw.glx.ChooseFBConfigSGIX &&
|
|
|
|
_glfw.glx.CreateContextWithConfigSGIX &&
|
|
|
|
_glfw.glx.GetVisualFromFBConfigSGIX)
|
2012-04-23 13:08:34 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.SGIX_fbconfig = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.ARB_multisample = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
|
2012-12-02 16:10:00 +01:00
|
|
|
if (_glfwPlatformExtensionSupported("GLX_ARB_framebuffer_sRGB"))
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.ARB_framebuffer_sRGB = GL_TRUE;
|
2012-12-02 16:10:00 +01:00
|
|
|
|
2012-04-23 13:08:34 +02:00
|
|
|
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
2012-04-23 13:08:34 +02:00
|
|
|
_glfwPlatformGetProcAddress("glXCreateContextAttribsARB");
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.CreateContextAttribsARB)
|
|
|
|
_glfw.glx.ARB_create_context = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context_robustness"))
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.ARB_create_context_robustness = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
|
|
|
|
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context_profile"))
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.ARB_create_context_profile = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
|
|
|
|
if (_glfwPlatformExtensionSupported("GLX_EXT_create_context_es2_profile"))
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.EXT_create_context_es2_profile = GL_TRUE;
|
2012-04-23 13:08:34 +02:00
|
|
|
|
2012-04-23 13:00:49 +02:00
|
|
|
return GL_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// Terminate GLX
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
void _glfwTerminateOpenGL(void)
|
|
|
|
{
|
|
|
|
// Unload libGL.so if necessary
|
|
|
|
#ifdef _GLFW_DLOPEN_LIBGL
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.libGL != NULL)
|
2012-04-23 13:00:49 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
dlclose(_glfw.glx.libGL);
|
|
|
|
_glfw.glx.libGL = NULL;
|
2012-04-23 13:00:49 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-23 12:48:57 +02:00
|
|
|
//========================================================================
|
|
|
|
// Prepare for creation of the OpenGL context
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
int _glfwCreateContext(_GLFWwindow* window,
|
|
|
|
const _GLFWwndconfig* wndconfig,
|
|
|
|
const _GLFWfbconfig* fbconfig)
|
|
|
|
{
|
|
|
|
_GLFWfbconfig closest;
|
|
|
|
|
|
|
|
// Choose the best available fbconfig
|
|
|
|
{
|
|
|
|
unsigned int fbcount;
|
|
|
|
_GLFWfbconfig* fbconfigs;
|
|
|
|
const _GLFWfbconfig* result;
|
|
|
|
|
|
|
|
fbconfigs = getFBConfigs(window, &fbcount);
|
|
|
|
if (!fbconfigs)
|
|
|
|
return GL_FALSE;
|
|
|
|
|
|
|
|
result = _glfwChooseFBConfig(fbconfig, fbconfigs, fbcount);
|
|
|
|
if (!result)
|
|
|
|
{
|
2012-12-31 21:05:28 +01:00
|
|
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
|
|
|
"GLX: No GLXFBConfig matched the criteria");
|
2012-04-23 12:48:57 +02:00
|
|
|
|
|
|
|
free(fbconfigs);
|
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
closest = *result;
|
|
|
|
free(fbconfigs);
|
|
|
|
}
|
|
|
|
|
|
|
|
return createContext(window, wndconfig, closest.platformID);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// Destroy the OpenGL context
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
void _glfwDestroyContext(_GLFWwindow* window)
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
if (window->glx.visual)
|
2012-04-23 22:31:55 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
XFree(window->glx.visual);
|
|
|
|
window->glx.visual = NULL;
|
2012-04-23 22:31:55 +02:00
|
|
|
}
|
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (window->glx.context)
|
2012-04-23 12:48:57 +02:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
glXDestroyContext(_glfw.x11.display, window->glx.context);
|
|
|
|
window->glx.context = NULL;
|
2012-04-23 12:48:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-12 14:13:18 +02:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
////// GLFW platform API //////
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-07-27 16:01:27 +02:00
|
|
|
//========================================================================
|
|
|
|
// Make the OpenGL context associated with the specified window current
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
if (window)
|
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
glXMakeCurrent(_glfw.x11.display,
|
|
|
|
window->x11.handle,
|
|
|
|
window->glx.context);
|
2011-07-27 16:01:27 +02:00
|
|
|
}
|
|
|
|
else
|
2013-01-02 01:40:42 +01:00
|
|
|
glXMakeCurrent(_glfw.x11.display, None, NULL);
|
2012-08-12 14:13:18 +02:00
|
|
|
|
|
|
|
_glfwCurrentWindow = window;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// Return the window object whose context is current
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
_GLFWwindow* _glfwPlatformGetCurrentContext(void)
|
|
|
|
{
|
|
|
|
return _glfwCurrentWindow;
|
2011-07-27 16:01:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-04 14:25:12 +01:00
|
|
|
//========================================================================
|
|
|
|
// Swap OpenGL buffers
|
|
|
|
//========================================================================
|
|
|
|
|
2012-08-06 18:13:37 +02:00
|
|
|
void _glfwPlatformSwapBuffers(_GLFWwindow* window)
|
2011-03-04 14:25:12 +01:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
glXSwapBuffers(_glfw.x11.display, window->x11.handle);
|
2011-03-04 14:25:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// Set double buffering swap interval
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
void _glfwPlatformSwapInterval(int interval)
|
|
|
|
{
|
2012-08-12 14:13:18 +02:00
|
|
|
_GLFWwindow* window = _glfwCurrentWindow;
|
2011-03-04 14:25:12 +01:00
|
|
|
|
2013-01-02 01:40:42 +01:00
|
|
|
if (_glfw.glx.EXT_swap_control)
|
2011-03-04 14:25:12 +01:00
|
|
|
{
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.SwapIntervalEXT(_glfw.x11.display,
|
|
|
|
window->x11.handle,
|
|
|
|
interval);
|
2011-03-04 14:25:12 +01:00
|
|
|
}
|
2013-01-02 01:40:42 +01:00
|
|
|
else if (_glfw.glx.MESA_swap_control)
|
|
|
|
_glfw.glx.SwapIntervalMESA(interval);
|
|
|
|
else if (_glfw.glx.SGI_swap_control)
|
2012-07-15 16:48:39 +02:00
|
|
|
{
|
|
|
|
if (interval > 0)
|
2013-01-02 01:40:42 +01:00
|
|
|
_glfw.glx.SwapIntervalSGI(interval);
|
2012-07-15 16:48:39 +02:00
|
|
|
}
|
2011-03-04 14:25:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-07 17:34:51 +02:00
|
|
|
//========================================================================
|
|
|
|
// Check if an OpenGL extension is available at runtime
|
|
|
|
//========================================================================
|
|
|
|
|
2010-09-08 15:58:43 +02:00
|
|
|
int _glfwPlatformExtensionSupported(const char* extension)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2010-09-08 15:58:43 +02:00
|
|
|
const GLubyte* extensions;
|
2010-09-07 17:34:51 +02:00
|
|
|
|
|
|
|
// Get list of GLX extensions
|
2013-01-02 01:40:42 +01:00
|
|
|
extensions = (const GLubyte*) glXQueryExtensionsString(_glfw.x11.display,
|
|
|
|
_glfw.x11.screen);
|
2010-09-08 15:51:25 +02:00
|
|
|
if (extensions != NULL)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2010-09-08 15:51:25 +02:00
|
|
|
if (_glfwStringInExtensionString(extension, extensions))
|
2010-09-07 17:34:51 +02:00
|
|
|
return GL_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
// Get the function pointer to an OpenGL function
|
|
|
|
//========================================================================
|
|
|
|
|
2012-06-05 00:16:40 +02:00
|
|
|
GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
|
2010-09-07 17:34:51 +02:00
|
|
|
{
|
2012-06-05 00:16:40 +02:00
|
|
|
return _glfw_glXGetProcAddress((const GLubyte*) procname);
|
2010-09-07 17:34:51 +02:00
|
|
|
}
|
|
|
|
|