-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglxhooks.c
More file actions
78 lines (62 loc) · 2.11 KB
/
glxhooks.c
File metadata and controls
78 lines (62 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <dlfcn.h> //dlsym
#include <GL/glx.h>
#include <GL/glext.h>
#include <stdio.h>
#include <string.h> //strcmp
#include "glmd.h"
typedef void (*glxFuncPointer)(void);
typedef Bool (*_glXMakeCurrentFunc)(Display*, GLXDrawable, GLXContext );
typedef Bool (*_glXMakeContextCurrentFunc)(Display*, GLXDrawable, GLXDrawable, GLXContext );
typedef GLXContext (*_glXCreateContextFunc)(Display*, XVisualInfo*, GLXContext, Bool);
typedef GLXContext (*_glXCreateNewContextFunc)(Display*, GLXFBConfig,int , GLXContext, Bool);
typedef glxFuncPointer (*_glXGetProcAddressFunc)(const GLubyte*);
typedef void (*_glXDestroyContextFunc)(Display*, GLXContext);
extern Bool
glXMakeCurrent(Display* dsp, GLXDrawable draw, GLXContext ctx)
{
_glXMakeCurrentFunc newFunc = glmdGetFuncAddr("glXMakeCurrent");
Bool result = newFunc(dsp,draw,ctx);
if(result)
{
glmdMakeContextCurrent();
}
return result;
}
extern Bool
glXMakeContextCurrent(Display* dsp, GLXDrawable draw,GLXDrawable read, GLXContext ctx)
{
_glXMakeContextCurrentFunc newFunc = glmdGetFuncAddr("glXMakeContextCurrent");
Bool result = newFunc(dsp,read,draw,ctx);
if(result)
{
glmdMakeContextCurrent();
}
return result;
}
extern GLXContext
glXCreateContext(Display* dpy, XVisualInfo* vis, GLXContext shareList, Bool direct)
{
_glXCreateContextFunc newFunc = glmdGetFuncAddr("glXCreateContext");
glmdCreateContext();
return newFunc(dpy, vis, shareList, direct);
}
extern GLXContext
glXCreateNewContext(Display* dpy, GLXFBConfig config, int renderType,GLXContext shareList, Bool direct)
{
_glXCreateNewContextFunc newFunc = glmdGetFuncAddr("glXCreateNewContext");
glmdCreateContext();
return newFunc(dpy, config, renderType, shareList, direct);
}
extern glxFuncPointer
glXGetProcAddress(const GLubyte* name)
{
_glXGetProcAddressFunc newFunc = glmdGetFuncAddr("glXGetProcAddress");
return newFunc(name);
}
extern void
glXDestroyContext(Display* dsp, GLXContext ctx)
{
_glXDestroyContextFunc newFunc = glmdGetFuncAddr("glXDestroyContext");
glmdDeinit();
return newFunc(dsp, ctx);
}