X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fsdl%2Fg_system.pas;h=a4cbe649a3f7b4fcb39f7d908365e366776c9903;hb=14771a7395dda16d199b88c71d975d840c7e5b14;hp=bdb4addacd31ae280b01274772671f61683ab014;hpb=027ace8eccb0dc4c1d5ff8796b238d5b1fbbcfed;p=d2df-sdl.git diff --git a/src/game/sdl/g_system.pas b/src/game/sdl/g_system.pas index bdb4add..a4cbe64 100644 --- a/src/game/sdl/g_system.pas +++ b/src/game/sdl/g_system.pas @@ -25,7 +25,7 @@ interface (* --- Graphics --- *) function sys_GetDisplayModes (bpp: Integer): SSArray; - function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen: Boolean): Boolean; + function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean; procedure sys_EnableVSync (yes: Boolean); procedure sys_Repaint; @@ -74,8 +74,15 @@ implementation begin gWinSizeX := w; gWinSizeY := h; - gWinRealPosX := 0; - gWinRealPosY := 0; + gRC_Width := w; + gRC_Height := h; + if glRenderToFBO then + begin + // store real window size in gWinSize, downscale resolution now + w := round(w / r_pixel_scale); + h := round(h / r_pixel_scale); + e_ResizeFramebuffer(w, h); + end; gScreenWidth := w; gScreenHeight := h; {$IFDEF ENABLE_HOLMES} @@ -102,7 +109,7 @@ implementation var flags: Uint32; begin e_LogWritefln('InitWindow %s %s %s %s', [w, h, bpp, fullScreen]); - result := False; + result := false; SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); @@ -119,9 +126,18 @@ implementation if screen <> nil then begin {$IFDEF NOGL_INIT} - nogl_Init; + nogl_Init; + if (not nogl_ExtensionSupported('GL_OES_framebuffer_object')) and glRenderToFBO then + {$ELSE} + if (not Load_GL_ARB_framebuffer_object()) and glRenderToFBO then {$ENDIF} + begin + e_LogWriteln('SDL: no framebuffer object support detected'); + glRenderToFBO := False + end; SDL_WM_SetCaption(GetTitle(), nil); + gFullScreen := fullscreen; + gRC_FullScreen := fullscreen; UpdateSize(w, h); result := True end @@ -134,6 +150,8 @@ implementation procedure sys_Repaint; begin + if glRenderToFBO then + e_BlitFramebuffer(gWinSizeX, gWinSizeY); SDL_GL_SwapBuffers end; @@ -161,7 +179,7 @@ implementation end end; - function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen: Boolean): Boolean; + function sys_SetDisplayMode (w, h, bpp: Integer; fullscreen, maximized: Boolean): Boolean; begin result := InitWindow(w, h, bpp, fullscreen) end;