gpu/internal/opengl: restore BeginFrame state in EndFrame

To ease the integration with foreign OpenGL contexts, carefully save the
context state before rendering a frame and restore it afterwards. Gio
rendering can then be mixed with OpenGL code that expects exclusive
control over context state.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-06-10 20:14:32 +02:00
parent 200957f924
commit 9b5e9ae607
9 changed files with 813 additions and 188 deletions
+2
View File
@@ -365,6 +365,8 @@ func New(api API) (GPU, error) {
if err != nil {
return nil, err
}
d.BeginFrame(false, image.Point{})
defer d.EndFrame()
forceCompute := os.Getenv("GIORENDERER") == "forcecompute"
feats := d.Caps().Features
switch {