summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c90a76d)
raw | patch | inline | side by side (parent: c90a76d)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Fri, 6 Mar 2020 22:42:08 +0000 (01:42 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Fri, 6 Mar 2020 22:42:08 +0000 (01:42 +0300) |
index af999b19d4d3efb3373fd9ee9042b8395cd287fc..5edceb2c5f9d3c754a4d2f2f8e969fcd46410849 100644 (file)
procedure e_ResizeWindow(Width, Height: Integer);
function e_ResizeFramebuffer(Width, Height: Integer): Boolean;
procedure e_BlitFramebuffer(WinWidth, WinHeight: Integer);
+procedure e_SetRenderTarget(Framebuffer: Boolean);
procedure e_Draw(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
Blending: Boolean; Mirror: TMirrorType = TMirrorType.None);
glTexCoord2f(u, v); glVertex2i(x1, y0);
end;
+procedure e_SetRenderTarget(Framebuffer: Boolean);
+begin
+ if (e_FBO = 0) or e_NoGraphics then exit;
+ if Framebuffer then
+ glBindFramebuffer(GL_FRAMEBUFFER, e_FBO)
+ else
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+end;
+
procedure e_BlitFramebuffer(WinWidth, WinHeight: Integer);
begin
if (e_FBO = 0) or (e_Frame = 0) or e_NoGraphics then exit;
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindTexture(GL_TEXTURE_2D, e_Frame);
- e_SetViewPort(0, 0, WinWidth, WinHeight);
glColor4ub(255, 255, 255, 255);
glBegin(GL_QUADS);
glTexCoord2f(1, 0); glVertex2i(WinWidth, WinHeight);
glTexCoord2f(1, 1); glVertex2i(WinWidth, 0);
glEnd();
-
- glBindFramebuffer(GL_FRAMEBUFFER, e_FBO);
- e_SetViewPort(0, 0, e_FrameW, e_FrameH);
end;
procedure e_Draw(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index ca0bea81dcbceb186b04afd137886b03d74542a6..e3d9b7bb2bed0c13288230a0e9be989c17656068 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
FPSTime := Time;
end;
+ e_SetRendertarget(True);
+ e_SetViewPort(0, 0, gScreenWidth, gScreenHeight);
+
if gGameOn or (gState = STATE_FOLD) then
begin
if (gPlayer1 <> nil) and (gPlayer2 <> nil) then
if gGameOn then drawProfilers();
+ // TODO: draw this after the FBO and remap mouse click coordinates
+
{$IFDEF ENABLE_HOLMES}
g_Holmes_DrawUI();
{$ENDIF}
+ // blit framebuffer to screen
+
+ e_SetRendertarget(False);
+ e_SetViewPort(0, 0, gWinSizeX, gWinSizeY);
+ e_BlitFramebuffer(gWinSizeX, gWinSizeY);
+
+ // draw the overlay stuff on top of it
+
g_Touch_Draw;
end;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 5d1c59476562a51e5857173ed10021712e2580f1..c4d1b0fb73a7984ce18686733833b6189abbac3e 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
if forceUpdate then
begin
+ e_SetRendertarget(True);
+ e_SetViewPort(0, 0, gScreenWidth, gScreenHeight);
+
DrawMenuBackground('INTER');
e_DarkenQuadWH(0, 0, gScreenWidth, gScreenHeight, 150);
-
DrawLoadingStat();
g_Console_Draw(True);
+
+ e_SetRendertarget(False);
+ e_SetViewPort(0, 0, gWinSizeX, gWinSizeY);
+ e_BlitFramebuffer(gWinSizeX, gWinSizeY);
+
sys_Repaint;
prevLoadingUpdateTime := getTimeMilli();
end;
index 68f99188a830691b8f2d149e33ad70873d7a3191..c53a7b347596c44c4331497c94c7ee3a2cb524b0 100644 (file)
procedure sys_Repaint;
begin
- if glRenderToFBO then
- e_BlitFramebuffer(gWinSizeX, gWinSizeY);
SDL_GL_SwapBuffers
end;
index 992d6dc4c7091de9906f6f9808ef695c7553542c..b37ae0bf94c5d168aafc48aaaba0d66989a43c31 100644 (file)
procedure sys_Repaint;
begin
- if glRenderToFBO then
- e_BlitFramebuffer(gWinSizeX, gWinSizeY);
SDL_GL_SwapWindow(window)
end;