Skip to content

Commit

Permalink
Choose renderer by name for SDL3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugh Sanderson committed Sep 15, 2024
1 parent a396043 commit 8ffbd8b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions project/src/sdl2/SDL2Stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2507,7 +2507,13 @@ void CreateMainFrame(FrameCreationCallback inOnFrame, int inWidth, int inHeight,
}

#ifdef NME_SDL3
renderer = SDL_CreateRenderer(window, nullptr);
{
//int n = SDL_GetNumRenderDrivers();
//for(int i=0;i<n;i++)
// printf(" %d] %s\n",i, SDL_GetRenderDriver(i));

renderer = SDL_CreateRenderer(window, metal ? "metal" : nullptr);
}
#else
int renderFlags = 0;
if (hardware) renderFlags |= SDL_RENDERER_ACCELERATED;
Expand All @@ -2524,7 +2530,8 @@ void CreateMainFrame(FrameCreationCallback inOnFrame, int inWidth, int inHeight,
sgIsOGL2 = false;
}

if (!renderer && (inFlags & wfHW_AA_HIRES || inFlags & wfHW_AA)) {
if (!renderer && (inFlags & wfHW_AA_HIRES || inFlags & wfHW_AA))
{
// if no window was created and AA was enabled, disable AA and try again
fprintf(stderr, "Multisampling is not available. Retrying without. (%s)\n", SDL_GetError());
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, false);
Expand Down Expand Up @@ -2560,6 +2567,8 @@ void CreateMainFrame(FrameCreationCallback inOnFrame, int inWidth, int inHeight,
return;
}

//printf("Created renderer %s\n", SDL_GetRendererName(renderer) );

#ifdef NME_OGL
if (opengl && isMain)
{
Expand Down

0 comments on commit 8ffbd8b

Please sign in to comment.