From 7beac654716bea57230c04c5266863dfa3705499 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Wed, 23 Nov 2016 00:55:07 +0100 Subject: [PATCH] Add Linux support for GLSWFrameBuffer --- src/posix/sdl/hardware.cpp | 4 +++- src/posix/sdl/sdlglvideo.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index f4ac13fc5..b8ca0ee21 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -55,6 +55,8 @@ EXTERN_CVAR (Bool, ticker) EXTERN_CVAR (Bool, fullscreen) EXTERN_CVAR (Float, vid_winscale) +CVAR (Bool, vid_sdl, 0, 0); + IVideo *Video; extern int NewWidth, NewHeight, NewBits, DisplayBits; @@ -119,7 +121,7 @@ void I_InitGraphics () ticker.SetGenericRepDefault (val, CVAR_Bool); //currentrenderer = vid_renderer; - if (currentrenderer==1) Video = new SDLGLVideo(0); + if (currentrenderer==1 || vid_sdl==0) Video = new SDLGLVideo(0); else Video = new SDLVideo (0); if (Video == NULL) diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index d8c00f236..ef9eef0b4 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -52,6 +52,8 @@ EXTERN_CVAR (Int, vid_renderer) EXTERN_CVAR (Int, vid_maxfps) EXTERN_CVAR (Bool, cl_capfps) +DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool fullscreen); + // PUBLIC DATA DEFINITIONS ------------------------------------------------- CUSTOM_CVAR(Bool, gl_debug, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) @@ -194,7 +196,12 @@ DFrameBuffer *SDLGLVideo::CreateFrameBuffer (int width, int height, bool fullscr // flashAmount = 0; } - SDLGLFB *fb = new OpenGLFrameBuffer (0, width, height, 32, 60, fullscreen); + SDLGLFB *fb; + if (vid_renderer == 1) + fb = new OpenGLFrameBuffer (0, width, height, 32, 60, fullscreen); + else + fb = (SDLGLFB*)CreateGLSWFrameBuffer (width, height, fullscreen); + retry = 0; // If we could not create the framebuffer, try again with slightly