From: DeaDDooMER Date: Fri, 8 Sep 2023 11:29:02 +0000 (+0300) Subject: gl: fix load textures on startup X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=c869f28997ec7308491cbc067ee15d8a53f923e4;p=d2df-editor.git gl: fix load textures on startup --- diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 58b6210..dfb9b75 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -2862,6 +2862,23 @@ begin e_TextureFontPrintEx(X, Y, Text, FontID, 0, 0, 0, 1.0); end; +procedure InitGraphics; +begin + // FIXME: this is a shitty hack + if not gDataLoaded then + begin + e_WriteLog('Init OpenGL', MSG_NOTIFY); + e_InitGL(); + e_WriteLog('Loading data', MSG_NOTIFY); + LoadStdFont('STDTXT', 'STDFONT', gEditorFont); + e_WriteLog('Loading more data', MSG_NOTIFY); + LoadData(); + e_WriteLog('Loading even more data', MSG_NOTIFY); + gDataLoaded := True; + MainForm.FormResize(nil); + end; +end; + procedure TMainForm.Draw(); var x, y: Integer; @@ -2877,6 +2894,8 @@ begin Width := 0; Height := 0; + InitGraphics(); + e_BeginRender(); e_Clear(GL_COLOR_BUFFER_BIT, @@ -6697,20 +6716,6 @@ end; procedure TMainForm.OnIdle(Sender: TObject; var Done: Boolean); var f: AnsiString; begin - // FIXME: this is a shitty hack - if not gDataLoaded then - begin - e_WriteLog('Init OpenGL', MSG_NOTIFY); - e_InitGL(); - e_WriteLog('Loading data', MSG_NOTIFY); - LoadStdFont('STDTXT', 'STDFONT', gEditorFont); - e_WriteLog('Loading more data', MSG_NOTIFY); - LoadData(); - e_WriteLog('Loading even more data', MSG_NOTIFY); - gDataLoaded := True; - MainForm.FormResize(nil); - end; - Draw(); if StartMap <> '' then begin f := StartMap;