Ignore:
Timestamp:
Apr 16, 2006, 11:52:05 PM (15 years ago)
Author:
Sam Hocevar
Message:
  • Added truecolor support to the X11 and GL drivers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_gl.c

    r777 r780  
    4242 */
    4343
    44 /* Ok, I just suck. */
    45 static GLbyte const gl_bgpal[][4] =
    46 {
    47     { 0x00, 0x00, 0x00, 0x7f },
    48     { 0x00, 0x00, 0x3f, 0x7f },
    49     { 0x00, 0x3f, 0x00, 0x7f },
    50     { 0x00, 0x3f, 0x3f, 0x7f },
    51     { 0x3f, 0x00, 0x00, 0x7f },
    52     { 0x3f, 0x00, 0x3f, 0x7f },
    53     { 0x3f, 0x3f, 0x00, 0x7f },
    54     { 0x3f, 0x3f, 0x3f, 0x7f },
    55     // + intensity
    56     // >.
    57     // ()
    58     // ^^
    59     { 0x1f, 0x1f, 0x1f, 0x7f },
    60     { 0x1f, 0x1f, 0x7f, 0x7f },
    61     { 0x1f, 0x7f, 0x1f, 0x7f },
    62     { 0x1f, 0x7f, 0x7f, 0x7f },
    63     { 0x7f, 0x1f, 0x1f, 0x7f },
    64     { 0x7f, 0x1f, 0x7f, 0x7f },
    65     { 0x7f, 0x7f, 0x1f, 0x7f },
    66     { 0x7f, 0x7f, 0x7f, 0x7f }
    67 };
    68 
    6944static caca_t *gl_kk; /* FIXME: we ought to get rid of this */
    7045
     
    248223        for(x = 0; x < kk->drv.p->width; x += kk->drv.p->font_width)
    249224        {
     225            uint16_t bg = _cucul_argb32_to_rgb12bg(*attr++);
    250226            glDisable(GL_TEXTURE_2D);
    251             glColor4bv(gl_bgpal[_cucul_argb32_to_ansi4bg(*attr++)]);
     227            glColor3b(((bg & 0xf00) >> 8) * 8,
     228                      ((bg & 0x0f0) >> 4) * 8,
     229                      (bg & 0x00f) * 8);
    252230            glBegin(GL_QUADS);
    253231                glVertex2f(x, y);
     
    279257            if(c > 0x00000020 && c < 0x00000080)
    280258            {
     259                uint16_t fg = _cucul_argb32_to_rgb12fg(*attr);
    281260                glBindTexture(GL_TEXTURE_2D, kk->drv.p->id[c - 32]);
    282                 glColor4bv(gl_bgpal[_cucul_argb32_to_ansi4fg(*attr)]);
     261                glColor3b(((fg & 0xf00) >> 8) * 8,
     262                          ((fg & 0x0f0) >> 4) * 8,
     263                          (fg & 0x00f) * 8);
    283264                glBegin(GL_QUADS);
    284265                    glTexCoord2f(0, kk->drv.p->sh);
Note: See TracChangeset for help on using the changeset viewer.