X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fflexui%2Ffui_gfx_gl.pas;h=67ad97cf3ffe6f94424964d2fbc0e2fc14584ec9;hb=f4fc3b435118e5d9e4085da37014436d2e063259;hp=e29d9c1cd78e9d8d53e99e6656624c6c60500bef;hpb=e1c1f7de2d4d90cedb74704518844133b936ff97;p=d2df-sdl.git diff --git a/src/flexui/fui_gfx_gl.pas b/src/flexui/fui_gfx_gl.pas index e29d9c1..67ad97c 100644 --- a/src/flexui/fui_gfx_gl.pas +++ b/src/flexui/fui_gfx_gl.pas @@ -21,8 +21,13 @@ unit fui_gfx_gl; interface uses +{$IFDEF USE_NANOGL} + nanoGL, +{$ELSE} + GL, GLExt, +{$ENDIF} SysUtils, Classes, - GL, GLExt, SDL2, + SDL2, sdlcarcass, fui_common, fui_events; @@ -188,7 +193,9 @@ function isScaled (): Boolean; var mt: packed array [0..15] of Double; begin +{$IFNDEF USE_NANOGL} glGetDoublev(GL_MODELVIEW_MATRIX, @mt[0]); +{$ENDIF} result := (mt[0] <> 1.0) or (mt[1*4+1] <> 1.0); end; @@ -230,14 +237,18 @@ begin 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 +{$ENDIF} 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}); +{$ENDIF} glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_TEXTURE); glPopMatrix(); @@ -286,7 +297,9 @@ begin else begin // assume uniform scale +{$IFNDEF USE_NANOGL} glGetDoublev(GL_MODELVIEW_MATRIX, @mt[0]); +{$ENDIF} ctx.mScaled := (mt[0] <> 1.0) or (mt[1*4+1] <> 1.0); ctx.mScale := mt[0]; oglSetup2DState(); @@ -320,7 +333,11 @@ type procedure TScissorSave.save (enableScissoring: Boolean); begin +{$IFDEF USE_NANOGL} + wassc := false; // FIXIT +{$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);