本文整理汇总了C++中ShaderProgramOGL::SetRenderColor方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderProgramOGL::SetRenderColor方法的具体用法?C++ ShaderProgramOGL::SetRenderColor怎么用?C++ ShaderProgramOGL::SetRenderColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderProgramOGL
的用法示例。
在下文中一共展示了ShaderProgramOGL::SetRenderColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: color
static void
RenderColorLayer(ColorLayer* aLayer, LayerManagerOGL *aManager,
const nsIntPoint& aOffset)
{
if (aManager->CompositingDisabled()) {
return;
}
aManager->MakeCurrent();
// XXX we might be able to improve performance by using glClear
nsIntRect visibleRect = aLayer->GetEffectiveVisibleRegion().GetBounds();
/* Multiply color by the layer opacity, as the shader
* ignores layer opacity and expects a final color to
* write to the color buffer. This saves a needless
* multiply in the fragment shader.
*/
gfxRGBA color(aLayer->GetColor());
float opacity = aLayer->GetEffectiveOpacity() * color.a;
color.r *= opacity;
color.g *= opacity;
color.b *= opacity;
color.a = opacity;
ShaderProgramOGL *program = aManager->GetProgram(gl::ColorLayerProgramType,
aLayer->GetMaskLayer());
program->Activate();
program->SetLayerQuadRect(visibleRect);
program->SetLayerTransform(aLayer->GetEffectiveTransform());
program->SetRenderOffset(aOffset);
program->SetRenderColor(color);
program->LoadMask(aLayer->GetMaskLayer());
aManager->BindAndDrawQuad(program);
}