- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSWdraw.c
More file actions
Latest commit
69 lines (59 loc) · 2.79 KB
/
Copy pathSWdraw.c
File metadata and controls
69 lines (59 loc) · 2.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
#include"SWdraw.h"
#include<assert.h>
#include"SWcontext.h"
externSWcontext*sw_cur_context;
voidswVertexAttribPointer(constSWuintindex, constSWintsize, constSWuintstride,
constvoid*pointer) {
SWprogram*p=&sw_cur_context->programs[sw_cur_context->cur_program];
swProgSetVtxAttribPointer(p, sw_cur_context, index, size, stride, pointer);
}
voidswRegisterUniform(constSWintindex, constSWenumtype) {
swCtxRegisterUniform(sw_cur_context, index, type);
}
voidswRegisterUniformv(constSWintindex, constSWenumtype, constSWintnum) {
swCtxRegisterUniformv(sw_cur_context, index, type, num);
}
voidswSetUniform(constSWintindex, constSWenumtype, constvoid*data) {
swCtxSetUniform(sw_cur_context, index, type, data);
}
voidswSetUniformv(constSWintindex, constSWenumtype, constSWintnum,
constvoid*data) {
swCtxSetUniformv(sw_cur_context, index, type, num, data);
}
voidswDrawArrays(constSWenumprim_type, constSWuintfirst, constSWuintcount) {
SWprogram*p=&sw_cur_context->programs[sw_cur_context->cur_program];
if (prim_type==SW_LINES) {
swProgDrawLinesArray(p, sw_cur_context, first, count);
} elseif (prim_type==SW_LINE_STRIP) {
swProgDrawLineStripArray(p, sw_cur_context, first, count);
} elseif (prim_type==SW_CURVES) {
swProgDrawCurvesArray(p, sw_cur_context, first, count);
} elseif (prim_type==SW_CURVE_STRIP) {
swProgDrawCurveStripArray(p, sw_cur_context, first, count);
} elseif (prim_type==SW_TRIANGLES) {
swProgDrawTrianglesArray(p, sw_cur_context, first, count);
} elseif (prim_type==SW_TRIANGLE_STRIP) {
swProgDrawTriangleStripArray(p, sw_cur_context, first, count);
} else {
assert(0);
}
}
voidswDrawElements(constSWenumprim_type, constSWuintcount, constSWenumtype,
constvoid*indices) {
SWprogram*p=&sw_cur_context->programs[sw_cur_context->cur_program];
if (prim_type==SW_LINES) {
swProgDrawLinesIndexed(p, sw_cur_context, count, type, indices);
} elseif (prim_type==SW_LINE_STRIP) {
swProgDrawLineStripIndexed(p, sw_cur_context, count, type, indices);
} elseif (prim_type==SW_CURVES) {
swProgDrawCurvesIndexed(p, sw_cur_context, count, type, indices);
} elseif (prim_type==SW_CURVE_STRIP) {
swProgDrawCurveStripIndexed(p, sw_cur_context, count, type, indices);
} elseif (prim_type==SW_TRIANGLES) {
swProgDrawTrianglesIndexed(p, sw_cur_context, count, type, indices);
} elseif (prim_type==SW_TRIANGLE_STRIP) {
swProgDrawTriangleStripIndexed(p, sw_cur_context, count, type, indices);
} else {
assert(0);
}
}