Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified shiny/driver/gldriver/egl.go
100755 → 100644
Empty file.
15 changes: 14 additions & 1 deletion shiny/driver/gldriver/win32.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func createEGLSurface(hwnd syscall.Handle, w *windowImpl) error {
}

contextAttribs := [...]eglInt{
_EGL_CONTEXT_CLIENT_VERSION, 2,
_EGL_CONTEXT_CLIENT_VERSION, 3,
_EGL_NONE,
}
context, _, _ := eglCreateContext.Call(
Expand All @@ -338,6 +338,19 @@ func createEGLSurface(hwnd syscall.Handle, w *windowImpl) error {
_EGL_NO_CONTEXT,
uintptr(unsafe.Pointer(&contextAttribs[0])),
)
if context == _EGL_NO_CONTEXT {
// Try again with OpenGL ES 2.0.
context2Attribs := [...]eglInt{
_EGL_CONTEXT_CLIENT_VERSION, 2,
_EGL_NONE,
}
context, _, _ = eglCreateContext.Call(
display,
uintptr(config),
_EGL_NO_CONTEXT,
uintptr(unsafe.Pointer(&context2Attribs[0])),
)
}
if context == _EGL_NO_CONTEXT {
return fmt.Errorf("eglCreateContext failed: %v", eglErr())
}
Expand Down
9 changes: 9 additions & 0 deletions shiny/driver/gldriver/x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ startDriver() {
EGL_NONE
};
e_ctx = eglCreateContext(e_dpy, e_config, EGL_NO_CONTEXT, ctx_attribs);
if (!e_ctx) {
// Try again with OpenGL ES 2.0.
static const EGLint ctx2_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};

e_ctx = eglCreateContext(e_dpy, e_config, EGL_NO_CONTEXT, ctx2_attribs);
}
if (!e_ctx) {
fprintf(stderr, "eglCreateContext failed: %s\n", eglGetErrorStr());
exit(1);
Expand Down
3 changes: 0 additions & 3 deletions shiny/driver/gldriver/x11.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ type uiClosure struct {
}

func main(f func(screen.Screen)) error {
if gl.Version() == "GL_ES_2_0" {
return errors.New("gldriver: ES 3 required on X11")
}
C.startDriver()
glctx, worker = gl.NewContext()

Expand Down