<text-tile> ( line offset -- tile )


Vocabulary
ui.text.core-text.private

Inputs
linean object
offsetan object


Outputs
tilean object


Definition


:: <text-tile> ( line offset -- tile )
line render-ext>> :> ext ext offset v- text-tile-dim vmin
:> dim offset { 1 1 } v- { 0 0 } vmax
:> raster-offset offset dim v+ { 1 1 } v+ ext vmin
raster-offset v-
:> raster-dim line raster-offset raster-dim render-region
:> image offset raster-offset v- raster-dim v/
:> uv-loc dim raster-dim v/ :> uv-dim line loc>> offset v+
scale-dim dim scale-dim make-textured-quad-vertices
:> vertices 6 <iota> [| i |
i 4 * 2 + vertices
[ uv-dim first * uv-loc first + ] change-nth i 4 * 3 +
vertices [ uv-dim second * uv-loc second + ] change-nth
] each [
text-tile new-disposable |dispose image make-texture-gl3
>>texture create-gl3-vao >>vao create-gl3-vbo >>vbo
dup vao>> glBindVertexArray
dup vbo>> GL_ARRAY_BUFFER swap glBindBuffer
GL_ARRAY_BUFFER vertices [ byte-length ] keep
GL_STATIC_DRAW glBufferData
setup-texture-vertex-attributes
] with-destructors ;