Esempio n. 1
0
void MythRenderOpenGL1::DrawRectPriv(const QRect &area, const QBrush &fillBrush,
                                     const QPen &linePen, int alpha)
{
    SetBlend(true);
    DisableTextures();
    glEnableClientState(GL_VERTEX_ARRAY);

    if (fillBrush.style() != Qt::NoBrush)
    {
        SetColor(fillBrush.color().red(), fillBrush.color().green(),
                 fillBrush.color().blue(), fillBrush.color().alpha());
        GLfloat *vertices = GetCachedVertices(GL_TRIANGLE_STRIP, area);
        glVertexPointer(2, GL_FLOAT, 0, vertices);
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    }

    if (linePen.style() != Qt::NoPen)
    {
        SetColor(linePen.color().red(), linePen.color().green(),
                 linePen.color().blue(), linePen.color().alpha());
        glLineWidth(linePen.width());
        GLfloat *vertices = GetCachedVertices(GL_LINE_LOOP, area);
        glVertexPointer(2, GL_FLOAT, 0, vertices);
        glDrawArrays(GL_LINE_LOOP, 0, 4);
    }

    glDisableClientState(GL_VERTEX_ARRAY);
}
Esempio n. 2
0
void MythRenderOpenGL1::DrawRectPriv(const QRect &area, const QBrush &fillBrush,
                                     const QPen &linePen, int alpha)
{
    SetBlend(true);
    DisableTextures();
    EnableShaderObject(0);
    glEnableClientState(GL_VERTEX_ARRAY);

    int lineWidth = linePen.width();
    QRect r(area.left() + lineWidth, area.top() + lineWidth,
            area.width() - (lineWidth * 2), area.height() - (lineWidth * 2));

    if (fillBrush.style() != Qt::NoBrush)
    {
        int a = 255 * (((float)alpha / 255.0f) *
                       ((float)fillBrush.color().alpha() / 255.0f));
        SetColor(fillBrush.color().red(), fillBrush.color().green(),
                 fillBrush.color().blue(), a);
        GLfloat *vertices = GetCachedVertices(GL_TRIANGLE_STRIP, r);
        glVertexPointer(2, GL_FLOAT, 0, vertices);
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
    }

    if (linePen.style() != Qt::NoPen)
    {
        int a = 255 * (((float)alpha / 255.0f) *
                       ((float)linePen.color().alpha() / 255.0f));
        SetColor(linePen.color().red(), linePen.color().green(),
                 linePen.color().blue(), a);
        glLineWidth(linePen.width());
        GLfloat *vertices = GetCachedVertices(GL_LINE_LOOP, r);
        glVertexPointer(2, GL_FLOAT, 0, vertices);
        glDrawArrays(GL_LINE_LOOP, 0, 4);
    }

    glDisableClientState(GL_VERTEX_ARRAY);
}