2 libgliar - a library that can fake the OpenGL context info returned by
5 Copyright (C) 2013 Canonical Ltd
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 Author: Eleni Maria Stea <elene.mst@gmail.com>
34 static const GLubyte* (*gl_get_string)(GLenum);
35 /*static const GLubyte* (*gl_get_stringi)(GLenum, GLuint);
37 static const void* (*gl_get_booleanv)(GLenum, GLboolean*);
38 static const void* (*gl_get_doublev)(GLenum, GLdouble*);
39 static const void* (*gl_get_floatv)(GLenum, GLfloat*);
40 static const void* (*gl_get_integerv)(GLenum, GLint*);
41 static const void* (*gl_get_integer64v)(GLenum, GLint64*);
43 static const void* (*gl_get_booleani_v)(GLenum, GLuint, GLboolean*);
44 static const void* (*gl_get_doublei_v)(GLenum, GLuint, GLdouble*);
45 static const void* (*gl_get_floati_v)(GLenum, GLuint, GLfloat*);
46 static const void* (*gl_get_integeri_v)(GLenum, GLuint, GLint*);
47 static const void* (*gl_get_integer64i_v)(GLenum, GLuint, GLint64*);*/
49 static struct cfgopt *cfglist;
57 if(!(cfglist = gliar_load_cfg("gliar.conf"))) {
61 if((pw = getpwuid(getuid()))) {
64 homedir = getenv("HOME");
68 path = alloca(strlen(homedir) + strlen(".gliar.conf") + 2);
69 sprintf(path, "%s/.gliar.conf", homedir);
71 cfglist = gliar_load_cfg(path);
75 gl_get_string = dlsym(RTLD_NEXT, "glGetString");
76 /* gl_get_stringi = dlsym(RTLD_NEXT, "glGetStringi");
78 gl_get_booleanv = dlsym(RTLD_NEXT, "glGetBooleanv");
79 gl_get_doublev = dlsym(RTLD_NEXT, "glGetDoublev");
80 gl_get_floatv = dlsym(RTLD_NEXT, "glGetFloatv");
81 gl_get_integerv = dlsym(RTLD_NEXT, "glGetIntegerv");
82 gl_get_integer64v = dlsym(RTLD_NEXT, "glGetInteger64v");
84 gl_get_booleani_v = dlsym(RTLD_NEXT, "glGetBooleani_v");
85 gl_get_doublei_v = dlsym(RTLD_NEXT, "glGetDoublei_v");
86 gl_get_floati_v = dlsym(RTLD_NEXT, "glGetFloati_v");
87 gl_get_integeri_v = dlsym(RTLD_NEXT, "glGetIntegeri_v");
88 gl_get_integer64i_v = dlsym(RTLD_NEXT, "glGetInteger64i_v");*/
94 const GLubyte *glGetString(GLenum name)
96 const char *key, *value;
117 case GL_SHADING_LANGUAGE_VERSION:
125 if(key && (value = gliar_find_opt(cfglist, key))) {
129 return gl_get_string(name);