Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GlStateManager.pushMatrix();
- GlStateManager.pushAttrib();
- // Clear the stencil buffer
- GL11.glClearStencil(0);
- GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);
- GL11.glEnable(GL11.GL_STENCIL_TEST);
- GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_REPLACE, GL11.GL_REPLACE);
- GL11.glStencilFunc(GL11.GL_ALWAYS, 1, -1); // 1 is written into the buffer when we draw
- // Enable color mask
- glColorMask(true, true, true, true);
- GL11.glColor3f(255, 255, 255);
- Gui.drawRect(screen.getScaledWidth() / 2 - 40, screen.getScaledHeight() / 2 - 40, screen.getScaledWidth() / 2 + 40, screen.getScaledHeight() / 2 + 40, new Color(210, 100, 80).getRGB());
- // Disable color mask
- glColorMask(false, false, false, false);
- // Something something makes the fucking thing work (except it's not working)
- GL11.glStencilFunc(GL11.GL_NOTEQUAL, 1, -1); // Only draw if not equal to 1
- GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP);
- GL11.glColor3f(255, 255, 255);
- drawRect(0, 0, width, height, -1);
- // Disable color mask again(?)
- glColorMask(false, false, false, false);
- GlStateManager.popAttrib();
- GlStateManager.popMatrix();
Add Comment
Please, Sign In to add comment