Merge https://github.com/nigels-com/glew.git into master HEAD at Mon Oct 12 17:44:18 GMT 2015

This commit is contained in:
omniavinco 2015-10-13 02:44:17 +09:00
commit fc0036b9b7
2 changed files with 26 additions and 0 deletions

View File

@ -159,10 +159,23 @@ GLboolean glewParseArgs (int argc, char** argv, struct createParams *params)
#if defined(GLEW_OSMESA) #if defined(GLEW_OSMESA)
OSMesaContext ctx; 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) GLboolean glewCreateContext (struct createParams *params)
{ {
ctx = OSMesaCreateContext(OSMESA_RGBA, NULL); ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
if (NULL == ctx) return GL_TRUE; 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; return GL_FALSE;
} }

View File

@ -1022,11 +1022,24 @@ void InitContext (GLContext* ctx)
ctx->ctx = NULL; 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) GLboolean CreateContext (GLContext* ctx)
{ {
if (NULL == ctx) return GL_TRUE; if (NULL == ctx) return GL_TRUE;
ctx->ctx = OSMesaCreateContext(OSMESA_RGBA, NULL); ctx->ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
if (NULL == ctx->ctx) return GL_TRUE; 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; return GL_FALSE;
} }