summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 130ece9)
raw | patch | inline | side by side (parent: 130ece9)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 14 Aug 2017 15:05:27 +0000 (18:05 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 14 Aug 2017 15:06:37 +0000 (18:06 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 963f8aec27dfa4e0f4586e9ecfbbecd6c69f203c..68b2ee4a987114e6ad98e41b8fb6518357491a37 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
begin
Parse_Params(pars);
+ s := Find_Param_Value(pars, '--opengl-dump-exts');
+ if s <> '' then gwin_dump_extensions := true; // sorry
+
// Debug mode:
s := Find_Param_Value(pars, '--debug');
if (s <> '') then
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 651675a2572865cb3fc2feeaeb657f963a9efbb5..6ffa8ff05468b132ff35b3eaa2e8b4b988979a7e 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
function g_Window_SetDisplay(PreserveGL: Boolean = False): Boolean;
function g_Window_SetSize(W, H: Word; FScreen: Boolean): Boolean;
+var
+ gwin_dump_extensions: Boolean = false;
+
implementation
uses
SDL_GL_SetSwapInterval(v);
end;
+function glHasExtension (name: AnsiString): Boolean;
+var
+ exts: PChar;
+ i: Integer;
+ found: Boolean;
+ extName: ShortString;
+begin
+ result := false;
+ if length(name) = 0 then exit;
+ exts := glGetString(GL_EXTENSIONS);
+ if exts = nil then exit;
+ while (exts[0] <> #0) and (exts[0] = ' ') do Inc(exts);
+ while exts[0] <> #0 do
+ begin
+ if gwin_dump_extensions then
+ begin
+ i := 0;
+ while (exts[i] <> #0) and (exts[i] <> ' ') do Inc(i);
+ if i > 255 then
+ begin
+ e_WriteLog('FUUUUUUUUUUUUU', MSG_WARNING);
+ end
+ else
+ begin
+ Move(exts^, extName[1], i);
+ extName[0] := Char(i);
+ e_WriteLog(Format('EXT: %s', [extName]), MSG_NOTIFY);
+ end;
+ end;
+ found := true;
+ for i := 0 to length(name)-1 do
+ begin
+ if exts[i] = #0 then begin found := false; break; end;
+ if exts[i] <> name[i+1] then begin found := false; break; end;
+ end;
+ if found and ((exts[length(name)] = #0) or (exts[length(name)] = ' ')) then begin result := true; exit; end;
+ while (exts[0] <> #0) and (exts[0] <> ' ') do Inc(exts);
+ while (exts[0] <> #0) and (exts[0] = ' ') do Inc(exts);
+ end;
+end;
+
function SDLMain(): Integer;
begin
{$IFDEF HEADLESS}
{EnumDisplayModes();}
+ if not glHasExtension('GL_ARB_texture_non_power_of_two') then
+ begin
+ e_WriteLog('Driver DID''T advertised NPOT textures support', MSG_WARNING);
+ glLegacyNPOT := true;
+ end
+ else
+ begin
+ e_WriteLog('Driver advertised NPOT textures support', MSG_NOTIFY);
+ glLegacyNPOT := false;
+ end;
+
Init();
Time_Old := GetTimer();