void TinyGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) { uint8 a, r, g, b; Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b); tglDisable(TGL_TEXTURE_2D); tglColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0); if (a != 255) { tglEnable(TGL_BLEND); tglBlendFunc(TGL_SRC_ALPHA, TGL_ONE_MINUS_SRC_ALPHA); } for (int x = rect.left; x < rect.right; x++) { for (int y = rect.top; y < rect.bottom; y++) { _fb->writePixel(y * kOriginalWidth + x, a, r, g, b); } } tglDisable(TGL_BLEND); }
void TinyGLRenderer::drawRect2D(const Common::Rect &rect, uint32 color) { uint8 a, r, g, b; Graphics::colorToARGB< Graphics::ColorMasks<8888> >(color, a, r, g, b); tglDisable(TGL_TEXTURE_2D); tglColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0); if (a != 255) { tglEnable(TGL_BLEND); tglBlendFunc(TGL_SRC_ALPHA, TGL_ONE_MINUS_SRC_ALPHA); } tglBegin(TGL_TRIANGLE_STRIP); tglVertex3f(rect.left, rect.bottom, 0.0f); tglVertex3f(rect.right, rect.bottom, 0.0f); tglVertex3f(rect.left, rect.top, 0.0f); tglVertex3f(rect.right, rect.top, 0.0f); tglEnd(); tglDisable(TGL_BLEND); }
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); }
void glColor3fv(float *v) { tglColor4f(v[0], v[1], v[2], 1); }
void tglColor3f(float x, float y, float z) { tglColor4f(x, y, z, 1); }