index 67ad97cf3ffe6f94424964d2fbc0e2fc14584ec9..e543fc0e7023a9700a08ddf705f83f439aa8958c 100644 (file)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
interface
uses
interface
uses
-{$IFDEF USE_NANOGL}
- nanoGL,
-{$ELSE}
- GL, GLExt,
-{$ENDIF}
+ {$INCLUDE ../nogl/noGLuses.inc}
SysUtils, Classes,
SDL2,
sdlcarcass,
SysUtils, Classes,
SDL2,
sdlcarcass,
function isScaled (): Boolean;
var
function isScaled (): Boolean;
var
- mt: packed array [0..15] of Double;
+ mt: packed array [0..15] of GLfloat;
begin
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;
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();
glMatrixMode(GL_MODELVIEW); glPushMatrix();
glMatrixMode(GL_TEXTURE); glPushMatrix();
glMatrixMode(GL_COLOR); glPushMatrix();
-{$IFNDEF USE_NANOGL}
glPushAttrib({GL_ENABLE_BIT|GL_COLOR_BUFFER_BIT|GL_CURRENT_BIT}GL_ALL_ATTRIB_BITS); // let's play safe
glPushAttrib({GL_ENABLE_BIT|GL_COLOR_BUFFER_BIT|GL_CURRENT_BIT}GL_ALL_ATTRIB_BITS); // let's play safe
-{$ENDIF}
saved := true;
end;
procedure TSavedGLState.restore ();
begin
if (not saved) then raise Exception.Create('cannot restore unsaved OpenGL state');
saved := true;
end;
procedure TSavedGLState.restore ();
begin
if (not saved) then raise Exception.Create('cannot restore unsaved OpenGL state');
-{$IFNDEF USE_NANOGL}
glPopAttrib({GL_ENABLE_BIT});
glPopAttrib({GL_ENABLE_BIT});
-{$ENDIF}
glMatrixMode(GL_PROJECTION); glPopMatrix();
glMatrixMode(GL_MODELVIEW); glPopMatrix();
glMatrixMode(GL_TEXTURE); glPopMatrix();
glMatrixMode(GL_PROJECTION); glPopMatrix();
glMatrixMode(GL_MODELVIEW); glPopMatrix();
glMatrixMode(GL_TEXTURE); glPopMatrix();
// set active context; `ctx` can be `nil`
procedure gxSetContextInternal (ctx: TGxContext; ascale: Single; domatrix: Boolean);
var
// 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();
begin
if (savedGLState.saved) then savedGLState.restore();
else
begin
// assume uniform scale
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();
ctx.mScaled := (mt[0] <> 1.0) or (mt[1*4+1] <> 1.0);
ctx.mScale := mt[0];
oglSetup2DState();
procedure TScissorSave.save (enableScissoring: Boolean);
begin
procedure TScissorSave.save (enableScissoring: Boolean);
begin
-{$IFDEF USE_NANOGL}
- wassc := false; // FIXIT
-{$ELSE}
wassc := (glIsEnabled(GL_SCISSOR_TEST) <> 0);
wassc := (glIsEnabled(GL_SCISSOR_TEST) <> 0);
-{$ENDIF}
if wassc then glGetIntegerv(GL_SCISSOR_BOX, @scxywh[0]) else glGetIntegerv(GL_VIEWPORT, @scxywh[0]);
//conwritefln('(%d,%d)-(%d,%d)', [scxywh[0], scxywh[1], scxywh[2], scxywh[3]]);
if enableScissoring and (not wassc) then glEnable(GL_SCISSOR_TEST);
if wassc then glGetIntegerv(GL_SCISSOR_BOX, @scxywh[0]) else glGetIntegerv(GL_VIEWPORT, @scxywh[0]);
//conwritefln('(%d,%d)-(%d,%d)', [scxywh[0], scxywh[1], scxywh[2], scxywh[3]]);
if enableScissoring and (not wassc) then glEnable(GL_SCISSOR_TEST);