gpu: don't automatically clear screen before rendering

Gio UI may be overlaid on top of custom graphics such as in the glfw example.
That will only work if Gio doesn't clear the screen (to white).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-01-22 18:33:34 +01:00
parent 686d680ea3
commit 84b586ae6c
5 changed files with 35 additions and 6 deletions
+2
View File
@@ -4,6 +4,7 @@ package app
import (
"image"
"image/color"
"runtime"
"gioui.org/app/internal/window"
@@ -85,6 +86,7 @@ func (l *renderLoop) renderLoop(ctx window.Context) error {
l.refreshErr <- ctx.MakeCurrent()
case frame := <-l.frames:
ctx.Lock()
g.Clear(color.NRGBA{A: 0xff, R: 0xff, G: 0xff, B: 0xff})
g.Collect(frame.viewport, frame.ops)
// Signal that we're done with the frame ops.
l.ack <- struct{}{}