More refinements for OSMesa support - still not working

This commit is contained in:
Nigel Stewart 2015-10-10 09:26:00 +10:00
parent 6835e0841c
commit 771d75e722
8 changed files with 26 additions and 15 deletions

View File

@ -1,7 +1,7 @@
language: cpp language: cpp
#sudo: false #sudo: false
install: install:
- sudo apt-get install git dos2unix - sudo apt-get install git dos2unix libosmesa-dev
script: script:
- make -C auto clobber - make -C auto clobber
- make extensions - make extensions

View File

@ -204,8 +204,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy
$(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@ $(BIN)/make_list.pl $(GL_CORE_SPEC) | grep -v '\"GL_VERSION' >> $@
$(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@ $(BIN)/make_list.pl $(GL_EXT_SPEC) >> $@
echo -e "\n return GLEW_OK;\n}\n" >> $@ echo -e "\n return GLEW_OK;\n}\n" >> $@
echo -e "\n#if defined(GLEW_OSMESA)" >> $@ echo -e "\n#if defined(_WIN32) && ! defined(GLEW_OSMESA)" >> $@
echo -e "\n#elif defined(_WIN32)" >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@ echo -e "\n#if !defined(GLEW_MX)" >> $@
$(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@ $(BIN)/make_def_fun.pl WGL $(WGL_EXT_SPEC) >> $@
$(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@ $(BIN)/make_def_var.pl WGL $(WGL_EXT_SPEC) >> $@

View File

@ -140,10 +140,10 @@ void* NSGLGetProcAddress (const GLubyte *name)
/* /*
* Define glewGetProcAddress. * Define glewGetProcAddress.
*/ */
#if defined(GLEW_OSMESA) #if defined(GLEW_REGAL)
# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
#elif defined(GLEW_REGAL)
# define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name) # define glewGetProcAddress(name) regalGetProcAddress((const GLchar *)name)
#elif defined(GLEW_OSMESA)
# define glewGetProcAddress(name) OSMesaGetProcAddress((const char *)name)
#elif defined(_WIN32) #elif defined(_WIN32)
# define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name) # define glewGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)

View File

@ -39,11 +39,11 @@ GLenum GLEWAPIENTRY glewInit (void)
GLenum r; GLenum r;
r = glewContextInit(); r = glewContextInit();
if ( r != 0 ) return r; if ( r != 0 ) return r;
#if defined(GLEW_OSMESA) #if defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
return r; return r;
#elif defined(_WIN32) #elif defined(_WIN32)
return wglewInit(); return wglewInit();
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */ #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
return glxewInit(); return glxewInit();
#else #else
return r; return r;

View File

@ -4,8 +4,7 @@
return ret; return ret;
} }
#if defined(GLEW_OSMESA) #if defined(_WIN32) && !defined(GLEW_OSMESA)
#elif defined(_WIN32)
#if defined(GLEW_MX) #if defined(GLEW_MX)
GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext* ctx, const char* name) GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext* ctx, const char* name)

View File

@ -24,11 +24,10 @@ static FILE* f;
#ifdef GLEW_MX #ifdef GLEW_MX
GLEWContext _glewctx; GLEWContext _glewctx;
#define glewGetContext() (&_glewctx) #define glewGetContext() (&_glewctx)
#if defined(GLEW_OSMESA) #if defined(_WIN32)
#elif defined(_WIN32)
WGLEWContext _wglewctx; WGLEWContext _wglewctx;
#define wglewGetContext() (&_wglewctx) #define wglewGetContext() (&_wglewctx)
#elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX) #elif !defined(GLEW_OSMESA) && !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
GLXEWContext _glxewctx; GLXEWContext _glxewctx;
#define glxewGetContext() (&_glxewctx) #define glxewGetContext() (&_glxewctx)
#endif #endif

View File

@ -2,8 +2,7 @@
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
#if defined(GLEW_OSMESA) #if defined(_WIN32) && !defined(GLEW_OSMESA)
#elif defined(_WIN32)
static void wglewInfo () static void wglewInfo ()
{ {

View File

@ -13,6 +13,7 @@ endif()
set(CMAKE_DEBUG_POSTFIX d) set(CMAKE_DEBUG_POSTFIX d)
option (BUILD_UTILS "utilities" ON) option (BUILD_UTILS "utilities" ON)
option (GLEW_OSMESA "OSMesa mode" FALSE)
set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..) set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
@ -41,6 +42,20 @@ set (GLEW_LIBRARIES ${OPENGL_LIBRARIES})
add_definitions (-DGLEW_NO_GLU) add_definitions (-DGLEW_NO_GLU)
#### OSMesa ####
if (GLEW_OSMESA)
if (WIN32)
set (OSMESA_LIB_NAME osmesa)
else ()
set (OSMESA_LIB_NAME OSMesa)
endif ()
add_definitions (-DGLEW_OSMESA)
set (GLEW_LIBRARIES ${OSMESA_LIB_NAME} ${OPENGL_LIBRARIES})
endif ()
#### GLEW ####
include_directories (${GLEW_DIR}/include) include_directories (${GLEW_DIR}/include)
add_library (glew SHARED ${GLEW_DIR}/src/glew.c) add_library (glew SHARED ${GLEW_DIR}/src/glew.c)