This commit is contained in:
DBotThePony 2023-09-23 12:20:46 +07:00
parent 4a1a26a493
commit 1479f7483a
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -212,19 +212,23 @@ class Font(
model.translate(x = -lineWidth - movedX, y = lineHeight)
}
client.programs.font.use()
client.programs.font.colorMultiplier = color
client.programs.font.worldMatrix = client.stack.last()
builder.end()
builder.upload(vbo, ebo, GL_STREAM_DRAW)
if (builder.elementCount != 0) {
client.programs.font.use()
client.programs.font.colorMultiplier = color
client.programs.font.worldMatrix = client.stack.last()
client.activeTexture = 0
atlas.bind()
builder.upload(vbo, ebo, GL_STREAM_DRAW)
client.vao = vao
glDrawElements(GL_TRIANGLES, builder.indexCount, builder.indexType, 0L)
checkForGLError()
client.vao = null
client.activeTexture = 0
atlas.bind()
client.vao = vao
glDrawElements(GL_TRIANGLES, builder.indexCount, builder.indexType, 0L)
checkForGLError()
client.vao = null
}
return TextSize(totalX * scale, totalY * scale)
}
@ -261,10 +265,8 @@ class Font(
if (chr == '\t') {
if (lineGlyphs % 4 == 0) {
lineWidth += space.advanceX * 4
client.stack.last().translate(x = space.advanceX * 4)
} else {
lineWidth += space.advanceX * (lineGlyphs % 4)
client.stack.last().translate(x = space.advanceX * (lineGlyphs % 4))
}
lineGlyphs += lineGlyphs % 4