List of usage examples for org.lwjgl.opengl GL11 glStencilMask
public static void glStencilMask(@NativeType("GLuint") int mask)
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void stencilMask(int mask) { GL11.glStencilMask(mask); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glStencilMask(int a) { GL11.glStencilMask(a); }
From source file:vazkii.botania.client.core.helper.RenderHelper.java
License:Open Source License
public static void renderProgressPie(int x, int y, float progress, ItemStack stack) { Minecraft mc = Minecraft.getMinecraft(); mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y); GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_STENCIL_TEST); GlStateManager.colorMask(false, false, false, false); GlStateManager.depthMask(false);/* ww w.j a va 2 s .c o m*/ GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF); GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP); GL11.glStencilMask(0xFF); mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y); mc.renderEngine.bindTexture(new ResourceLocation(LibResources.GUI_MANA_HUD)); int r = 10; int centerX = x + 8; int centerY = y + 8; int degs = (int) (360 * progress); float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F); GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.colorMask(true, true, true, true); GlStateManager.depthMask(true); GL11.glStencilMask(0x00); GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF); VertexBuffer buf = Tessellator.getInstance().getBuffer(); buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR); buf.pos(centerX, centerY, 0).color(0, 0.5F, 0.5F, a).endVertex(); for (int i = degs; i > 0; i--) { double rad = (i - 90) / 180F * Math.PI; buf.pos(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r, 0).color(0F, 1F, 0.5F, a).endVertex(); } buf.pos(centerX, centerY, 0).color(0F, 1F, 0.5F, a).endVertex(); Tessellator.getInstance().draw(); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_STENCIL_TEST); }
From source file:vazkii.psi.client.core.helper.PsiRenderHelper.java
public static void renderProgressPie(int x, int y, float progress, ItemStack stack) { Minecraft mc = Minecraft.getMinecraft(); mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y); GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_STENCIL_TEST); GlStateManager.colorMask(false, false, false, false); GlStateManager.depthMask(false);//from w w w . jav a 2 s . c o m GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF); GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP); GL11.glStencilMask(0xFF); mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x, y); int r = 10; int centerX = x + 8; int centerY = y + 8; int degs = (int) (360 * progress); float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F); GlStateManager.disableLighting(); GlStateManager.disableTexture2D(); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.colorMask(true, true, true, true); GlStateManager.depthMask(true); GL11.glStencilMask(0x00); GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GlStateManager.color(0F, 0.5F, 0.5F, a); GL11.glVertex2i(centerX, centerY); GlStateManager.color(0F, 1F, 0.5F, a); for (int i = degs; i > 0; i--) { double rad = (i - 90) / 180F * Math.PI; GL11.glVertex2d(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r); } GL11.glVertex2i(centerX, centerY); GL11.glEnd(); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_STENCIL_TEST); }
From source file:zsawyer.mods.stereoscopic3d.renderers.StencilingRenderer.java
License:Open Source License
protected void prepareStencilBuffer() { GL11.glDrawBuffer(GL11.GL_BACK);/* w ww .j a v a 2 s .c om*/ GL11.glEnable(GL11.GL_STENCIL_TEST); GL11.glStencilMask(0xff); GL11.glClearStencil(0); GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT);// | GL11.GL_COLOR_BUFFER_BIT // | GL11.GL_DEPTH_BUFFER_BIT); GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_REPLACE, GL11.GL_REPLACE); // to avoid interaction with stencil content GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0x01); }