0

When body's background color is set as transparent as below, the actual background is displayed as purple in cobalt.

body {
  background-color: transparent;
}

Is there any way to make background to be real transparent? I wish to show other gfx or video layers under cobalt's graphics layer. Thanks!

  • Hi balancekeeper, my original answer I think was actually not complete, I've edited it now to something that should actually work. – Andrew Top May 31 '17 at 23:34

2 Answers2

0

As an optimization, Cobalt does not clear its framebuffer each frame, however this can indeed cause a problem if you would like to use it as an overlay.

In cobalt/renderer/pipeline.cc, right after the line:

rasterizer::Rasterizer::Options rasterizer_options;

but before the line:

rasterizer_->Submit(results.animated, render_target, rasterizer_options);

If you add:

rasterizer_options.flags = rasterizer::Rasterizer::kSubmitFlags_Clear;

Cobalt will clear each frame to be fully transparent before rendering the contents.

We will look into adding a nicer way to express this desire in the future, but hopefully this helps for now.

Andrew Top
  • 2,517
  • 1
  • 17
  • 10
0

So comment out the following line from src/cobalt/renderer/backend/egl/graphics_context.cc:GraphicsContextEGL::SecurityClear()

GL_CALL(glClearColor(1.0f, 0.4f, 1.0f, 1.0f));