From: DeaDDooMER Date: Sun, 26 Mar 2023 12:20:54 +0000 (+0300) Subject: system: fix stencil check X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=fa89488f45ed157516a0126f4c291a11a22765d7;p=d2df-sdl.git system: fix stencil check --- diff --git a/src/game/sdl/g_system.pas b/src/game/sdl/g_system.pas index cc8704c..9f56262 100644 --- a/src/game/sdl/g_system.pas +++ b/src/game/sdl/g_system.pas @@ -78,28 +78,28 @@ implementation (* --------- Graphics --------- *) function LoadGL: Boolean; - {$IFNDEF NOGL_INIT} - var - ltmp: Integer; - {$ENDIF} + var ltmp: Integer; begin result := true; {$IFDEF NOGL_INIT} - nogl_Init; - if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then + nogl_Init; + if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then + begin + e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering'); + glRenderToFBO := false; + end; {$ELSE} - if SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp) = 0 then + if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then + begin + e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering'); + glRenderToFBO := false; + end; + {$ENDIF} + if SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, ltmp) = 0 then begin e_LogWritefln('stencil buffer size: %s', [ltmp]); gwin_has_stencil := (ltmp > 0); end; - - if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then - {$ENDIF} - begin - e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering'); - glRenderToFBO := false; - end; end; procedure FreeGL; diff --git a/src/game/sdl2/g_system.pas b/src/game/sdl2/g_system.pas index b3005d5..6f48d28 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -75,28 +75,28 @@ implementation (* --------- Graphics --------- *) function LoadGL: Boolean; - {$IFNDEF NOGL_INIT} - var - ltmp: Integer; - {$ENDIF} + var ltmp: Integer; begin result := true; {$IFDEF NOGL_INIT} - nogl_Init; - if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then + nogl_Init; + if glRenderToFBO and (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) then + begin + e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering'); + glRenderToFBO := false; + end; {$ELSE} + if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then + begin + e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering'); + glRenderToFBO := false; + end; + {$ENDIF} if SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp) = 0 then begin e_LogWritefln('stencil buffer size: %s', [ltmp]); gwin_has_stencil := (ltmp > 0); end; - - if glRenderToFBO and (not Load_GL_ARB_framebuffer_object) then - {$ENDIF} - begin - e_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering'); - glRenderToFBO := false; - end; end; procedure FreeGL;