static const GLubyte* (*gl_get_stringi)(GLenum, GLuint);
static void (*gl_get_integerv)(GLenum, GLint*);
static void (*gl_get_programiv)(GLuint, GLenum, GLint*);
+static void *(*glx_get_proc_address)(const unsigned char*);
/*static const void* (*gl_get_booleanv)(GLenum, GLboolean*);
static const void* (*gl_get_doublev)(GLenum, GLdouble*);
gl_get_stringi = dlsym(RTLD_NEXT, "glGetStringi");
gl_get_integerv = dlsym(RTLD_NEXT, "glGetIntegerv");
gl_get_programiv = dlsym(RTLD_NEXT, "glGetProgramivARB");
+ glx_get_proc_address = dlsym(RTLD_NEXT, "glXGetProcAddress");
if(init_valid_extensions() == -1) {
fprintf(stderr, "GLIAR: failed to initialize the valid extension list, might end up with unavailable extensions!\n");
init();
if(!gl_get_programiv) {
- fprintf(stderr, "Unable to fake the %s function. It is not supported by your OpenGL implementation.\n", __func__);
+ fprintf(stderr, "GLIAR: Unable to fake the %s function. It is not supported by your OpenGL implementation.\n", __func__);
return;
}
key = 0;
}
- if(key && (option = gliar_find_opt(cfglist, key)) && option->type == GLIAR_NUMBER) {
- *params = option->num_val;
- return;
+ 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);
+}