Skip to content

Commit 701fc4d

Browse files
committed
example: request stencil + MSAA buffers for GL contexts
Request a stencil buffer and multisample buffers for the SDL GL contexts in Example and MultiCanvas so the direct back‑buffer path has the needed stencil/multisample support.
1 parent 42b148d commit 701fc4d

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/Example.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ struct GlWindow : Window
370370
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
371371
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
372372
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
373+
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
374+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
375+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
373376
#endif
374377
window = SDL_CreateWindow("ThorVG Example (OpenGL/ES)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE);
375378
context = SDL_GL_CreateContext(window);

src/MultiCanvas.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ void runGl()
183183
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
184184
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
185185
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
186+
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
187+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
188+
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
186189
#endif
187190

188191
auto window = SDL_CreateWindow("ThorVG Example (OpenGL)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN);

0 commit comments

Comments
 (0)