+
+const GLubyte *glGetStringi(GLenum name, GLuint index)
+{
+ char *key;
+ const struct cfgopt *option;
+
+ init();
+
+ if(!gl_get_stringi) {
+ fprintf(stderr, "Unable to fake the %s function. It is not supported by your OpenGL implementation.\n", __func__);
+ return 0;
+ }
+
+ switch(name) {
+ case GL_EXTENSIONS:
+ key = "extensions";
+ break;
+
+ case GL_SHADING_LANGUAGE_VERSION:
+ key = "sl version";
+ break;
+
+ default:
+ key = 0;
+ }
+
+ if(key && (option = gliar_find_opt(cfglist, key))) {
+ return (const GLubyte*)option->str_val[index];
+ }
+
+ return gl_get_stringi(name, index);
+}
+
+void glGetIntegerv(GLenum name, GLint *val)
+{
+ char *key;
+ const struct cfgopt *option;
+
+ init();
+
+ if(!gl_get_integerv) {
+ fprintf(stderr, "Unable to fake the %s function. It is not supported by your OpenGL implementation.\n", __func__);
+ return;
+ }
+
+ switch(name) {
+ case GL_NUM_EXTENSIONS:
+ if(1) {
+ key = "extensions";
+ } else {
+ case GL_NUM_SHADING_LANGUAGE_VERSIONS:
+ key = "sl version";
+ }
+ if(key && (option = gliar_find_opt(cfglist, key))) {
+ *val = option->str_count;
+ return;
+ }
+ break;
+
+ case GL_MAJOR_VERSION:
+ key = "major version";
+ break;
+
+ case GL_MINOR_VERSION:
+ key = "minor version";
+ break;
+
+ case GL_MAX_TEXTURE_UNITS:
+ key = "max texture units";
+ break;
+
+ case GL_MAX_TEXTURE_IMAGE_UNITS:
+ key = "max texture image units";
+ break;
+
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+ key = "max combined texture image units";
+ break;
+
+ case GL_MAX_TEXTURE_SIZE:
+ key = "max texture size";
+ break;
+
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
+ key = "max cube map texture size";
+ break;
+
+ case GL_MAX_TEXTURE_COORDS:
+ key = "max texture coordinates";
+ break;
+
+ case GL_MAX_VERTEX_ATTRIBS:
+ key = "max vertex attributes";
+ break;
+
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+ key = "max vertex texture image units";
+ break;
+
+ case GL_MAX_VERTEX_UNIFORM_VECTORS:
+ key = "max vertex uniform vectors";
+ break;
+
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+ key = "max fragment uniform vectors";
+ break;
+
+ case GL_MAX_VARYING_VECTORS:
+ key = "max varying vectors";
+ break;
+
+ case GL_MAX_COLOR_ATTACHMENTS_EXT:
+ key = "max color attachments";
+ break;
+
+ case GL_MAX_RENDERBUFFER_SIZE_EXT:
+ key = "max renderbuffer size ext";
+ break;
+
+ default:
+ key = 0;
+ }
+
+ if(key && (option = gliar_find_opt(cfglist, key)) && option->type == GLIAR_NUMBER) {
+ *val = option->num_val;
+ return;
+ }
+
+ gl_get_integerv(name, val);
+}
+
+void glGetProgramivARB(GLuint program, GLenum pname, GLint *params)
+{
+ char *key;
+ const struct cfgopt *option;
+
+ init();
+
+ if(!gl_get_programiv) {
+ fprintf(stderr, "GLIAR: Unable to fake the %s function. It is not supported by your OpenGL implementation.\n", __func__);
+ return;
+ }
+
+ switch(pname) {
+ case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:
+ key = "max program instructions arb";
+ break;
+
+ case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
+ key = "max program native instructions arb";
+ break;
+
+ case GL_MAX_PROGRAM_TEMPORARIES_ARB:
+ key = "max program temporaries arb";
+ break;
+
+ case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB:
+ key = "max program native temporaries arb";
+ break;
+
+ case GL_MAX_PROGRAM_PARAMETERS_ARB:
+ key = "max program parameters arb";
+ break;
+
+ case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB:
+ key = "max program native parameters arb";
+ break;
+
+ case GL_MAX_PROGRAM_ATTRIBS_ARB:
+ key = "max program attribs arb";
+ break;
+
+ case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB:
+ key = "max program native attribs arb";
+ break;
+
+ case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB:
+ key = "max program address registers arb";
+ break;
+
+ case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
+ key = "max program native address registers arb";
+ break;
+
+ case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB:
+ key = "max program local parameters arb";
+ break;
+
+ case GL_MAX_PROGRAM_ENV_PARAMETERS_ARB:
+ key = "max program env parameters arb";
+ break;
+
+ case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB:
+ key = "max program alu instructions arb";
+ break;
+
+ case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
+ key = "max program native alu instructions arb";
+ break;
+
+ case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB:
+ key = "max program tex instructions arb";
+ break;
+
+ case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
+ key = "max program native tex instructions arb";
+ break;
+
+ default:
+ key = 0;
+ }
+
+ if(key) {
+ char buf[256];
+ if(program == GL_VERTEX_PROGRAM_ARB) {
+ sprintf(buf, "v %s", key);
+ }
+ else if(program == GL_FRAGMENT_PROGRAM_ARB) {
+ sprintf(buf, "f %s", key);
+ }
+ key = buf;
+
+ if((option = gliar_find_opt(cfglist, key)) && option->type == GLIAR_NUMBER) {
+ *params = option->num_val;
+ return;
+ }
+ }
+
+ gl_get_programiv(program, pname, params);
+
+}
+
+void *glXGetProcAddress(const unsigned char *procname)
+{
+ init();
+
+ if(!strcmp((char*)procname, "glGetProgramivARB") || !strcmp((char*)procname, "glGetProgramiv")) {
+ return glGetProgramivARB;
+ }
+
+ return glx_get_proc_address(procname);
+}
+
+void *glXGetProcAddressARB(const unsigned char *procname)
+{
+ return glXGetProcAddress(procname);
+}