summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 92b319e)
raw | patch | inline | side by side (parent: 92b319e)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 19 Feb 2018 21:41:58 +0000 (00:41 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sat, 17 Mar 2018 00:04:27 +0000 (02:04 +0200) |
index 99d63e3a3fa22c9dff4a07fe26bd0c4e6eaa6146..b78a175885a26b4652088019e36ac59cf8cdd50d 100644 (file)
Result.Width := w;
Result.Height := h;
-{$IFNDEF USE_NANOGL}
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glGetTexImage
if e_NoGraphics then Exit;
data := GetMemory(w*h*4);
end;
FreeMemory(data);
-{$ENDIF USE_NANOGL}
+{$ENDIF}
end;
procedure e_ResizeWindow(Width, Height: Integer);
@@ -958,6 +958,7 @@ procedure e_DrawQuad(X1, Y1, X2, Y2: Integer; Red, Green, Blue: Byte; Alpha: Byt
var
nX1, nY1, nX2, nY2: Integer;
begin
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glBegin(GL_LINES)
if e_NoGraphics then Exit;
// Only top-left/bottom-right quad
if X1 > X2 then
glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
glDisable(GL_BLEND);
+{$ENDIF}
end;
procedure e_DrawFillQuad(X1, Y1, X2, Y2: Integer; Red, Green, Blue, Alpha: Byte;
procedure e_DrawLine(Width: Byte; X1, Y1, X2, Y2: Integer; Red, Green, Blue: Byte; Alpha: Byte = 0);
begin
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glBegin(GL_LINES)
if e_NoGraphics then Exit;
// Pixel-perfect lines
if Width = 1 then
glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
glDisable(GL_BLEND);
+{$ENDIF}
end;
//------------------------------------------------------------------
id := High(e_TextureFonts);
end;
-{$IFNDEF USE_NANOGL}
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support gl-lists
with e_TextureFonts[id] do
begin
Base := glGenLists(XCount*YCount);
procedure e_TextureFontKill(FontID: DWORD);
begin
if e_NoGraphics then Exit;
-{$IFNDEF USE_NANOGL}
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support gl-lists
glDeleteLists(e_TextureFonts[FontID].Base, 256);
{$ENDIF}
e_TextureFonts[FontID].Base := 0;
procedure e_TextureFontPrint(X, Y: GLint; Text: string; FontID: DWORD);
begin
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support gl-lists
if e_NoGraphics then Exit;
if Integer(FontID) > High(e_TextureFonts) then Exit;
if Text = '' then Exit;
glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
-{$IFNDEF USE_NANOGL}
glPushMatrix;
glBindTexture(GL_TEXTURE_2D, e_TextureFonts[FontID].TextureID);
glEnable(GL_TEXTURE_2D);
glCallLists(Length(Text), GL_UNSIGNED_BYTE, PChar(Text));
glDisable(GL_TEXTURE_2D);
glPopMatrix;
-{$ENDIF}
glDisable(GL_BLEND);
+{$ENDIF}
end;
// god forgive me for this, but i cannot figure out how to do it without lists
procedure e_TextureFontPrintChar(X, Y: Integer; Ch: Char; FontID: DWORD; Shadow: Boolean = False);
begin
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support gl-lists
if e_NoGraphics then Exit;
glPushMatrix;
-{$IFNDEF USE_NANOGL}
if Shadow then
begin
glColor4ub(0, 0, 0, 128);
glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
glTranslated(X, Y, 0);
glCallLists(1, GL_UNSIGNED_BYTE, @Ch);
-{$ENDIF}
glPopMatrix;
+{$ENDIF}
end;
procedure e_TextureFontPrintCharEx (X, Y: Integer; Ch: Char; FontID: DWORD; Shadow: Boolean = False);
tc, c: TRGB;
w: Word;
begin
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support gl-lists
if e_NoGraphics then Exit;
if Text = '' then Exit;
if e_TextureFonts = nil then Exit;
w := e_TextureFonts[FontID].CharWidth;
-{$IFNDEF USE_NANOGL}
with e_TextureFonts[FontID] do
begin
glBindTexture(GL_TEXTURE_2D, e_TextureFonts[FontID].TextureID);
procedure e_TextureFontPrintEx(X, Y: GLint; Text: string; FontID: DWORD; Red, Green,
Blue: Byte; Scale: Single; Shadow: Boolean = False);
begin
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support gl-lists
if e_NoGraphics then Exit;
if Text = '' then Exit;
-{$IFNDEF USE_NANOGL}
glPushMatrix;
glBindTexture(GL_TEXTURE_2D, e_TextureFonts[FontID].TextureID);
glEnable(GL_TEXTURE_2D);
for i := 0 to High(e_TextureFonts) do
if e_TextureFonts[i].Base <> 0 then
begin
-{$IFNDEF USE_NANOGL}
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support gl-lists
glDeleteLists(e_TextureFonts[i].Base, 256);
{$ENDIF}
e_TextureFonts[i].Base := 0;
diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas
index 8ffb75d0d852147ac6cc227e63ceded7cc7123a0..e2a88e08b66305dfebdc895eab2bfc17a40c9cdf 100644 (file)
--- a/src/engine/e_log.pas
+++ b/src/engine/e_log.pas
ss: ShortString;
slen: Integer;
b: PByte;
+{$IFDEF ANDROID}
cstr: PChar;
+{$ENDIF}
begin
if (len < 1) then exit;
b := PByte(@buf);
cstr[slen + 1] := #0;
SDL_Log(cstr, []);
Dispose(cstr);
-{$ENDIF ANDROID}
+{$ENDIF}
while (len > 0) do
begin
index 67ad97cf3ffe6f94424964d2fbc0e2fc14584ec9..93992faeacfc65ffa435b00b200c54d9dc133269 100644 (file)
function isScaled (): Boolean;
var
- mt: packed array [0..15] of Double;
+ mt: packed array [0..15] of GLfloat;
begin
-{$IFNDEF USE_NANOGL}
- glGetDoublev(GL_MODELVIEW_MATRIX, @mt[0]);
-{$ENDIF}
+ glGetFloatv(GL_MODELVIEW_MATRIX, @mt[0]);
result := (mt[0] <> 1.0) or (mt[1*4+1] <> 1.0);
end;
glMatrixMode(GL_MODELVIEW); glPushMatrix();
glMatrixMode(GL_TEXTURE); glPushMatrix();
glMatrixMode(GL_COLOR); glPushMatrix();
-{$IFNDEF USE_NANOGL}
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glPushAttrib
glPushAttrib({GL_ENABLE_BIT|GL_COLOR_BUFFER_BIT|GL_CURRENT_BIT}GL_ALL_ATTRIB_BITS); // let's play safe
{$ENDIF}
saved := true;
procedure TSavedGLState.restore ();
begin
if (not saved) then raise Exception.Create('cannot restore unsaved OpenGL state');
-{$IFNDEF USE_NANOGL}
+{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glPopAttrib
glPopAttrib({GL_ENABLE_BIT});
{$ENDIF}
glMatrixMode(GL_PROJECTION); glPopMatrix();
// set active context; `ctx` can be `nil`
procedure gxSetContextInternal (ctx: TGxContext; ascale: Single; domatrix: Boolean);
var
- mt: packed array [0..15] of Double;
+ mt: packed array [0..15] of GLfloat;
begin
if (savedGLState.saved) then savedGLState.restore();
else
begin
// assume uniform scale
-{$IFNDEF USE_NANOGL}
- glGetDoublev(GL_MODELVIEW_MATRIX, @mt[0]);
-{$ENDIF}
+ glGetFloatv(GL_MODELVIEW_MATRIX, @mt[0]);
ctx.mScaled := (mt[0] <> 1.0) or (mt[1*4+1] <> 1.0);
ctx.mScale := mt[0];
oglSetup2DState();
procedure TScissorSave.save (enableScissoring: Boolean);
begin
-{$IFDEF USE_NANOGL}
- wassc := false; // FIXIT
+{$IFDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glIsEnabled
+ wassc := false;
{$ELSE}
wassc := (glIsEnabled(GL_SCISSOR_TEST) <> 0);
{$ENDIF}
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 726d37038339aa875cda8b0af270090a4ed78324..3e4e0221fb917c86e9261bb23b13f50d64ed7f6a 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
* glBlendFunc(GL_DST_ALPHA, GL_ONE);
* draw all geometry up to and including walls (with alpha-testing, probably) -- this does lighting
*)
-{$IFDEF USE_NANOGL}
- wassc := false; // FIXIT
+{$IFDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glIsEnabled
+ wassc := false;
{$ELSE}
wassc := (glIsEnabled(GL_SCISSOR_TEST) <> 0);
{$ENDIF}
diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index 878c45acf560339b232bcb0db62bc52a2993378c..0f26212b29ce8f21c066bb80299f4c395011bfbe 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
var
a: Integer;
begin
+{$IFDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glBegin(GL_POINTS)
+ count := 0;
+{$ENDIF}
if count > 50000 then count := 50000;
if (count < 1) then count := 1;
SetLength(Particles, count);
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 90c5950caa830d59d0670e3aba4e3f4eed6fb6a8..395f44e415144e1a9aefedc2fee5355f3383389a 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
if (h_Wnd <> nil) then SDL_DestroyWindow(h_Wnd);
if (h_GL <> nil) and (not preserveGL) then
begin
- {$IFDEF USE_NANOGL}
- nanoGL_Destroy;
- {$ENDIF USE_NANOGL}
+{$IFDEF USE_NANOGL}
+ nanoGL_Destroy;
+{$ENDIF USE_NANOGL}
SDL_GL_DeleteContext(h_GL);
end;
h_Wnd := nil;
e_WriteLog('nanoGL initialization error', TMsgType.Fatal);
exit;
end;
-{$ENDIF USE_NANOGL}
+{$ENDIF}
if (assigned(oglInitCB)) then oglInitCB();
if (h_GL <> nil) then g_SetVSync(gVSync);
{$ENDIF}
index f63e9ce1d49c272b64296f28a4c5ac92b83ffd85..f16d060d6dc4399f1f2519bdb3548617db863231 100644 (file)
procedure glTexCoord2i(s, t: GLint);
begin
- glTexCoord2f(1 / s, 1 / t);
+ glTexCoord2f(s, t);
end;
end.