         ] do-attribs
     ] do-enabled ; inline
 
+: texture-dim ( texture -- dim )
+    [ dim>> ] [ image>> ] bi 2x?>> [ [ 2.0 / ] map ] when ;
+
 : (draw-textured-rect) ( dim texture -- )
     [ loc>> ]
     [ [ GL_TEXTURE_2D ] dip texture>> glBindTexture ]

    GL_COMPILE [
        [
            [ grid-has-alpha? [ GL_BLEND glDisable ] unless ]
            [ [ [ [ dim>> ] keep (draw-textured-rect) ] each ] each ]
            [ grid-has-alpha? [ GL_BLEND glEnable ] unless ] tri
            GL_TEXTURE_2D 0 glBindTexture
        ] with-texturing

    [ v* ] with map float-array{ } join ;

: make-texture-display-list ( texture -- dlist )
    GL_COMPILE [
        [ texture-dim ] keep draw-textured-rect
    ] make-dlist ;

: <single-texture> ( image loc -- texture )
    single-texture new-disposable
        swap >>loc
        swap [ >>image ] [ dim>> >>dim ] bi
    dup image>> dim>> product 0 = [
        dup texture-coords >>texture-coords
        dup image>> make-texture >>texture
