blob: 22e73fadd56af6bed026c62f1d39d903c181a2e6 [file] [log] [blame]
David Liaf94ceb2011-03-01 16:54:04 -08001#include "gles2context.h"
2
3GLES2Context::GLES2Context()
4{
5 memset(this, 0, sizeof *this);
6
7 assert((void *)&rasterizer == &rasterizer.interface);
8 InitializeGGLState(&rasterizer.interface);
9 iface = &rasterizer.interface;
10 printf("gl->rasterizer.PickScanLine(%p) = %p \n", &rasterizer.PickScanLine, rasterizer.PickScanLine);
11 assert(rasterizer.PickRaster);
12 assert(rasterizer.PickScanLine);
13
14 InitializeTextures();
15 InitializeVertices();
16}
17
18GLES2Context::~GLES2Context()
19{
20 UninitializeTextures();
21 UninitializeVertices();
22 UninitializeGGLState(&rasterizer.interface);
23}
24
25void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
26{
27 GLES2_GET_CONST_CONTEXT(ctx);
28 ctx->iface->BlendColor(ctx->iface, red, green, blue, alpha);
29}
30
31void glBlendEquation( GLenum mode )
32{
33 GLES2_GET_CONST_CONTEXT(ctx);
34 ctx->iface->BlendEquationSeparate(ctx->iface, mode, mode);
35}
36
37void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
38{
39 GLES2_GET_CONST_CONTEXT(ctx);
40 ctx->iface->BlendEquationSeparate(ctx->iface, modeRGB, modeAlpha);
41}
42
43void glBlendFunc(GLenum sfactor, GLenum dfactor)
44{
45 GLES2_GET_CONST_CONTEXT(ctx);
46 ctx->iface->BlendFuncSeparate(ctx->iface, sfactor, dfactor, sfactor, dfactor);
47}
48
49void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
50{
51 GLES2_GET_CONST_CONTEXT(ctx);
52 ctx->iface->BlendFuncSeparate(ctx->iface, srcRGB, dstRGB, srcAlpha, dstAlpha);
53}
54
55void glClear(GLbitfield mask)
56{
57 GLES2_GET_CONST_CONTEXT(ctx);
58 ctx->iface->Clear(ctx->iface, mask);
59}
60
61void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
62{
63 GLES2_GET_CONST_CONTEXT(ctx);
64 ctx->iface->ClearColor(ctx->iface, red, green, blue, alpha);
65}
66
67void glClearDepthf(GLclampf depth)
68{
69 GLES2_GET_CONST_CONTEXT(ctx);
70 ctx->iface->ClearDepthf(ctx->iface, depth);
71}
72
73void glClearStencil(GLint s)
74{
75 GLES2_GET_CONST_CONTEXT(ctx);
76 ctx->iface->ClearStencil(ctx->iface, s);
77}
78
79void glCullFace(GLenum mode)
80{
81 GLES2_GET_CONST_CONTEXT(ctx);
82 ctx->iface->CullFace(ctx->iface, mode);
83}
84
85void glDisable(GLenum cap)
86{
87 GLES2_GET_CONST_CONTEXT(ctx);
88 ctx->iface->EnableDisable(ctx->iface, cap, false);
89}
90
91void glEnable(GLenum cap)
92{
93 GLES2_GET_CONST_CONTEXT(ctx);
94 ctx->iface->EnableDisable(ctx->iface, cap, true);
95}
96
97void glFinish(void)
98{
99 // do nothing
100}
101
102void glFrontFace(GLenum mode)
103{
104 GLES2_GET_CONST_CONTEXT(ctx);
105 ctx->iface->FrontFace(ctx->iface, mode);
106}
107
108void glFlush(void)
109{
110 // do nothing
111}
112
113void glHint(GLenum target, GLenum mode)
114{
115 // do nothing
116}
117
118void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
119{
120// LOGD("agl2: glScissor not implemented x=%d y=%d width=%d height=%d", x, y, width, height);
121 //CALL_GL_API(glScissor, x, y, width, height);
122}
123
124void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
125{
126 GLES2_GET_CONST_CONTEXT(ctx);
127// LOGD("agl2: glViewport x=%d y=%d width=%d height=%d", x, y, width, height);
128 ctx->iface->Viewport(ctx->iface, x, y, width, height);
129}