Ok, I fixed the code, now it finally works.
I'll post it, just in case anybody needs it.
public static final double TWICE_PI = Math.PI*2;
private static Tessellator tessellator = Tessellator.getInstance();
private static WorldRenderer worldRenderer = tessellator.getWorldRenderer();
public static void drawRegularPolygon(double x, double y, int radius, int sides)
{
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
worldRenderer.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION);
worldRenderer.pos(x, y, 0).endVertex();
for(int i = 0; i <= sides ;i++)
{
double angle = (TWICE_PI * i / sides) + Math.toRadians(180);
worldRenderer.pos(x + Math.sin(angle) * radius, y + Math.cos(angle) * radius, 0).endVertex();
}
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
This will draw a regular polygon with <sides>sides. If you set it high enough, obviosly, you will get a circle.