I'm rendering some things in RenderWorldLastEvent and would like to have fog applied to them. However when I enable fog, it originates from vertex position instead of player position.
Here's my code:
Tessellator tess = Tessellator.getInstance();
BufferBuilder buffer = tess.getBuffer();
GlStateManager.pushMatrix();
RenderHelper.translateToZero();
GlStateManager.disableTexture2D();
GlStateManager.color(1, 0, 0);
GlStateManager.disableCull();
GlStateManager.enableFog();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
buffer.pos(0, 100, 0).endVertex();
buffer.pos(-1.1, 100, 0).endVertex();
buffer.pos(-100, 100, 0).endVertex();
buffer.pos(-101.1, 100, 0).endVertex();
tess.draw();
GlStateManager.disableFog();
GlStateManager.enableCull();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
And this is the translateToZero() method:
public static void translateToZero() {
Entity entity = mc.getRenderViewEntity();
float partialTicks = mc.getRenderPartialTicks();
GlStateManager.translate(
-(entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks),
-(entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks),
-(entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks)
);
}
Do I need to draw my quads in a different way? I've never done anything with OpenGL fog.