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);
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;
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}