-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglhooks.c
More file actions
100 lines (82 loc) · 1.79 KB
/
glhooks.c
File metadata and controls
100 lines (82 loc) · 1.79 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include <dlfcn.h> //dlsym, RTLD_NEXT
#include <GL/gl.h>
#include <stdio.h>
#include "glmd.h"
typedef void(*_glVertex3fFunc)(GLfloat, GLfloat, GLfloat);
typedef void(*_glBeginFunc)(GLenum);
typedef void(*_glFlushFunc)(void);
typedef GLuint (*_glGenListsFunc)(GLsizei);
typedef void (*_glNewListFunc)(GLuint, GLenum);
typedef void (*_glEndListFunc)(void);
extern void
glVertex3f(GLfloat x, GLfloat y, GLfloat z)
{
GLMDParam params[4];
params[0].opv = GLMDOP_VTX3F;
params[1].fv = x;
params[2].fv = y;
params[3].fv = z;
glmdCmd(params,4);
}
extern void
glBegin(GLenum mode)
{
GLMDParam params[2] = {
{.opv = GLMDOP_START_VTXLIST},
{.uiv = mode}
};
glmdCmd(params,2);
}
extern void
glEnd(void)
{
GLMDParam params[2] = { {.opv = GLMDOP_END_VTXLIST},{.opv = GLMDOP_DRAW} };
glmdCmd(params,1);
glmdCmd(¶ms[1],1);
}
extern void
glFlush(void)
{
_glFlushFunc newFunc = glmdGetFuncAddr("glFlush");
newFunc();
GLMDParam params[1] = { {.opv = GLMDOP_FLUSH } };
glmdCmd(params,1);
}
extern GLuint
glGenLists(GLsizei range)
{
_glGenListsFunc newFunc = glmdGetFuncAddr("glGenLists");
GLuint result = newFunc(range);
GLMDParam params[2] = {
{.opv = GLMDOP_CREATE_CMDLIST},
{.uiv = result}
};
glmdCmd(params,2);
return result;
}
extern void
glNewList(GLuint list, GLenum mode)
{
GLMDParam params[2] = {
{.opv = GLMDOP_START_CMDLIST},
{.uiv = list}
};
glmdCmd(params,2);
}
extern void
glEndList(void)
{
GLMDParam params[1] = {
{.opv = GLMDOP_END_CMDLIST}
};
glmdCmd(params,1);
}
extern void
glCallList(GLuint name)
{
GLMDParam params[2] = {
{.opv = GLMDOP_EXEC_CMDLIST},
{.uiv = name}
};
glmdCmd(params,2);
}