Skip to content

Commit

Permalink
fix?/workaround: #21
Browse files Browse the repository at this point in the history
  • Loading branch information
levovix0 committed Apr 6, 2024
1 parent ac8fdaf commit 2337289
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/render.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type
var
# contextStack*: seq[Context]
glyphTableStack*: seq[GlyphTable]
oneLoadTexture: Textures # workaround https://github.com/FolxTeam/folx/issues/21 until rendering will be completely refactored


template withGlyphTable*(x: GlyphTable, body) =
Expand Down Expand Up @@ -151,12 +152,13 @@ component Image:
glEnable(GlBlend)
glBlendFuncSeparate(GlOne, GlOneMinusSrcAlpha, GlOne, GlOne)

let tex = newTextures(1)
tex[0].loadTexture g
glBindTexture(GlTexture2d, tex[0])
if oneLoadTexture == nil:
oneLoadTexture = newTextures(1)
oneLoadTexture[0].loadTexture g
glBindTexture(GlTexture2d, oneLoadTexture[0])

use shader.shader
global_drawContext.passTransform(shader, pos=parentBox.xy, size=parentBox.wh)
global_drawContext.passTransform(shader, pos=parentBox.xy.ivec2.vec2, size=parentBox.wh)
shader.color.uniform = color.vec4
if clipStack.len > 0:
shader.clipRectXy.uniform = clipStack[^1].xy - parentBox.xy
Expand Down

0 comments on commit 2337289

Please sign in to comment.