mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-11 09:33:49 +00:00
OSMesaMakeCurrent for glewCreateContext in GLEW_OSMESA mode.
This commit is contained in:
parent
c5c60068f7
commit
06891ebb35
@ -159,10 +159,23 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params)
|
||||
#if defined(GLEW_OSMESA)
|
||||
OSMesaContext ctx;
|
||||
|
||||
static const GLint osmFormat = GL_UNSIGNED_BYTE;
|
||||
static const GLint osmWidth = 640;
|
||||
static const GLint osmHeight = 480;
|
||||
static GLubyte *osmPixels = NULL;
|
||||
|
||||
GLboolean glewCreateContext (struct createParams *params)
|
||||
{
|
||||
ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
|
||||
if (NULL == ctx) return GL_TRUE;
|
||||
if (NULL == osmPixels)
|
||||
{
|
||||
osmPixels = (GLubyte *) calloc(osmWidth*osmHeight*4, 1);
|
||||
}
|
||||
if (!OSMesaMakeCurrent(ctx, osmPixels, GL_UNSIGNED_BYTE, osmWidth, osmHeight))
|
||||
{
|
||||
return GL_TRUE;
|
||||
}
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1022,11 +1022,24 @@ void InitContext (GLContext* ctx)
|
||||
ctx->ctx = NULL;
|
||||
}
|
||||
|
||||
static const GLint osmFormat = GL_UNSIGNED_BYTE;
|
||||
static const GLint osmWidth = 640;
|
||||
static const GLint osmHeight = 480;
|
||||
static GLubyte *osmPixels = NULL;
|
||||
|
||||
GLboolean CreateContext (GLContext* ctx)
|
||||
{
|
||||
if (NULL == ctx) return GL_TRUE;
|
||||
ctx->ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
|
||||
if (NULL == ctx->ctx) return GL_TRUE;
|
||||
if (NULL == osmPixels)
|
||||
{
|
||||
osmPixels = (GLubyte *) calloc(osmWidth*osmHeight*4, 1);
|
||||
}
|
||||
if (!OSMesaMakeCurrent(ctx->ctx, osmPixels, GL_UNSIGNED_BYTE, osmWidth, osmHeight))
|
||||
{
|
||||
return GL_TRUE;
|
||||
}
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user