I've been trying to work on something that requires me to draw directly to the screen.
I started with a simple test, drawing a red square at the corner of the screen with the Vertex buffer.
It works, but I've noticed some very strange behavior, whenever i press F1 to hide the GUI, the square i drew becomes about twice as small and looses all transparency. If i press F1 again to show the GUI again, it returns to normal.
is this a known thing that happens?
is there a workaround?
here is the code:
public class EventHandlerClient {
@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent event){
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexBuffer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.disableTexture2D();
vertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
vertexBuffer.pos(0f,100f,0f).color(1f,0f,0f,0.5f).endVertex();
vertexBuffer.pos(100f,100f,0f).color(1f,0f,0f,0.5f).endVertex();
vertexBuffer.pos(100f,0f,0f).color(1f,0f,0f,0.5f).endVertex();
vertexBuffer.pos(0f,0f,0f).color(1f,0f,0f,0.5f).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
}