Skip to content

Commit

Permalink
Fix GLES initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
thesourcehim committed Jul 15, 2024
1 parent 8e52190 commit 9a75aab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions desmume/src/frontend/posix/gtk/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2291,7 +2291,7 @@ static void GraphicsSettingsDialog(GSimpleAction *action, GVariant *parameter, g
#else
if (!is_sdl_initialized())
{
init_sdl_3Demu();
init_sdl_3Demu(sel3DCore==3);
}
#endif
}
Expand Down Expand Up @@ -3863,7 +3863,7 @@ common_gtk_main(GApplication *app, gpointer user_data)
#else
if (!is_sdl_initialized())
{
init_sdl_3Demu();
init_sdl_3Demu(core==3);
}
#endif
}
Expand Down
17 changes: 13 additions & 4 deletions desmume/src/frontend/posix/gtk/sdl_3Demu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ bool deinit_sdl_3Demu(void)
return ret;
}

bool init_sdl_3Demu(void)
bool init_sdl_3Demu(bool useES)
{
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
Expand All @@ -59,9 +59,18 @@ bool init_sdl_3Demu(void)
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
if(useES)
{
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
}
else
{
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
}

win = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, real_framebuffer_width,
real_framebuffer_height, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN);
Expand Down
2 changes: 1 addition & 1 deletion desmume/src/frontend/posix/gtk/sdl_3Demu.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef SDL_3DEMU_H
#define SDL_3DEMU_H

bool init_sdl_3Demu(void);
bool init_sdl_3Demu(bool useES);
bool deinit_sdl_3Demu(void);
bool is_sdl_initialized(void);

Expand Down

0 comments on commit 9a75aab

Please sign in to comment.