I am trying to render a texture as an overlay over the inventory screen - the texture has transparency, but what is drawn in game does not.
My render code utilizes DrawScreenEvent.Post, something along the lines of this:
@SubscribeEvent
public static void onPostDrawOverlay(DrawScreenEvent.Post event){
... // do some checks to see if the inventory screen is open
RenderSystem.disableDepthTest();
RenderSystem.depthMask(false);
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.7f); // I set the opacity of the draw here
RenderSystem.setShaderTexture(0, RESOURCE_LOCATION);
// Do scaling
double scaledWidth = ...;
double scaledHeight = ...;
// Do a blit
BufferBuilder builder = tesselator.getBuilder();
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
builder.vertex(0.0D, scaledHeight, -90.0D).uv(0.0F, 1.0F).endVertex();
builder.vertex(scaledWidth, scaledHeight, -90.0D).uv(1.0F, 1.0F).endVertex();
builder.vertex(scaledWidth, 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex();
builder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex();
tesselator.end();
RenderSystem.depthMask(true);
RenderSystem.enableDepthTest();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
}
I previously tried the exact same code within the render function of IIngameOverlay, where the opacity rendered as expected. (I didn't use IIngameOverlay because that renders below the inventory)
Is there an extra step that I am missing?