DEADSOFTWARE

Now nanoGL supports glIsEnabled, glPushAttrib and glPopAttrib
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 21 Feb 2018 18:40:53 +0000 (21:40 +0300)
committerKetmar Dark <ketmar@ketmar.no-ip.org>
Sat, 17 Mar 2018 00:04:27 +0000 (02:04 +0200)
src/flexui/fui_gfx_gl.pas
src/game/g_game.pas
src/lib/nanogl/nanoGL.pas

index 93992faeacfc65ffa435b00b200c54d9dc133269..d38669972b47769f7e56636a87ac0d648fcd4680 100644 (file)
@@ -235,18 +235,14 @@ begin
   glMatrixMode(GL_MODELVIEW); glPushMatrix();
   glMatrixMode(GL_TEXTURE); glPushMatrix();
   glMatrixMode(GL_COLOR); glPushMatrix();
-{$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;
 end;
 
 procedure TSavedGLState.restore ();
 begin
   if (not saved) then raise Exception.Create('cannot restore unsaved OpenGL state');
-{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glPopAttrib
   glPopAttrib({GL_ENABLE_BIT});
-{$ENDIF}
   glMatrixMode(GL_PROJECTION); glPopMatrix();
   glMatrixMode(GL_MODELVIEW); glPopMatrix();
   glMatrixMode(GL_TEXTURE); glPopMatrix();
@@ -329,11 +325,7 @@ type
 
 procedure TScissorSave.save (enableScissoring: Boolean);
 begin
-{$IFDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glIsEnabled
-  wassc := false;
-{$ELSE}
   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);
index 3e4e0221fb917c86e9261bb23b13f50d64ed7f6a..09618966963e2bbe2cc06dd55eedf42e0ad0127d 100644 (file)
@@ -3007,11 +3007,7 @@ begin
    *     glBlendFunc(GL_DST_ALPHA, GL_ONE);
    *     draw all geometry up to and including walls (with alpha-testing, probably) -- this does lighting
    *)
-{$IFDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glIsEnabled
-  wassc := false;
-{$ELSE}
   wassc := (glIsEnabled(GL_SCISSOR_TEST) <> 0);
-{$ENDIF}
   if wassc then glGetIntegerv(GL_SCISSOR_BOX, @scxywh[0]) else glGetIntegerv(GL_VIEWPORT, @scxywh[0]);
 
   // setup OpenGL parameters
index f16d060d6dc4399f1f2519bdb3548617db863231..47b783e53cfea591a3f3f75d42baa038b7a65634 100644 (file)
@@ -17,7 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *)
 
-(* Sources: https://github.com/FWGS/nanogl *)
+(* Sources: https://github.com/DeaDDooMER/nanogl *)
 unit nanoGL;
 
 interface
@@ -752,6 +752,9 @@ procedure glGenBuffersARB(count: Gluint; indexes: PGLuint); cdecl; external nano
 procedure glDeleteBuffersARB(count: GLuint; indexes: PGLuint); cdecl; external nanoGL_LibName;
 procedure glBufferDataARB(target: GLuint; size: GLuint; buffer: PGLvoid; _type: GLuint); cdecl; external nanoGL_LibName;
 procedure glBufferSubDataARB(target: GLuint; offset: GLsizei; size: GLsizei; buffer: PGLvoid); cdecl; external nanoGL_LibName;
+function  glIsEnabled(cap: GLenum): GLboolean; external nanoGL_LibName;
+procedure glPushAttrib(mask: GLbitfield); external nanoGL_LibName;
+procedure glPopAttrib; external nanoGL_LibName;
 
 function nanoGL_Init(): CInt; cdecl; external nanoGL_LibName;
 procedure nanoGL_Destroy; cdecl; external nanoGL_LibName;