@Override
public void drawTextBox() {
if (this.getVisible()) {
// trimmed: create x and y variables & draw border/background of textfield
// border/background drawn with GlStateManager and WorldRenderer
// stencil code I found online
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
glColorMask(false, false, false, false);
glDepthMask(false);
glStencilFunc(GL_NEVER, 1, 0xFF);
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); // draw 1s on test fail (always)
// draw stencil pattern
glStencilMask(0xFF);
glClear(GL_STENCIL_BUFFER_BIT); // needs mask=0xFF
// X1 is just inside the left border
// X4 is just inside the right border
// Y1 is just inside the top border
// Y4 is just inside the bottom border
glBegin(GL_QUADS);
glVertex3f(x4, y4, 0.0f);
glVertex3f(x4, y1, 0.0f);
glVertex3f(x1, y1, 0.0f);
glVertex3f(x1, y4, 0.0f);
glEnd();
glColorMask(true, true, true, true);
glDepthMask(true);
glStencilMask(0x00);
// draw where stencil's value is 0
glStencilFunc(GL_EQUAL, 0, 0xFF);
/* (nothing to draw) */
// draw only where stencil's value is 1
glStencilFunc(GL_EQUAL, 1, 0xFF);
//offset drawing location of text
GlStateManager.translate(-colViewOffset, -lineViewOffset * 10, 0.0);
// main drawtext
int xOff = hShadow ? 10 : 0;
for (int lin = lineViewOffset; lin < lineViewOffset + height / 10 && lin < lines.size(); lin++) {
fontRenderer.drawString(lines.get(lin), x, y + (lin) * 10, getEnabled() ? 0xE0E0E0 : 0x707070);
}
// draw text under vertical shadows
if (vShadow) {
if (lineViewOffset - 1 >= 0) {
fontRenderer.drawString(lines.get(lineViewOffset - 1), x, y + lineViewOffset * 10 - 10, getEnabled() ? 0xE0E0E0 : 0x707070);
}
if (lineViewOffset + height / 10 < lines.size()) {
fontRenderer.drawString(lines.get(lineViewOffset + height / 10), x, y + height + lineViewOffset * 10, getEnabled() ? 0xE0E0E0 : 0x707070);
}
}
// trimmed: draw cursor
GlStateManager.translate(colViewOffset, lineViewOffset * 10, 0.0);
// disable stencils
glDisable(GL_STENCIL_TEST);
// trimmed: draw bordershadows
// bordershadows drawn with GlStateManager and WorldRenderer
}
}
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user