diff options
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 39 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 40 |
2 files changed, 41 insertions, 38 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 783806d5d7db..695a43389b1e 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -72,43 +72,6 @@ class OpenGLTests; /// Holds the information of our new child window struct GLWindow { - // Copy of gluCheckExtension(), from the Apache-licensed - // https://code.google.com/p/glues/source/browse/trunk/glues/source/glues_registry.c - static GLboolean checkExtension(const GLubyte* extName, const GLubyte* extString) - { - GLboolean flag=GL_FALSE; - char* word; - char* lookHere; - char* deleteThis; - - if (extString==nullptr) - { - return GL_FALSE; - } - - deleteThis=lookHere=static_cast<char*>(malloc(strlen(reinterpret_cast<const char*>(extString))+1)); - if (lookHere==nullptr) - { - return GL_FALSE; - } - - /* strtok() will modify string, so copy it somewhere */ - strcpy(lookHere, reinterpret_cast<const char*>(extString)); - - while ((word=strtok(lookHere, " "))!=nullptr) - { - if (strcmp(word, reinterpret_cast<const char*>(extName))==0) - { - flag=GL_TRUE; - break; - } - lookHere=nullptr; /* get next token */ - } - free(static_cast<void*>(deleteThis)); - - return flag; - } - #if defined( _WIN32 ) HWND hWnd; HDC hDC; @@ -129,7 +92,7 @@ struct GLWindow GLXContext ctx; GLXPixmap glPix; - bool HasGLXExtension( const char* name ) { return checkExtension( reinterpret_cast<const GLubyte*>(name), reinterpret_cast<const GLubyte*>(GLXExtensions) ); } + bool HasGLXExtension( const char* name ) const; const char* GLXExtensions; #endif unsigned int bpp; diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index bf5b5d7c79e6..8088b656cd43 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -665,7 +665,47 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen) return ImplInit(); } +// Copy of gluCheckExtension(), from the Apache-licensed +// https://code.google.com/p/glues/source/browse/trunk/glues/source/glues_registry.c +static GLboolean checkExtension(const GLubyte* extName, const GLubyte* extString) +{ + GLboolean flag=GL_FALSE; + char* word; + char* lookHere; + char* deleteThis; + + if (extString==nullptr) + { + return GL_FALSE; + } + + deleteThis=lookHere=static_cast<char*>(malloc(strlen(reinterpret_cast<const char*>(extString))+1)); + if (lookHere==nullptr) + { + return GL_FALSE; + } + + /* strtok() will modify string, so copy it somewhere */ + strcpy(lookHere, reinterpret_cast<const char*>(extString)); + + while ((word=strtok(lookHere, " "))!=nullptr) + { + if (strcmp(word, reinterpret_cast<const char*>(extName))==0) + { + flag=GL_TRUE; + break; + } + lookHere=nullptr; /* get next token */ + } + free(static_cast<void*>(deleteThis)); + return flag; +} + +bool GLWindow::HasGLXExtension( const char* name ) const +{ + return checkExtension( reinterpret_cast<const GLubyte*>(name), reinterpret_cast<const GLubyte*>(GLXExtensions) ); +} bool OpenGLContext::ImplInit() { |