X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fgliar.c;h=1173a43bceae6e455ad512c2462b394a8a965407;hb=5f0b3ca4e21db7b0f0de939e956bd5f34fec3746;hp=38470f5e1ff9ab3f7b0d588d535571310754d278;hpb=b82d60137dc0b16ef451936fcc97fa8f25fe7b33;p=libgliar diff --git a/src/gliar.c b/src/gliar.c index 38470f5..1173a43 100644 --- a/src/gliar.c +++ b/src/gliar.c @@ -1,3 +1,25 @@ +/* +libgliar - a library that can fake the OpenGL context info returned by +the glGet OpenGL calls + +Copyright (C) 2013 Canonical Ltd + +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 3 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, see . + +Author: Eleni Maria Stea +*/ + #include #include #include @@ -8,7 +30,22 @@ #include "cfg.h" static int done_init; + static const GLubyte* (*gl_get_string)(GLenum); +/*static const GLubyte* (*gl_get_stringi)(GLenum, GLuint); + +static const void* (*gl_get_booleanv)(GLenum, GLboolean*); +static const void* (*gl_get_doublev)(GLenum, GLdouble*); +static const void* (*gl_get_floatv)(GLenum, GLfloat*); +static const void* (*gl_get_integerv)(GLenum, GLint*); +static const void* (*gl_get_integer64v)(GLenum, GLint64*); + +static const void* (*gl_get_booleani_v)(GLenum, GLuint, GLboolean*); +static const void* (*gl_get_doublei_v)(GLenum, GLuint, GLdouble*); +static const void* (*gl_get_floati_v)(GLenum, GLuint, GLfloat*); +static const void* (*gl_get_integeri_v)(GLenum, GLuint, GLint*); +static const void* (*gl_get_integer64i_v)(GLenum, GLuint, GLint64*);*/ + static struct cfgopt *cfglist; static int init(void) @@ -36,6 +73,19 @@ static int init(void) } gl_get_string = dlsym(RTLD_NEXT, "glGetString"); +/* gl_get_stringi = dlsym(RTLD_NEXT, "glGetStringi"); + + gl_get_booleanv = dlsym(RTLD_NEXT, "glGetBooleanv"); + gl_get_doublev = dlsym(RTLD_NEXT, "glGetDoublev"); + gl_get_floatv = dlsym(RTLD_NEXT, "glGetFloatv"); + gl_get_integerv = dlsym(RTLD_NEXT, "glGetIntegerv"); + gl_get_integer64v = dlsym(RTLD_NEXT, "glGetInteger64v"); + + gl_get_booleani_v = dlsym(RTLD_NEXT, "glGetBooleani_v"); + gl_get_doublei_v = dlsym(RTLD_NEXT, "glGetDoublei_v"); + gl_get_floati_v = dlsym(RTLD_NEXT, "glGetFloati_v"); + gl_get_integeri_v = dlsym(RTLD_NEXT, "glGetIntegeri_v"); + gl_get_integer64i_v = dlsym(RTLD_NEXT, "glGetInteger64i_v");*/ done_init = 1; return 0; @@ -43,7 +93,8 @@ static int init(void) const GLubyte *glGetString(GLenum name) { - const char *key, *value; + const char *key; + const struct cfgopt *option; init(); @@ -60,12 +111,20 @@ const GLubyte *glGetString(GLenum name) key = "extensions"; break; + case GL_RENDERER: + key = "renderer"; + break; + + case GL_SHADING_LANGUAGE_VERSION: + key = "sl version"; + break; + default: key = 0; } - if(key && (value = gliar_find_opt(cfglist, key))) { - return value; + if(key && (option = gliar_find_opt(cfglist, key))) { + return (const GLubyte*)option->conc_vals; } return gl_get_string(name);