diff --git a/basis/opengl/opengl-docs.factor b/basis/opengl/opengl-docs.factor index f474c97b73..b773833280 100644 --- a/basis/opengl/opengl-docs.factor +++ b/basis/opengl/opengl-docs.factor @@ -15,8 +15,8 @@ HELP: do-enabled { $description "Wraps a quotation in " { $link glEnable } "/" { $link glDisable } " calls." } ; HELP: do-matrix -{ $values { "mode" { $link GL_MODELVIEW } " or " { $link GL_PROJECTION } } { "quot" quotation } } -{ $description "Saves and restores the matrix specified by " { $snippet "mode" } " before and after calling the quotation." } ; +{ $values { "quot" quotation } } +{ $description "Saves and restores the current matrix before and after calling the quotation." } ; HELP: gl-line { $values { "a" "a pair of integers" } { "b" "a pair of integers" } } diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index 0a21f67376..c60917b42a 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -44,9 +44,8 @@ MACRO: all-enabled ( seq quot -- ) MACRO: all-enabled-client-state ( seq quot -- ) [ words>values ] dip '[ _ _ (all-enabled-client-state) ] ; -: do-matrix ( mode quot -- ) - swap [ glMatrixMode glPushMatrix call ] keep - glMatrixMode glPopMatrix ; inline +: do-matrix ( quot -- ) + glPushMatrix call glPopMatrix ; inline : gl-material ( face pname params -- ) float-array{ } like glMaterialfv ; @@ -165,7 +164,7 @@ MACRO: set-draw-buffers ( buffers -- ) : delete-dlist ( id -- ) 1 glDeleteLists ; : with-translation ( loc quot -- ) - GL_MODELVIEW [ [ gl-translate ] dip call ] do-matrix ; inline + [ [ gl-translate ] dip call ] do-matrix ; inline : fix-coordinates ( point1 point2 -- x1 y2 x2 y2 ) [ first2 [ >fixnum ] bi@ ] bi@ ; @@ -177,6 +176,7 @@ MACRO: set-draw-buffers ( buffers -- ) fix-coordinates glViewport ; : init-matrices ( -- ) + #! Leaves with matrix mode GL_MODELVIEW GL_PROJECTION glMatrixMode glLoadIdentity GL_MODELVIEW glMatrixMode diff --git a/basis/ui/text/text.factor b/basis/ui/text/text.factor index d787fe8ea9..2edb20fc22 100755 --- a/basis/ui/text/text.factor +++ b/basis/ui/text/text.factor @@ -66,7 +66,7 @@ M: string draw-text draw-string ; M: selection draw-text draw-string ; M: array draw-text - GL_MODELVIEW [ + [ [ [ draw-string ] [ [ 0.0 ] 2dip string-height 0.0 glTranslated ] 2bi