diff options
Diffstat (limited to 'source/blender/freestyle/intern/rendering/GLUtils.cpp')
-rwxr-xr-x | source/blender/freestyle/intern/rendering/GLUtils.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/rendering/GLUtils.cpp b/source/blender/freestyle/intern/rendering/GLUtils.cpp new file mode 100755 index 00000000000..5e9ba2a5bf4 --- /dev/null +++ b/source/blender/freestyle/intern/rendering/GLUtils.cpp @@ -0,0 +1,68 @@ + +// +// Copyright (C) : Please refer to the COPYRIGHT file distributed +// with this source distribution. +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +/////////////////////////////////////////////////////////////////////////////// +#include "GLUtils.h" + +# ifdef WIN32 +# include <windows.h> +# endif +# ifdef __MACH__ +# include <OpenGL/gl.h> +# else +# include <GL/gl.h> +# endif +#include <string.h> + +int isExtensionSupported(const char *extension) +{ + const GLubyte *extensions = NULL; + const GLubyte *start; + GLubyte *where, *terminator; + + /* Extension names should not have spaces. */ + where = (GLubyte *) strchr(extension, ' '); + if (where || *extension == '\0') + return 0; + extensions = glGetString(GL_EXTENSIONS); + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + start = extensions; + for (;;) { + where = (GLubyte *) strstr((const char *) start, extension); + if (!where) + break; + terminator = where + strlen(extension); + if (where == start || *(where - 1) == ' ') + if (*terminator == ' ' || *terminator == '\0') + return 1; + start = terminator; + } + return 0; +} + +void *glutils_extgl_GetProcAddress(const char *name) +{ +#ifdef _WIN32 + void *t = wglGetProcAddress(name); + return t; +#endif +} + |