From 06477be50ff2fc91675cc87e5d3e60910703c6ce Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 17 May 2021 20:08:55 +0200 Subject: [PATCH] app/internal/wm: [iOS] use proper constructor for gl.Functions We're about to load OpenGL function pointers into gl.Function structs. Make sure iOS internally uses the NewFunctions constructor, not just new(Functions). Signed-off-by: Elias Naur --- app/internal/wm/gl_ios.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/internal/wm/gl_ios.go b/app/internal/wm/gl_ios.go index aacd588b..811bd8af 100644 --- a/app/internal/wm/gl_ios.go +++ b/app/internal/wm/gl_ios.go @@ -46,19 +46,28 @@ func newContext(w *window) (*context, error) { if ctx == 0 { return nil, fmt.Errorf("failed to create EAGLContext") } + api := contextAPI() + f, err := gl.NewFunctions(api.Context) + if err != nil { + return nil, err + } c := &context{ ctx: ctx, owner: w, layer: C.CFTypeRef(w.contextLayer()), - c: new(gl.Functions), + c: f, } return c, nil } -func (c *context) API() gpu.API { +func contextAPI() gpu.OpenGL { return gpu.OpenGL{} } +func (c *context) API() gpu.API { + return contextAPI() +} + func (c *context) Release() { if c.ctx == 0 { return