summaryrefslogtreecommitdiff
path: root/vcl/source/opengl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-11-11 18:06:29 +0200
committerTor Lillqvist <tml@collabora.com>2015-11-11 18:06:42 +0200
commitbb34de0189a7c2ac81c08f3a283a71c2e67093d3 (patch)
tree771b9b7798a201e8d7ec8e8b84bda6199fce4bbb /vcl/source/opengl
parent11fc639c0897a192f1da0c69d1f7ab683ff1208e (diff)
Move checkExtension() to a more private location
Change-Id: I9f8a4ca0991b59bb9b6af4d40e3136ce5c986731
Diffstat (limited to 'vcl/source/opengl')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx40
1 files changed, 40 insertions, 0 deletions
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()
{