forked from joejulian/gio
app/headless: implement headless windows
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -38,6 +38,7 @@ var (
|
||||
nilEGLContext _EGLContext
|
||||
nilEGLConfig _EGLConfig
|
||||
nilEGLNativeWindowType NativeWindowType
|
||||
EGL_DEFAULT_DISPLAY NativeDisplayType
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -71,6 +72,7 @@ func (c *Context) Release() {
|
||||
eglReleaseThread()
|
||||
c.eglCtx = nil
|
||||
}
|
||||
c.disp = nilEGLDisplay
|
||||
}
|
||||
|
||||
func (c *Context) Present() error {
|
||||
@@ -116,7 +118,7 @@ func (c *Context) ReleaseSurface() {
|
||||
}
|
||||
// Make sure any in-flight GL commands are complete.
|
||||
c.c.Finish()
|
||||
eglMakeCurrent(c.disp, nilEGLSurface, nilEGLSurface, nilEGLContext)
|
||||
c.ReleaseCurrent()
|
||||
eglDestroySurface(c.disp, c.eglSurf)
|
||||
c.eglSurf = nilEGLSurface
|
||||
}
|
||||
@@ -134,6 +136,12 @@ func (c *Context) CreateSurface(win NativeWindowType, width, height int) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Context) ReleaseCurrent() {
|
||||
if c.disp != nilEGLDisplay {
|
||||
eglMakeCurrent(c.disp, nilEGLSurface, nilEGLSurface, nilEGLContext)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Context) MakeCurrent() error {
|
||||
if c.eglSurf == nilEGLSurface && !c.eglCtx.surfaceless {
|
||||
return errors.New("no surface created yet EGL_KHR_surfaceless_context is not supported")
|
||||
|
||||
@@ -36,6 +36,7 @@ const (
|
||||
LUMINANCE = 0x1909
|
||||
MAX_TEXTURE_SIZE = 0xd33
|
||||
NEAREST = 0x2600
|
||||
NO_ERROR = 0x0
|
||||
ONE = 0x1
|
||||
ONE_MINUS_SRC_ALPHA = 0x303
|
||||
QUERY_RESULT = 0x8866
|
||||
|
||||
Reference in New Issue
Block a user