Hello fellow modders, my name is maxpowa and you may be familiar with the mods that I work on; TukMC and more recently, AdvancedHUD. I'm having issues drawing the outline of a rectangle, rather than filling it completely. I think, but I'm not sure if the issue is simply me failing to understand OpenGL and the Minecraft Tessellator.
What I currently have, which is failing to draw an unfilled rectangle:
private static void drawOutlineRect(int x, int y, int x1, int y1, int color)
{
GL11.glPushMatrix();
float f = (float)(color >> 24 & 255) / 255.0F;
float f1 = (float)(color >> 16 & 255) / 255.0F;
float f2 = (float)(color >> 8 & 255) / 255.0F;
float f3 = (float)(color & 255) / 255.0F;
Tessellator tessellator = Tessellator.instance;
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(f1, f2, f3, f);
tessellator.startDrawing(GL11.GL_LINES);
tessellator.addVertex((double)x, (double)y, 0.0D);
tessellator.addVertex((double)x1, (double)y, 0.0D);
tessellator.addVertex((double)x1, (double)y1, 0.0D);
tessellator.addVertex((double)x, (double)y1, 0.0D);
tessellator.addVertex((double)x, (double)y, 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
Thanks in advance,
maxpowa