Jump to content

[1.8][SOLVED] FontRenderer not rendering in right time?


Recommended Posts

Posted

I am attempting to render progress bar and string in RenderGameOverlayEvent.Pre.

 

No matter where I put mc.fontRendererObj.drawString(...) it always renders under bar.

 

2dkn87n.jpg

 

mc.fontRendererObj.drawString(skillCast.getName(), xPos, yPos, 0xffffff);
	double progress = (double) ((float) skillCast.getCastProgress() / (float) skillCast.getCastTime());
	GuiHelper.drawOutlinedBox(xPos, yPos, (int) (progress * 100), 4, 1.0F, ClientReference.BOX_INNER_COLOR, ClientReference.BOX_INNER_COLOR);
	mc.fontRendererObj.drawString(skillCast.getName(), xPos, yPos, 0xffffff);

 

String is being rendered first and last - still is under bar.

 

Does FR has some totally separate rendering queue?

1.7.10 is no longer supported by forge, you are on your own.

Posted

public static void drawOutlinedBox(final int x, final int y, final int width, final int height, final float zLevel, final int color, final int outlineColor)
{
	GL11.glPushMatrix();
	drawSolidRect(x * 2 - 2, y * 2 - 2, (x + width) * 2 + 2, (y + height) * 2 + 2, zLevel, outlineColor);
	drawSolidRect(x * 2 - 1, y * 2 - 1, (x + width) * 2 + 1, (y + height) * 2 + 1, zLevel, color);
	GL11.glPopMatrix();
}

public static void drawSolidRect(final int x, final int y, final int width, final int height, final float zLevel, final int color)
{
	GL11.glPushMatrix();
	final Color color1 = new Color(color);
	final Tessellator tess = Tessellator.getInstance();
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	tess.getWorldRenderer().startDrawingQuads();
	tess.getWorldRenderer().setColorOpaque(color1.getRed(), color1.getGreen(), color1.getBlue());
	tess.getWorldRenderer().addVertex(x, height, zLevel);
	tess.getWorldRenderer().addVertex(width, height, zLevel);
	tess.getWorldRenderer().addVertex(width, y, zLevel);
	tess.getWorldRenderer().addVertex(x, y, zLevel);
	tess.draw();
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glPopMatrix();
}

 

Note: I am doing it totally for testing now, but can't find reason why it's rendering under.

1.7.10 is no longer supported by forge, you are on your own.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.