From f831e31e634a86c51f3c62ddcbd3d995b890b832 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Wed, 21 Feb 2018 21:40:53 +0300 Subject: [PATCH] Now nanoGL supports glIsEnabled, glPushAttrib and glPopAttrib --- src/flexui/fui_gfx_gl.pas | 8 -------- src/game/g_game.pas | 4 ---- src/lib/nanogl/nanoGL.pas | 5 ++++- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/flexui/fui_gfx_gl.pas b/src/flexui/fui_gfx_gl.pas index 93992fa..d386699 100644 --- a/src/flexui/fui_gfx_gl.pas +++ b/src/flexui/fui_gfx_gl.pas @@ -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); diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 3e4e022..0961896 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -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 diff --git a/src/lib/nanogl/nanoGL.pas b/src/lib/nanogl/nanoGL.pas index f16d060..47b783e 100644 --- a/src/lib/nanogl/nanoGL.pas +++ b/src/lib/nanogl/nanoGL.pas @@ -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; -- 2.29.2