X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fsdl2%2Fg_system.pas;h=6f48d28bef982189e1b68bd9243f897eb723ce5f;hb=0afc0aed48395daa3f4f4845b12df146dc4f3ab3;hp=eec03232f7d26e99fd2619d39994ff5291b26257;hpb=dac16ad95bb1fcf32130e3d6f7a301e63ba85ab0;p=d2df-sdl.git diff --git a/src/game/sdl2/g_system.pas b/src/game/sdl2/g_system.pas index eec0323..6f48d28 100644 --- a/src/game/sdl2/g_system.pas +++ b/src/game/sdl2/g_system.pas @@ -75,17 +75,27 @@ implementation (* --------- Graphics --------- *) function LoadGL: Boolean; + 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 + 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_LogWriteln('GL: framebuffer objects not supported; disabling FBO rendering'); - glRenderToFBO := false; + e_LogWritefln('stencil buffer size: %s', [ltmp]); + gwin_has_stencil := (ltmp > 0); end; end; @@ -134,17 +144,17 @@ implementation {$ENDIF} end; - function GetTitle (): PChar; + function GetTitle (): AnsiString; var info: AnsiString; begin info := g_GetBuildHash(false); if info = 'custom build' then info := info + ' by ' + g_GetBuilderName() + ' ' + GAME_BUILDDATE + ' ' + GAME_BUILDTIME; - result := PChar(Format(GameTitle, [info])) + result := Format(GameTitle, [info]); end; function InitWindow (w, h, bpp: Integer; fullScreen, maximized: Boolean): Boolean; - var flags: UInt32; x, y: cint; + var flags: UInt32; x, y: cint; title: AnsiString; begin // note: on window close make: if assigned(oglDeinitCB) then oglDeinitCB; e_LogWritefln('InitWindow %s %s %s %s', [w, h, bpp, fullScreen]); @@ -178,7 +188,8 @@ implementation x := wx; y := wy end; - window := SDL_CreateWindow(GetTitle(), x, y, w, h, flags); + title := GetTitle(); + window := SDL_CreateWindow(PChar(title), x, y, w, h, flags); if window <> nil then begin context := SDL_GL_CreateContext(window);