This may sound like a trivial question: how should I draw lines "on top" of the terrain?
On top, as in, on a layer that's above the world so that they are visible whether they are underground or above ground.
I am quite new to modding and frankly have no idea how Minecraft renders its screen. All I managed to find out was it uses the Tessellator and WorldRenderer (which is a BufferBuilder) objects to draw things.
Currently, I'm using the same method as how Minecraft draws its block selection boxes (EXCEPT subscribed to the onWorldRenderFinish event instead of onDrawSelectionBox):
/* the vanilla wireframe box renderer: */
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
... // some functions to set up the vertices
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferbuilder = tessellator.getBuffer();
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
buffer.pos(minX, minY, minZ).color(red, green, blue, 0.0F).endVertex();
buffer.pos(minX, minY, minZ).color(red, green, blue, alpha).endVertex();
Tessellator.draw();
... // a long chain of vertices
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
I looked into the BufferBuilder class and it seems to create "ByteBuffers" which contain chains of vertices and their color. As for how the Tessellator or WorldRenderer actually draws it, I have no clue.
I don't think the GlStateManager has anything to do with my issue, as it's mostly just for compositing already rendered images together.
Please give some pointers or links to helpful documents.