当前位置: 首页>>代码示例>>C++>>正文


C++ GLContext::setBlendMode方法代码示例

本文整理汇总了C++中GLContext::setBlendMode方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::setBlendMode方法的具体用法?C++ GLContext::setBlendMode怎么用?C++ GLContext::setBlendMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLContext的用法示例。


在下文中一共展示了GLContext::setBlendMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: blt

void RasterNode::blt(const glm::mat4& transform, const glm::vec2& destSize)
{
    GLContext* pContext = GLContext::getCurrent();
    FRect destRect;
    
    StandardShaderPtr pShader = pContext->getStandardShader();
    float opacity = getEffectiveOpacity();
    pContext->setBlendColor(glm::vec4(1.0f, 1.0f, 1.0f, opacity));
    pShader->setAlpha(opacity);
    if (m_pFXNode) {
        pContext->setBlendMode(m_BlendMode, true);
        m_pFXNode->getTex()->activate(GL_TEXTURE0);
        pShader->setColorModel(0);
        pShader->disableColorspaceMatrix();
        pShader->setGamma(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
        pShader->setPremultipliedAlpha(true);
        pShader->setMask(false);

        FRect relDestRect = m_pFXNode->getRelDestRect();
        destRect = FRect(relDestRect.tl.x*destSize.x, relDestRect.tl.y*destSize.y,
                relDestRect.br.x*destSize.x, relDestRect.br.y*destSize.y);
    } else {
        m_pSurface->activate(getMediaSize());
        pContext->setBlendMode(m_BlendMode, m_pSurface->isPremultipliedAlpha());
        destRect = FRect(glm::vec2(0,0), destSize);
    }
    glm::vec3 pos(destRect.tl.x, destRect.tl.y, 0);
    glm::vec3 scaleVec(destRect.size().x, destRect.size().y, 1);
    glm::mat4 localTransform = glm::translate(transform, pos);
    localTransform = glm::scale(localTransform, scaleVec);
    pShader->setTransform(localTransform);
    pShader->activate();
    m_pSubVA->draw();
}
开发者ID:tradzik,项目名称:libavg,代码行数:34,代码来源:RasterNode.cpp

示例2: renderFX

void RasterNode::renderFX()
{
    if (m_bFXDirty || m_pSurface->isDirty() || m_pFXNode->isDirty()) {
        ScopeTimer Timer(FXProfilingZone);
        GLContext* pContext = GLContext::getCurrent();
        StandardShader::get()->setAlpha(1.0f);
        m_pSurface->activate(getMediaSize());

        m_pFBO->activate();
        clearGLBuffers(GL_COLOR_BUFFER_BIT, false);

        bool bPremultipliedAlpha = m_pSurface->isPremultipliedAlpha();
        if (bPremultipliedAlpha) {
            glproc::BlendColor(1.0f, 1.0f, 1.0f, 1.0f);
        }
        pContext->setBlendMode(GLContext::BLEND_BLEND, bPremultipliedAlpha);
        m_pImagingProjection->setColor(m_Color);
        m_pImagingProjection->draw(StandardShader::get()->getShader());
/*
        static int i=0;
        stringstream ss;
        ss << "node" << i << ".png";
        BitmapPtr pBmp = m_pFBO->getImage(0);
        pBmp->save(ss.str());
*/  
        m_pFXNode->apply(m_pFBO->getTex()->getCurTex());
        
/*        
        stringstream ss1;
        ss1 << "nodefx" << i << ".png";
        i++;
        m_pFXNode->getImage()->save(ss1.str());
*/
    }
}
开发者ID:tradzik,项目名称:libavg,代码行数:35,代码来源:RasterNode.cpp

示例3: renderOutlines

void Canvas::renderOutlines(const glm::mat4& transform)
{
    GLContext* pContext = GLContext::getMain();
    VertexArrayPtr pVA(new VertexArray);
    pContext->setBlendMode(GLContext::BLEND_BLEND, false);
    m_pRootNode->renderOutlines(pVA, Pixel32(0,0,0,0));
    StandardShaderPtr pShader = pContext->getStandardShader();
    pShader->setTransform(transform);
    pShader->setUntextured();
    pShader->setAlpha(0.5f);
    pShader->activate();
    if (pVA->getNumVerts() != 0) {
        pVA->update();
        pVA->draw();
    }
}
开发者ID:pararthshah,项目名称:libavg-vaapi,代码行数:16,代码来源:Canvas.cpp

示例4: renderOutlines

void Canvas::renderOutlines()
{
    GLContext* pContext = GLContext::getCurrent();
    VertexArrayPtr pVA(new VertexArray);
    pContext->setBlendMode(GLContext::BLEND_BLEND, false);
    glMatrixMode(GL_MODELVIEW);
    glLoadMatrixf(glm::value_ptr(glm::mat4(1.0)));
    m_pRootNode->renderOutlines(pVA, Pixel32(0,0,0,0));
    StandardShaderPtr pShader = GLContext::getCurrent()->getStandardShader();
    pShader->setUntextured();
    pShader->activate();
    if (pVA->getCurVert() != 0) {
        pVA->update();
        pContext->enableGLColorArray(true);
        pVA->draw();
    }
}
开发者ID:cnxsoft,项目名称:xibo4arm,代码行数:17,代码来源:Canvas.cpp


注:本文中的GLContext::setBlendMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。