Skip to content

Conversation

@wenjieshen
Copy link
Collaborator

@wenjieshen wenjieshen commented Jan 5, 2026

  • Updates GL examples to call SDL_GL_MakeCurrent() and provide the correct native handles to tvg::GlCanvas::target() on macOS (CGL), GLES (EGL), Windows (HDC/HWND), and X11 (Display/Window), with a safe fallback.
  • Ensures GL raster support is enabled at build time when gl or glesv2 is found; enables the GLES path via TVGEXAMPLE_GLES_SUPPORTED.
  • Aims to prevent incorrect/blank rendering caused by targeting the canvas with insufficient context info.

** Please ensure that this pull request is merged only after the following one is approved and merged: thorvg/thorvg#4065. **

- Add context example to verify GL context switching
- Remove support for macOS and X11
- Normalize EXAMPLE_DIR on Windows for Meson example build

[NOT FOR MERGE] Add Meson GL backend option

Introduce meson_options.txt to select GL vs GLES.
Wire option in examples build to pull gl/gles+egl deps and
set TVGEXAMPLE_GLES_SUPPORTED for GLES builds. Update GL
context setup to use the new GLES define and prioritize EGL
context handling when enabled.
@wenjieshen wenjieshen force-pushed the jay/gl/multi-context-support branch from a17c3fb to 4781749 Compare January 7, 2026 15:33
@hermet
Copy link
Member

hermet commented Jan 7, 2026

@wenjieshen We might need to upgrade to SDL3 first. Until that, we could pass nullptr...

SDL_EGLDisplay display = SDL_EGL_GetCurrentDisplay();
 // sdl is running on egl.
if (display) {
   //get surface
}

https://wiki.libsdl.org/SDL3/SDL_EGL_GetCurrentDisplay
https://wiki.libsdl.org/SDL3/SDL_EGL_GetWindowSurface

@hermet
Copy link
Member

hermet commented Jan 8, 2026

#13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants