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
|
#include "gles2context.h"
GLES2Context::GLES2Context()
{
memset(this, 0, sizeof *this);
assert((void *)&rasterizer == &rasterizer.interface);
InitializeGGLState(&rasterizer.interface);
iface = &rasterizer.interface;
printf("gl->rasterizer.PickScanLine(%p) = %p \n", &rasterizer.PickScanLine, rasterizer.PickScanLine);
assert(rasterizer.PickRaster);
assert(rasterizer.PickScanLine);
InitializeTextures();
InitializeVertices();
}
GLES2Context::~GLES2Context()
{
UninitializeTextures();
UninitializeVertices();
UninitializeGGLState(&rasterizer.interface);
}
void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->BlendColor(ctx->iface, red, green, blue, alpha);
}
void glBlendEquation( GLenum mode )
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->BlendEquationSeparate(ctx->iface, mode, mode);
}
void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->BlendEquationSeparate(ctx->iface, modeRGB, modeAlpha);
}
void glBlendFunc(GLenum sfactor, GLenum dfactor)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->BlendFuncSeparate(ctx->iface, sfactor, dfactor, sfactor, dfactor);
}
void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->BlendFuncSeparate(ctx->iface, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
void glClear(GLbitfield mask)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->Clear(ctx->iface, mask);
}
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->ClearColor(ctx->iface, red, green, blue, alpha);
}
void glClearDepthf(GLclampf depth)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->ClearDepthf(ctx->iface, depth);
}
void glClearStencil(GLint s)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->ClearStencil(ctx->iface, s);
}
void glCullFace(GLenum mode)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->CullFace(ctx->iface, mode);
}
void glDisable(GLenum cap)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->EnableDisable(ctx->iface, cap, false);
}
void glEnable(GLenum cap)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->EnableDisable(ctx->iface, cap, true);
}
void glFinish(void)
{
// do nothing
}
void glFrontFace(GLenum mode)
{
GLES2_GET_CONST_CONTEXT(ctx);
ctx->iface->FrontFace(ctx->iface, mode);
}
void glFlush(void)
{
// do nothing
}
void glHint(GLenum target, GLenum mode)
{
// do nothing
}
void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{
// LOGD("agl2: glScissor not implemented x=%d y=%d width=%d height=%d", x, y, width, height);
//CALL_GL_API(glScissor, x, y, width, height);
}
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
GLES2_GET_CONST_CONTEXT(ctx);
// LOGD("agl2: glViewport x=%d y=%d width=%d height=%d", x, y, width, height);
ctx->iface->Viewport(ctx->iface, x, y, width, height);
}
|