-
Notifications
You must be signed in to change notification settings - Fork 0
/
port.c
160 lines (119 loc) · 3.14 KB
/
port.c
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#include "port.h"
#include <GL/gl.h>
void GLPinit() {
glewInit();
}
void GLPViewport(int x, int y, int w, int h) {
glViewport(x, y, w, h);
}
int GLPCreateProgram() {
return glCreateProgram();
}
void GLPGetProgramInfoLog(int prg, int max, int *len, char *log) {
glGetProgramInfoLog(prg, max, len, log);
}
int GLPCreateShader(int t) {
return glCreateShader(t);
}
void GLPShaderSource(int sh, int c, const char **str, const int *len) {
glShaderSource(sh, c, str, len);
}
void GLPCompileShader(int s) {
glCompileShader(s);
}
void GLPGetShaderiv(int sh, int pnm, int *p) {
glGetShaderiv(sh, pnm, p);
}
void GLPGetShaderInfoLog(int sh, int max, int *len, char *log) {
glGetShaderInfoLog(sh, max, len, log);
}
void GLPAttachShader(int prog, int sdr) {
glAttachShader(prog, sdr);
}
void GLPLinkProgram(int prog) {
glLinkProgram(prog);
}
void GLPGetProgramiv(int prg, int pnm, int *prm) {
glGetProgramiv(prg, pnm, prm);
}
void GLPUseProgram(int prg) {
glUseProgram(prg);
}
void GLPGenTextures(int n, unsigned *t) {
glGenTextures(n, t);
}
void GLPBindTexture(int targ, int tex) {
glBindTexture(targ, tex);
}
void GLPTexParameteri(int targ, int pnm, int param) {
glTexParameteri(targ, pnm, param);
}
void GLPTexImage2D(int targ, int lvl, int ifmt, int w, int h, int border, int format, int type, const void *data) {
glTexImage2D(targ, lvl, ifmt, w, h, border, format, type, data);
}
void GLPGenBuffers(int n, unsigned *b) {
glGenBuffers(n, b);
}
void GLPBindBuffer(int n, int b) {
glBindBuffer(n, b);
}
void GLPBufferData(int t, int s, const void *d, int u) {
glBufferData(t, s, d, u);
}
void GLPDrawElements(int m, int c, int t, const void *ind) {
glDrawElements(m, c, t, ind);
}
void GLPGenFramebuffers(int n, unsigned *ids) {
glGenFramebuffers(n, ids);
}
void GLPBindFramebuffer(int t, int fb) {
glBindFramebuffer(t, fb);
}
void GLPDrawBuffers(int n, unsigned *buf) {
glDrawBuffers(n, buf);
}
void GLPFramebufferTexture2D(int fb, int attach, int textarg, int tex, int lvl) {
glFramebufferTexture2D(fb, attach, textarg, tex, lvl);
}
void GLPFrontFace(int m) {
glFrontFace(m);
}
void GLPEnable(int n) {
glEnable(n);
}
void GLPDisable(int n) {
glDisable(n);
}
int GLPGetAttribLocation(int prg, const char *nm) {
return glGetAttribLocation(prg, nm);
}
void GLPEnableVertexAttribArray(int i) {
glEnableVertexAttribArray(i);
}
void GLPVertexAttribPointer(int i, int sz, int ty, int norm, int stride, const void *ptr) {
glVertexAttribPointer(i, sz, ty, norm, stride, ptr);
}
void GLPUniform1i(int loc, int v) {
glUniform1i(loc, v);
}
void GLPUniform1f(int loc, float v) {
glUniform1f(loc, v);
}
void GLPUniformMatrix4fv(int loc, int cnt, int trans, const float *val) {
glUniformMatrix4fv(loc, cnt, trans, val);
}
int GLPGetUniformLocation(int prg, const char *nm) {
return glGetUniformLocation(prg, nm);
}
void GLPClear(int msk) {
glClear(msk);
}
void GLPClearColor(float r, float g, float b, float a) {
glClearColor(r, g, b, a);
}
int GLPGetError() {
return glGetError();
}
void GLPPolygonMode(int f, int m) {
glPolygonMode(f, m);
}