本文整理汇总了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();
}
示例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());
*/
}
}
示例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();
}
}
示例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();
}
}