From fb64f3ee32746ffd398f5d0717037856c6dce7ac Mon Sep 17 00:00:00 2001 From: Vincenzo Pupillo Date: Tue, 20 Oct 2026 11:30:51 +0200 Subject: [PATCH] When SDL is runnig on EGL, pass the EGLDisplay and EGLSurface to GLCanvas target. issue: #11 Co-authored-by: Hermet Park --- src/tvgWindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tvgWindow.cpp b/src/tvgWindow.cpp index 25afc7a..7d9b113 100644 --- a/src/tvgWindow.cpp +++ b/src/tvgWindow.cpp @@ -276,8 +276,10 @@ void GlWindow::resize() Window::resize(); // set the canvas target and draw on it. - // TODO: When using SDL3, EGLDisplay and EGLSurface may need to be passed as arguments to target(). - CHECK(static_cast(canvas)->target(nullptr, nullptr, context, 0, size.w, size.h, tvg::ColorSpace::ABGR8888S)); + auto display = SDL_EGL_GetCurrentDisplay(); + auto surface = display ? SDL_EGL_GetWindowSurface(window) : nullptr; + + CHECK(static_cast(canvas)->target(display, surface, context, 0, size.w, size.h, tvg::ColorSpace::ABGR8888S)); } void GlWindow::refresh()