mirror of
https://github.com/phoboslab/wipeout-rewrite
synced 2024-11-16 07:47:57 +01:00
Add modern GLVND and explicit GLES2 support in GNU/Linux
This commit is contained in:
parent
cb2a1eded3
commit
13d1463112
3 changed files with 19 additions and 2 deletions
13
Makefile
13
Makefile
|
@ -2,6 +2,7 @@ CC ?= gcc
|
|||
EMCC ?= emcc
|
||||
UNAME_S := $(shell uname -s)
|
||||
RENDERER ?= GL
|
||||
USE_GLX ?= false
|
||||
DEBUG ?= false
|
||||
|
||||
L_FLAGS ?= -lm -rdynamic
|
||||
|
@ -23,6 +24,9 @@ else
|
|||
$(error Unknown RENDERER)
|
||||
endif
|
||||
|
||||
ifeq ($(GL_VERSION), GLES2)
|
||||
C_FLAGS := $(C_FLAGS) -DUSE_GLES2
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
@ -44,7 +48,14 @@ ifeq ($(UNAME_S), Darwin)
|
|||
|
||||
else ifeq ($(UNAME_S), Linux)
|
||||
ifeq ($(RENDERER), GL)
|
||||
L_FLAGS := $(L_FLAGS) -lGLEW -lGL
|
||||
L_FLAGS := $(L_FLAGS) -lGLEW
|
||||
|
||||
# Prefer modern GLVND instead of legacy X11-only GLX
|
||||
ifeq ($(USE_GLX), true)
|
||||
L_FLAGS := $(L_FLAGS) -lGL
|
||||
else
|
||||
L_FLAGS := $(L_FLAGS) -lOpenGL
|
||||
endif
|
||||
endif
|
||||
|
||||
L_FLAGS_SDL = -lSDL2
|
||||
|
|
|
@ -219,6 +219,12 @@ void platform_set_audio_mix_cb(void (*cb)(float *buffer, uint32_t len)) {
|
|||
SDL_GLContext platform_gl;
|
||||
|
||||
void platform_video_init() {
|
||||
#if defined(USE_GLES2)
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
|
||||
#endif
|
||||
|
||||
platform_gl = SDL_GL_CreateContext(window);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#define TEXTURES_MAX 1024
|
||||
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#if defined(__EMSCRIPTEN__) || defined(USE_GLES2)
|
||||
// WebGL (GLES) needs the `precision` to be set, wheras OpenGL 2
|
||||
// doesn't like that...
|
||||
#define SHADER_SOURCE(...) "precision highp float;" #__VA_ARGS__
|
||||
|
|
Loading…
Reference in a new issue