From 05e7dd07de3d08f5ab9e617a21a1899dfcb7fbfa Mon Sep 17 00:00:00 2001 From: fgsfds Date: Mon, 10 Feb 2020 00:44:35 +0300 Subject: [PATCH] temp fix headless builds --- src/engine/e_graphics.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine/e_graphics.pas b/src/engine/e_graphics.pas index 18f75c4..5b117f0 100644 --- a/src/engine/e_graphics.pas +++ b/src/engine/e_graphics.pas @@ -199,11 +199,13 @@ var e_TextureFonts: array of TTextureFont = nil; e_CharFonts: array of TCharFont; //e_SavedTextures: array of TSavedTexture; +{$IFNDEF HEADLESS} e_FBO: GLuint = 0; e_RBO: GLuint = 0; e_Frame: GLuint = 0; e_FrameW: Integer = -1; e_FrameH: Integer = -1; +{$ENDIF} //function e_getTextGLId (ID: DWORD): GLuint; begin result := e_Textures[ID].tx.id; end; @@ -381,6 +383,9 @@ end; procedure e_ResizeFramebuffer(Width, Height: Integer); begin +{$IFNDEF HEADLESS} + if e_NoGraphics then Exit; + glBindTexture(GL_TEXTURE_2D, 0); glBindRenderbuffer(GL_RENDERBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -421,6 +426,7 @@ begin glBindFramebuffer(GL_FRAMEBUFFER, e_FBO); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, e_Frame, 0); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, e_RBO); +{$ENDIF} end; procedure e_ResizeWindow(Width, Height: Integer); @@ -453,7 +459,8 @@ end; procedure e_BlitFramebuffer(WinWidth, WinHeight: Integer); begin - if (e_FBO = 0) or (e_Frame = 0) then exit; +{$IFNDEF HEADLESS} + if (e_FBO = 0) or (e_Frame = 0) or e_NoGraphics then exit; glDisable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -465,6 +472,7 @@ begin glEnd(); glBindFramebuffer(GL_FRAMEBUFFER, e_FBO); e_SetViewPort(0, 0, e_FrameW, e_FrameH); +{$ENDIF} end; procedure e_Draw(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean; -- 2.29.2