DEADSOFTWARE

temp fix headless builds
authorfgsfds <pvt.fgsfds@gmail.com>
Sun, 9 Feb 2020 21:44:35 +0000 (00:44 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Mon, 10 Feb 2020 17:19:50 +0000 (20:19 +0300)
src/engine/e_graphics.pas

index 18f75c44ea3263119bd6bfbb429a614c05060e09..5b117f0433010d0a438ab68d0db3104282711971 100644 (file)
@@ -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;