Skip to content

Commit

Permalink
fix: opengl es related errors on weston
Browse files Browse the repository at this point in the history
  • Loading branch information
levovix0 committed Oct 22, 2024
1 parent 42efafa commit 8c0dcfa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/sigui/render/contexts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ macro makeShader*(ctx: DrawContext, body: untyped): auto =
frag: NimNode
uniforms: Table[string, NimNode]

var version: NimNode = newLit "330 core"
var version: NimNode = newLit "300 es"
var origBody = body
var body = body
if body.kind != nnkStmtList:
Expand Down
4 changes: 2 additions & 2 deletions src/sigui/render/text.nim
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ proc render(familyBuffer: var GlyphFamilyBuffer, placement: var GlyphPlacement,

glBindTexture(GlTexture2d, textureId)

let buffer = alloc0(ts * ts)
let buffer = alloc0(ts * ts * 4)

glTexImage2D(GlTexture2d, 0, GlR8.GLint, ts.GLsizei, ts.GLsizei, 0, GlRed, GlUnsignedByte, buffer)
glTexImage2D(GlTexture2d, 0, GlRgba.GLint, ts.GLsizei, ts.GLsizei, 0, GlRgba, GlUnsignedByte, buffer)
glGenerateMipmap(GlTexture2d)

glBindTexture(GlTexture2d, 0)
Expand Down
6 changes: 5 additions & 1 deletion src/sigui/uibase.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,7 @@ macro generateInitRedrawWhenPropertyChangedMethod(t: typed) =
registerReflection generateInitRedrawWhenPropertyChangedMethod, T is Uiobj and t != "Uiobj"


converter toColor*(s: string{lit}): chroma.Color =
proc toColor*(s: string): chroma.Color =
case s.len
of 3:
result = chroma.Color(
Expand Down Expand Up @@ -1924,3 +1924,7 @@ converter toColor*(s: string{lit}): chroma.Color =
)
else:
raise ValueError.newException("invalid color: " & s)


converter litToColor*(s: string{lit}): chroma.Color =
s.toColor
2 changes: 1 addition & 1 deletion tests/t_shaders.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ method draw*(this: ChessTiles, ctx: DrawContext) =
this.drawBefore(ctx)
if this.visibility == visible:
let shader = ctx.makeShader:
{.version: "330 core".}
{.version: "300 es".}

proc vert(
gl_Position: var Vec4,
Expand Down

0 comments on commit 8c0dcfa

Please sign in to comment.