scummvm/graphics/tinygl/api.cpp

742 lines
14 KiB
C++
Raw Normal View History

2014-08-13 18:52:52 +02:00
/* ResidualVM - A 3D game interpreter
*
* ResidualVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the AUTHORS
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This file is based on, or a modified version of code from TinyGL (C) 1997-1998 Fabrice Bellard,
* which is licensed under the zlib-license (see LICENSE).
* It also has modifications by the ResidualVM-team, which are covered under the GPLv2 (or later).
*/
2006-05-16 14:52:36 +00:00
2009-05-08 07:32:33 +00:00
#include "graphics/tinygl/zgl.h"
2006-05-16 14:52:36 +00:00
// glVertex
void tglVertex4f(float x, float y, float z, float w) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[5];
p[0].op = TinyGL::OP_Vertex;
2006-05-16 14:52:36 +00:00
p[1].f = x;
p[2].f = y;
p[3].f = z;
p[4].f = w;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglVertex2f(float x, float y) {
tglVertex4f(x, y, 0, 1);
}
2006-05-16 14:52:36 +00:00
void tglVertex3f(float x, float y, float z) {
tglVertex4f(x, y, z, 1);
}
void tglVertex3fv(const float *v) {
2006-05-16 14:52:36 +00:00
tglVertex4f(v[0], v[1], v[2], 1);
}
2006-05-16 14:52:36 +00:00
// glNormal
2006-05-16 14:52:36 +00:00
void tglNormal3f(float x, float y, float z) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[4];
p[0].op = TinyGL::OP_Normal;
2006-05-16 14:52:36 +00:00
p[1].f = x;
p[2].f = y;
p[3].f = z;
c->gl_add_op(p);
}
void tglNormal3fv(const float *v) {
2006-05-16 14:52:36 +00:00
tglNormal3f(v[0], v[1], v[2]);
}
2006-05-16 14:52:36 +00:00
// glColor
2006-05-16 14:52:36 +00:00
void tglColor4f(float r, float g, float b, float a) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[9];
p[0].op = TinyGL::OP_Color;
2006-05-16 14:52:36 +00:00
p[1].f = r;
p[2].f = g;
p[3].f = b;
p[4].f = a;
c->gl_add_op(p);
}
void tglColor4fv(const float *v) {
tglColor4f(v[0], v[1], v[2], v[3]);
}
2006-05-16 14:52:36 +00:00
void tglColor3f(float x, float y, float z) {
tglColor4f(x, y, z, 1);
}
void tglColor3fv(const float *v) {
tglColor4f(v[0], v[1], v[2], 1);
}
2016-07-10 04:35:32 +00:00
void tglColor3ub(unsigned char r, unsigned char g, unsigned char b) {
tglColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
}
void tglColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
tglColor4f(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
}
2006-05-16 14:52:36 +00:00
// TexCoord
2006-05-16 14:52:36 +00:00
void tglTexCoord4f(float s, float t, float r, float q) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[5];
p[0].op = TinyGL::OP_TexCoord;
2006-05-16 14:52:36 +00:00
p[1].f = s;
p[2].f = t;
p[3].f = r;
p[4].f = q;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglTexCoord2f(float s, float t) {
tglTexCoord4f(s, t, 0, 1);
}
void tglTexCoord2fv(const float *v) {
2006-05-16 14:52:36 +00:00
tglTexCoord4f(v[0], v[1], 0, 1);
}
2006-05-16 14:52:36 +00:00
void tglEdgeFlag(int flag) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_EdgeFlag;
2006-05-16 14:52:36 +00:00
p[1].i = flag;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// misc
2006-05-16 14:52:36 +00:00
void tglShadeModel(int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
2006-05-16 14:52:36 +00:00
assert(mode == TGL_FLAT || mode == TGL_SMOOTH);
p[0].op = TinyGL::OP_ShadeModel;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglCullFace(int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
2006-05-16 14:52:36 +00:00
assert(mode == TGL_BACK || mode == TGL_FRONT || mode == TGL_FRONT_AND_BACK);
p[0].op = TinyGL::OP_CullFace;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglFrontFace(int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
2006-05-16 14:52:36 +00:00
assert(mode == TGL_CCW || mode == TGL_CW);
2006-05-16 14:52:36 +00:00
mode = (mode != TGL_CCW);
p[0].op = TinyGL::OP_FrontFace;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
c->gl_add_op(p);
}
void tglColorMask(TGLboolean r, TGLboolean g, TGLboolean b, TGLboolean a) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_ColorMask;
p[1].i = (r << 24) | (g << 16) | (b << 8) | (a << 0);
c->gl_add_op(p);
}
void tglDepthMask(int enableWrite) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_DepthMask;
p[1].i = enableWrite;
c->gl_add_op(p);
}
void tglBlendFunc(TGLenum sfactor, TGLenum dfactor) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_BlendFunc;
p[1].i = sfactor;
p[2].i = dfactor;
c->gl_add_op(p);
}
2014-07-04 08:43:19 +02:00
void tglAlphaFunc(TGLenum func, float ref) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
2014-07-04 08:43:19 +02:00
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_AlphaFunc;
p[1].i = func;
p[2].f = ref;
c->gl_add_op(p);
2014-07-04 08:43:19 +02:00
}
2014-07-04 23:14:44 +02:00
void tglDepthFunc(TGLenum func) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
2014-07-04 23:14:44 +02:00
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_DepthFunc;
p[1].i = func;
c->gl_add_op(p);
2014-07-04 23:14:44 +02:00
}
2006-05-16 14:52:36 +00:00
void tglPolygonMode(int face, int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
2006-05-16 14:52:36 +00:00
assert(face == TGL_BACK || face == TGL_FRONT || face == TGL_FRONT_AND_BACK);
assert(mode == TGL_POINT || mode == TGL_LINE || mode == TGL_FILL);
p[0].op = TinyGL::OP_PolygonMode;
2006-05-16 14:52:36 +00:00
p[1].i = face;
p[2].i = mode;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// glEnable, glDisable
2006-05-16 14:52:36 +00:00
void tglEnable(int cap) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_EnableDisable;
2006-05-16 14:52:36 +00:00
p[1].i = cap;
p[2].i = 1;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglDisable(int cap) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_EnableDisable;
2006-05-16 14:52:36 +00:00
p[1].i = cap;
p[2].i = 0;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// glBegin, glEnd
2006-05-16 14:52:36 +00:00
void tglBegin(int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_Begin;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglEnd() {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[1];
p[0].op = TinyGL::OP_End;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// matrix
2006-05-16 14:52:36 +00:00
void tglMatrixMode(int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_MatrixMode;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglLoadMatrixf(const float *m) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[17];
p[0].op = TinyGL::OP_LoadMatrix;
for (int i = 0; i < 16; i++)
2006-05-16 14:52:36 +00:00
p[i + 1].f = m[i];
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglLoadIdentity() {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[1];
p[0].op = TinyGL::OP_LoadIdentity;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglMultMatrixf(const float *m) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[17];
p[0].op = TinyGL::OP_MultMatrix;
for (int i = 0; i < 16; i++)
2006-05-16 14:52:36 +00:00
p[i + 1].f = m[i];
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglPushMatrix() {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[1];
p[0].op = TinyGL::OP_PushMatrix;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglPopMatrix() {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[1];
p[0].op = TinyGL::OP_PopMatrix;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglRotatef(float angle, float x, float y, float z) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[5];
p[0].op = TinyGL::OP_Rotate;
2006-05-16 14:52:36 +00:00
p[1].f = angle;
p[2].f = x;
p[3].f = y;
p[4].f = z;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglTranslatef(float x, float y, float z) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[4];
p[0].op = TinyGL::OP_Translate;
2006-05-16 14:52:36 +00:00
p[1].f = x;
p[2].f = y;
p[3].f = z;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglScalef(float x, float y, float z) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[4];
p[0].op = TinyGL::OP_Scale;
2006-05-16 14:52:36 +00:00
p[1].f = x;
p[2].f = y;
p[3].f = z;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglViewport(int x, int y, int width, int height) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[5];
p[0].op = TinyGL::OP_Viewport;
2006-05-16 14:52:36 +00:00
p[1].i = x;
p[2].i = y;
p[3].i = width;
p[4].i = height;
c->gl_add_op(p);
}
2008-07-29 19:28:19 +00:00
void tglFrustum(double left, double right, double bottom, double top, double nearv, double farv) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[7];
p[0].op = TinyGL::OP_Frustum;
2006-05-16 14:52:36 +00:00
p[1].f = (float)left;
p[2].f = (float)right;
p[3].f = (float)bottom;
p[4].f = (float)top;
p[5].f = (float)nearv;
p[6].f = (float)farv;
c->gl_add_op(p);
}
void tglOrtho(double left, double right, double bottom, double top, double zNear, double zFar) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[7];
p[0].op = TinyGL::OP_Ortho;
p[1].f = (float)left;
p[2].f = (float)right;
p[3].f = (float)bottom;
p[4].f = (float)top;
p[5].f = (float)zNear;
p[6].f = (float)zFar;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// lightening
void tglMaterialfv(int mode, int type, const float *v) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[7];
int n;
assert(mode == TGL_FRONT || mode == TGL_BACK || mode == TGL_FRONT_AND_BACK);
p[0].op = TinyGL::OP_Material;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
p[2].i = type;
n = 4;
if (type == TGL_SHININESS)
n = 1;
for (int i = 0; i < 4; i++)
2006-05-16 14:52:36 +00:00
p[3 + i].f = v[i];
for (int i = n; i < 4; i++)
2006-05-16 14:52:36 +00:00
p[3 + i].f = 0;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglMaterialf(int mode, int type, float v) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[7];
p[0].op = TinyGL::OP_Material;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
p[2].i = type;
p[3].f = v;
for (int i = 0; i < 3; i++)
2006-05-16 14:52:36 +00:00
p[4 + i].f = 0;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglColorMaterial(int mode, int type) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_ColorMaterial;
2006-05-16 14:52:36 +00:00
p[1].i = mode;
p[2].i = type;
c->gl_add_op(p);
}
void tglLightfv(int light, int type, const float *v) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[7];
p[0].op = TinyGL::OP_Light;
p[1].i = light;
p[2].i = type;
for (int i = 0; i < 4; i++) {
if (type != TGL_SPOT_DIRECTION)
p[3 + i].f = v[i];
else
p[3 + i].f = 0.0f;
}
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglLightf(int light, int type, float v) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[7];
p[0].op = TinyGL::OP_Light;
2006-05-16 14:52:36 +00:00
p[1].i = light;
p[2].i = type;
p[3].f = v;
for (int i = 0; i < 3; i++)
2006-05-16 14:52:36 +00:00
p[4 + i].f = 0;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglLightModeli(int pname, int param) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[6];
p[0].op = TinyGL::OP_LightModel;
2006-05-16 14:52:36 +00:00
p[1].i = pname;
p[2].f = (float)param;
for (int i = 0; i < 3; i++)
2006-05-16 14:52:36 +00:00
p[3 + i].f = 0;
c->gl_add_op(p);
}
void tglLightModelfv(int pname, const float *param) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[6];
p[0].op = TinyGL::OP_LightModel;
2006-05-16 14:52:36 +00:00
p[1].i = pname;
for (int i = 0; i < 4; i++)
2006-05-16 14:52:36 +00:00
p[2 + i].f = param[i];
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// clear
2006-05-16 14:52:36 +00:00
void tglClear(int mask) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_Clear;
2006-05-16 14:52:36 +00:00
p[1].i = mask;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglClearColor(float r, float g, float b, float a) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[5];
p[0].op = TinyGL::OP_ClearColor;
2006-05-16 14:52:36 +00:00
p[1].f = r;
p[2].f = g;
p[3].f = b;
p[4].f = a;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglClearDepth(double depth) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_ClearDepth;
2006-05-16 14:52:36 +00:00
p[1].f = (float)depth;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// textures
void tglTexImage2D(int target, int level, int components, int width, int height, int border, int format, int type, void *pixels) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[10];
p[0].op = TinyGL::OP_TexImage2D;
2006-05-16 14:52:36 +00:00
p[1].i = target;
p[2].i = level;
p[3].i = components;
p[4].i = width;
p[5].i = height;
p[6].i = border;
p[7].i = format;
p[8].i = type;
p[9].p = pixels;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglBindTexture(int target, int texture) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_BindTexture;
2006-05-16 14:52:36 +00:00
p[1].i = target;
p[2].i = texture;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglTexEnvi(int target, int pname, int param) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[8];
p[0].op = TinyGL::OP_TexEnv;
2006-05-16 14:52:36 +00:00
p[1].i = target;
p[2].i = pname;
p[3].i = param;
p[4].f = 0;
p[5].f = 0;
p[6].f = 0;
p[7].f = 0;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglTexParameteri(int target, int pname, int param) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[8];
p[0].op = TinyGL::OP_TexParameter;
2006-05-16 14:52:36 +00:00
p[1].i = target;
p[2].i = pname;
p[3].i = param;
p[4].f = 0;
p[5].f = 0;
p[6].f = 0;
p[7].f = 0;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglPixelStorei(int pname, int param) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_PixelStore;
2006-05-16 14:52:36 +00:00
p[1].i = pname;
p[2].i = param;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// selection
2006-05-16 14:52:36 +00:00
void tglInitNames() {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[1];
p[0].op = TinyGL::OP_InitNames;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglPushName(unsigned int name) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_PushName;
2006-05-16 14:52:36 +00:00
p[1].i = name;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglPopName() {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[1];
p[0].op = TinyGL::OP_PopName;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglLoadName(unsigned int name) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_LoadName;
2006-05-16 14:52:36 +00:00
p[1].i = name;
c->gl_add_op(p);
}
void tglPolygonOffset(TGLfloat factor, TGLfloat units) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_PolygonOffset;
p[1].f = factor;
p[2].f = units;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// Special Functions
2006-05-16 14:52:36 +00:00
void tglCallList(unsigned int list) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[2];
p[0].op = TinyGL::OP_CallList;
2006-05-16 14:52:36 +00:00
p[1].i = list;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
void tglFlush() {
// nothing to do
}
2006-05-16 14:52:36 +00:00
void tglHint(int target, int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
TinyGL::GLParam p[3];
p[0].op = TinyGL::OP_Hint;
2006-05-16 14:52:36 +00:00
p[1].i = target;
p[2].i = mode;
c->gl_add_op(p);
}
2006-05-16 14:52:36 +00:00
// Non standard functions
2006-05-16 14:52:36 +00:00
void tglDebug(int mode) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
2006-05-16 14:52:36 +00:00
c->print_flag = mode;
}
void tglSetShadowMaskBuf(unsigned char *buf) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
c->shadow_mask_buf = buf;
}
void tglSetShadowColor(unsigned char r, unsigned char g, unsigned char b) {
TinyGL::GLContext *c = TinyGL::gl_get_context();
c->shadow_color_r = r << 8;
c->shadow_color_g = g << 8;
c->shadow_color_b = b << 8;
}