forked from joejulian/gio
app/headless: prepare OpenGL context on macOS
The macOS backend uses a desktop OpenGL context, not a OpenGL ES context. The main difference is that sRGB have to be enabled and a vertex buffer must be bound. Do that and fix Window.Screenshot for scenes more complex than a glClear. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -13,8 +13,9 @@ import "gioui.org/app/internal/gl"
|
||||
import "C"
|
||||
|
||||
type nsContext struct {
|
||||
c *gl.Functions
|
||||
ctx C.CFTypeRef
|
||||
c *gl.Functions
|
||||
ctx C.CFTypeRef
|
||||
prepared bool
|
||||
}
|
||||
|
||||
func newContext() (context, error) {
|
||||
@@ -24,6 +25,10 @@ func newContext() (context, error) {
|
||||
|
||||
func (c *nsContext) MakeCurrent() error {
|
||||
C.gio_headless_makeCurrentContext(c.ctx)
|
||||
if !c.prepared {
|
||||
C.gio_headless_prepareContext(c.ctx)
|
||||
c.prepared = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user