Browse Source

Pass -DUSE_GLES to sdl2 GL init context instead of -DTARGET_RPI, since there are more GLES platforms out there that this engine will run on.

master
vanfanel 2 years ago
parent
commit
ab52a3cbf5
  1. 3
      Makefile
  2. 10
      src/pc/gfx/gfx_sdl2.c

3
Makefile

@ -133,7 +133,8 @@ endif
ifeq ($(NON_MATCHING),1)
VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB
ifeq ($(TARGET_RPI),1) # Define RPi to change SDL2 title & GLES2 hints
VERSION_CFLAGS += -DTARGET_RPI
# Other platforms will use GLES2 eventually, not only RPis.
VERSION_CFLAGS += -DUSE_GLES
endif
VERSION_ASFLAGS := --defsym AVOID_UB=1
COMPARE := 0

10
src/pc/gfx/gfx_sdl2.c

@ -100,7 +100,7 @@ static void gfx_sdl_init(void) {
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#ifdef TARGET_RPI
#ifdef USE_GLES
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); // These attributes allow for hardware acceleration on RPis.
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
@ -109,18 +109,18 @@ static void gfx_sdl_init(void) {
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
#ifndef TARGET_RPI
wnd = SDL_CreateWindow("Super Mario 64 PC-Port", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
#ifndef USE_GLES
wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
#else
wnd = SDL_CreateWindow("Super Mario 64 RPi (GLES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
wnd = SDL_CreateWindow("Super Mario 64 PC port (OpenGL_ES2)", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
DESIRED_SCREEN_WIDTH, DESIRED_SCREEN_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
#endif
gfx_sdl_set_fullscreen(configFullscreen);
SDL_GL_CreateContext(wnd);
SDL_GL_SetSwapInterval(2); // TODO 0, 1 or 2 or remove this line
SDL_GL_SetSwapInterval(1); // We have a double buffered GL context, it makes no sense to want tearing.
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
inverted_scancode_table[windows_scancode_table[i]] = i;

Loading…
Cancel
Save