44 (width != window->
context.osmesa.width) ||
45 (height != window->
context.osmesa.height))
47 free(window->
context.osmesa.buffer);
50 window->
context.osmesa.buffer = calloc(4, width * height);
61 "OSMesa: Failed to make context current");
76 if (window->
context.osmesa.handle)
82 if (window->
context.osmesa.buffer)
84 free(window->
context.osmesa.buffer);
85 window->
context.osmesa.width = 0;
86 window->
context.osmesa.height = 0;
114 const char* sonames[] =
116 #if defined(_GLFW_OSMESA_LIBRARY) 117 _GLFW_OSMESA_LIBRARY,
118 #elif defined(_WIN32) 121 #elif defined(__APPLE__) 123 #elif defined(__CYGWIN__) 135 for (i = 0; sonames[
i]; i++)
163 if (!
_glfw.osmesa.CreateContextExt ||
164 !
_glfw.osmesa.DestroyContext ||
165 !
_glfw.osmesa.MakeCurrent ||
166 !
_glfw.osmesa.GetColorBuffer ||
167 !
_glfw.osmesa.GetDepthBuffer ||
168 !
_glfw.osmesa.GetProcAddress)
171 "OSMesa: Failed to load required entry points");
189 #define setAttrib(a, v) \ 191 assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \ 192 attribs[index++] = a; \ 193 attribs[index++] = v; \ 209 "OSMesa: OpenGL ES is not available on OSMesa");
213 if (ctxconfig->
share)
234 if (ctxconfig->
major != 1 || ctxconfig->
minor != 0)
243 "OSMesa: Foward-compatible contexts not supported");
249 window->
context.osmesa.handle =
257 "OSMesa: OpenGL profiles unavailable");
261 window->
context.osmesa.handle =
272 "OSMesa: Failed to create context");
297 GLint mesaWidth, mesaHeight, mesaFormat;
304 &mesaWidth, &mesaHeight,
305 &mesaFormat, &mesaBuffer))
308 "OSMesa: Failed to retrieve color buffer");
315 *height = mesaHeight;
317 *format = mesaFormat;
319 *buffer = mesaBuffer;
330 GLint mesaWidth, mesaHeight, mesaBytes;
337 &mesaWidth, &mesaHeight,
338 &mesaBytes, &mesaBuffer))
341 "OSMesa: Failed to retrieve depth buffer");
348 *height = mesaHeight;
350 *bytesPerValue = mesaBytes;
352 *buffer = mesaBuffer;
368 return window->
context.osmesa.handle;
#define OSMESA_STENCIL_BITS
#define OSMesaMakeCurrent
#define OSMESA_ACCUM_BITS
_GLFWswapbuffersfun swapBuffers
int(GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext, int *, int *, int *, void **)
#define GLFW_OPENGL_ES_API
void(GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext)
int(GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext, int *, int *, int *, void **)
#define OSMESA_CONTEXT_MAJOR_VERSION
_GLFWgetprocaddressfun getProcAddress
#define OSMesaGetDepthBuffer
#define GLFW_OPENGL_COMPAT_PROFILE
GLFWbool _glfwInitOSMesa(void)
static int extensionSupportedOSMesa(const char *extension)
GLuint64 GLenum void * handle
_GLFWdestroycontextfun destroy
void _glfwPlatformGetFramebufferSize(_GLFWwindow *window, int *width, int *height)
#define GLFW_NO_WINDOW_CONTEXT
The specified window does not have an OpenGL or OpenGL ES context.
OSMesaContext(GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int *, OSMesaContext)
#define GLFW_API_UNAVAILABLE
GLFW could not find support for the requested API on the system.
GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow *handle, int *width, int *height, int *format, void **buffer)
void _glfwTerminateOSMesa(void)
static void makeContextCurrentOSMesa(_GLFWwindow *window)
int(GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext, void *, int, int, int)
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
GLFWglproc(GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char *)
#define OSMESA_CONTEXT_MINOR_VERSION
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
#define OSMESA_COMPAT_PROFILE
static GLFWglproc getProcAddressOSMesa(const char *procname)
GLint GLsizei GLsizei height
GLint GLint GLsizei GLint GLenum format
_GLFWmakecontextcurrentfun makeCurrent
#define OSMESA_DEPTH_BITS
void _glfwInputError(int code, const char *format,...)
_GLFWextensionsupportedfun extensionSupported
OSMesaContext(GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum, GLint, GLint, GLint, OSMesaContext)
#define GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version is not available.
_GLFWswapintervalfun swapInterval
void _glfwPlatformSetTls(_GLFWtls *tls, void *value)
#define OSMesaCreateContextExt
#define OSMesaGetColorBuffer
#define OSMesaGetProcAddress
#define OSMesaCreateContextAttribs
#define GLFW_OPENGL_CORE_PROFILE
GLFWbool _glfwCreateContextOSMesa(_GLFWwindow *window, const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *fbconfig)
static void swapIntervalOSMesa(int interval)
GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow *handle, int *width, int *height, int *bytesPerValue, void **buffer)
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow *handle)
#define OSMESA_CORE_PROFILE
static void swapBuffersOSMesa(_GLFWwindow *window)
static void destroyContextOSMesa(_GLFWwindow *window)
#define OSMesaDestroyContext
struct GLFWwindow GLFWwindow