mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Pushing all attribs in font renderer, let's see if this helps...
Also no tessellator in another display list.
This commit is contained in:
parent
5e365572eb
commit
84a6aa18d7
@ -64,7 +64,7 @@ object MonospaceFontRenderer {
|
||||
else
|
||||
textureManager.bindTexture(Textures.fontAliased)
|
||||
GL11.glPushMatrix()
|
||||
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_TEXTURE_BIT)
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS)
|
||||
|
||||
GL11.glTranslatef(x, y, 0)
|
||||
GL11.glScalef(0.5f, 0.5f, 1)
|
||||
@ -110,31 +110,29 @@ object MonospaceFontRenderer {
|
||||
case i => i
|
||||
})
|
||||
if (col != cfg) {
|
||||
// Color changed, force flush and adjust colors.
|
||||
// Color changed.
|
||||
cfg = col
|
||||
GL11.glColor3ub(
|
||||
((cfg & 0xFF0000) >> 16).toByte,
|
||||
((cfg & 0x00FF00) >> 8).toByte,
|
||||
((cfg & 0x0000FF) >> 0).toByte)
|
||||
}
|
||||
{
|
||||
if (index != ' ') {
|
||||
// Don't render whitespace.
|
||||
val x = (index - 1) % cols
|
||||
val y = (index - 1) / cols
|
||||
val u = x * uStep
|
||||
val v = y * vStep
|
||||
GL11.glTexCoord2d(u, v + vSize)
|
||||
GL11.glVertex3d(posX - dw, charHeight * s, 0)
|
||||
GL11.glTexCoord2d(u + uSize, v + vSize)
|
||||
GL11.glVertex3d(posX + charWidth * s, charHeight * s, 0)
|
||||
GL11.glTexCoord2d(u + uSize, v)
|
||||
GL11.glVertex3d(posX + charWidth * s, -dh, 0)
|
||||
GL11.glTexCoord2d(u, v)
|
||||
GL11.glVertex3d(posX - dw, -dh, 0)
|
||||
}
|
||||
posX += charWidth
|
||||
if (ch != ' ') {
|
||||
// Don't render whitespace.
|
||||
val x = (index - 1) % cols
|
||||
val y = (index - 1) / cols
|
||||
val u = x * uStep
|
||||
val v = y * vStep
|
||||
GL11.glTexCoord2d(u, v + vSize)
|
||||
GL11.glVertex3d(posX - dw, charHeight * s, 0)
|
||||
GL11.glTexCoord2d(u + uSize, v + vSize)
|
||||
GL11.glVertex3d(posX + charWidth * s, charHeight * s, 0)
|
||||
GL11.glTexCoord2d(u + uSize, v)
|
||||
GL11.glVertex3d(posX + charWidth * s, -dh, 0)
|
||||
GL11.glTexCoord2d(u, v)
|
||||
GL11.glVertex3d(posX - dw, -dh, 0)
|
||||
}
|
||||
posX += charWidth
|
||||
}
|
||||
GL11.glEnd()
|
||||
|
||||
|
@ -27,6 +27,8 @@ object BufferRenderer {
|
||||
|
||||
def compileBackground(bufferWidth: Int, bufferHeight: Int) =
|
||||
if (textureManager.isDefined) {
|
||||
RenderState.checkError(getClass.getName + ".compileBackground: entering (aka: wasntme)")
|
||||
|
||||
val innerWidth = innerMargin * 2 + bufferWidth
|
||||
val innerHeight = innerMargin * 2 + bufferHeight
|
||||
|
||||
@ -34,6 +36,8 @@ object BufferRenderer {
|
||||
|
||||
textureManager.get.bindTexture(Textures.guiBorders)
|
||||
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
|
||||
// Top border (left corner, middle bar, right corner).
|
||||
drawBorder(
|
||||
0, 0, margin, margin,
|
||||
@ -67,7 +71,11 @@ object BufferRenderer {
|
||||
margin + innerWidth, margin + innerHeight, margin, margin,
|
||||
8, 8, 15, 15)
|
||||
|
||||
GL11.glEnd()
|
||||
|
||||
GL11.glEndList()
|
||||
|
||||
RenderState.checkError(getClass.getName + ".compileBackground: leaving")
|
||||
}
|
||||
|
||||
def drawBackground() =
|
||||
@ -90,12 +98,13 @@ object BufferRenderer {
|
||||
val u2d = u2 / 16.0
|
||||
val v1d = v1 / 16.0
|
||||
val v2d = v2 / 16.0
|
||||
val t = Tessellator.instance
|
||||
t.startDrawingQuads()
|
||||
t.addVertexWithUV(x, y + h, 0, u1d, v2d)
|
||||
t.addVertexWithUV(x + w, y + h, 0, u2d, v2d)
|
||||
t.addVertexWithUV(x + w, y, 0, u2d, v1d)
|
||||
t.addVertexWithUV(x, y, 0, u1d, v1d)
|
||||
t.draw()
|
||||
GL11.glTexCoord2d(u1d, v2d)
|
||||
GL11.glVertex3d(x, y + h, 0)
|
||||
GL11.glTexCoord2d(u2d, v2d)
|
||||
GL11.glVertex3d(x + w, y + h, 0)
|
||||
GL11.glTexCoord2d(u2d, v1d)
|
||||
GL11.glVertex3d(x + w, y, 0)
|
||||
GL11.glTexCoord2d(u1d, v1d)
|
||||
GL11.glVertex3d(x, y, 0)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user