Changeset 703


Ignore:
Timestamp:
Feb 28, 2011, 3:26:24 AM (9 years ago)
Author:
sam
Message:

Add transparency to DebugQuad and ensure it gets rendered over everything.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/debugquad.cpp

    r702 r703  
    5353    data->initialised = 0;
    5454    data->time = 0.0f;
     55
     56    drawgroup = DRAWGROUP_HUD;
    5557}
    5658
     
    122124                data->image[0][(j * 32 + i) * 4 + 1] = wb;
    123125                data->image[0][(j * 32 + i) * 4 + 2] = wb;
    124                 data->image[0][(j * 32 + i) * 4 + 3] = 255;
     126                data->image[0][(j * 32 + i) * 4 + 3] = wb;
    125127            }
    126128        /* Use GL_RGBA instead of 4 for the internal format (Android) */
     
    150152    static GLfloat const cols[6][4] =
    151153    {
    152         { 0.8f, 0.2f, 0.2f, 1.0f },
    153         { 0.2f, 0.2f, 0.8f, 1.0f },
    154         { 0.8f, 0.8f, 0.2f, 1.0f },
    155 
    156         { 0.8f, 0.8f, 0.2f, 1.0f },
    157         { 0.2f, 0.2f, 0.8f, 1.0f },
    158         { 0.2f, 0.8f, 0.2f, 1.0f },
     154        { 1.0f, 0.2f, 0.2f, 1.0f },
     155        { 0.2f, 0.2f, 1.0f, 1.0f },
     156        { 1.0f, 1.0f, 0.2f, 1.0f },
     157
     158        { 1.0f, 1.0f, 0.2f, 1.0f },
     159        { 0.2f, 0.2f, 1.0f, 1.0f },
     160        { 0.2f, 1.0f, 0.2f, 1.0f },
    159161    };
    160162
     
    175177    glEnableVertexAttribArray(attr_col);
    176178    glEnableVertexAttribArray(attr_tex);
     179
     180    /* Bind texture */
     181    glActiveTexture(GL_TEXTURE0);
     182    glBindTexture(GL_TEXTURE_2D, data->texlist[0]);
    177183
    178184    glBindBuffer(GL_ARRAY_BUFFER, data->buflist[0]);
     
    203209
    204210    /* Set up state machine */
     211    glDisable(GL_DEPTH_TEST);
    205212    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    206213    glEnable(GL_TEXTURE_2D);
    207214    glEnableClientState(GL_VERTEX_ARRAY);
    208215    glEnableClientState(GL_COLOR_ARRAY);
    209 
     216    glEnable(GL_BLEND);
     217    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     218
     219    /* Bind texture */
    210220    glActiveTexture(GL_TEXTURE0);
    211221    glBindTexture(GL_TEXTURE_2D, data->texlist[0]);
Note: See TracChangeset for help on using the changeset viewer.