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();
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);
* 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
* 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
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;