osmesa: Resolve compilation warnings

This commit is contained in:
Nigel Stewart 2025-06-19 21:42:17 +10:00
parent e1e8480902
commit 42a8e208f6
4 changed files with 13 additions and 3 deletions

View File

@ -5,7 +5,12 @@
#if defined(GLEW_EGL)
#include <GL/eglew.h>
#elif defined(GLEW_OSMESA)
#ifndef GLAPI
#define GLAPI extern
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#include <GL/osmesa.h>
#elif defined(_WIN32)
#include <GL/wglew.h>

View File

@ -315,13 +315,15 @@ static GLubyte *osmPixels = NULL;
GLboolean glewCreateContext (struct createParams *params)
{
(void) params; /* not used */
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))
if (!OSMesaMakeCurrent(ctx, osmPixels, osmFormat, osmWidth, osmHeight))
{
return GL_TRUE;
}

View File

@ -1,4 +1,4 @@
include config/Makefile.linux
LDFLAGS.GL = -lOSMesa
CFLAGS.EXTRA += -DGLEW_OSMESA
CFLAGS.EXTRA += -DGLEW_OSMESA -Wno-cast-function-type

View File

@ -36,6 +36,9 @@
#include <GL/glew.h>
#if defined(GLEW_OSMESA)
#define GLAPI extern
#ifndef APIENTRY
#define APIENTRY
#endif
#include <GL/osmesa.h>
#elif defined(GLEW_EGL)
#include <GL/eglew.h>
@ -1028,7 +1031,7 @@ GLboolean CreateContext (GLContext* ctx)
{
osmPixels = (GLubyte *) calloc(osmWidth*osmHeight*4, 1);
}
if (!OSMesaMakeCurrent(ctx->ctx, osmPixels, GL_UNSIGNED_BYTE, osmWidth, osmHeight))
if (!OSMesaMakeCurrent(ctx->ctx, osmPixels, osmFormat, osmWidth, osmHeight))
{
return GL_TRUE;
}