~eliasnaur/gio-example

107f05c448a20cd7b24495cc2e6045fb85bbbde5 — Elias Naur 1 year, 11 months ago a1c6599
opengl: release current context after use

For this example it doesn't matter, but for larger programs that may
have multiple contexts, ANGLE seem to behave better when release the
current context before using another.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
1 files changed, 2 insertions(+), 0 deletions(-)

M opengl/main.go
M opengl/main.go => opengl/main.go +2 -0
@@ 113,6 113,7 @@ func loop(w *app.Window) error {
				if err != nil {
					log.Fatal(err)
				}
				C.eglMakeCurrent(ctx.disp, nil, nil, nil)
			})
		case system.DestroyEvent:
			return e.Err


@@ 146,6 147,7 @@ func loop(w *app.Window) error {
				if ok := C.eglSwapBuffers(ctx.disp, ctx.surf); ok != C.EGL_TRUE {
					log.Fatal(fmt.Errorf("swap failed: %v", C.eglGetError()))
				}
				C.eglMakeCurrent(ctx.disp, nil, nil, nil)
			})

			// Process non-drawing ops.