List of usage examples for org.lwjgl.opengl GL11 glDepthFunc
public static void glDepthFunc(@NativeType("GLenum") int func)
From source file:advancedbrewing.renderer.ItemGlintOverlayRenderer.java
License:Minecraft Mod Public
private void renderItem3D(ItemRenderType type, ItemStack itemStack, Object... data) { TextureManager renderEngine = FMLClientHandler.instance().getClient().renderEngine; Tessellator tessellator = Tessellator.instance; if (this.shouldRenderOverlay(itemStack)) { // render colored overlay renderEngine.bindTexture(renderEngine.getResourceLocation(itemStack.getItemSpriteNumber())); this.setColorByItemStack(itemStack); Icon icon = this.getIcon(itemStack, 0); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); // render glint if (itemStack.hasEffect(0)) { renderEngine.bindTexture(ItemGlintOverlayRenderer.RES_ITEM_GLINT); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); // first pass GL11.glPushMatrix();// ww w .j ava2 s.c o m GL11.glScalef(0.125F, 0.125F, 0.125F); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); // second pass GL11.glPushMatrix(); GL11.glScalef(0.125F, 0.125F, 0.125F); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } // render uncolored icon renderEngine.bindTexture(renderEngine.getResourceLocation(itemStack.getItemSpriteNumber())); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Icon icon = this.getIcon(itemStack, 1); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); }
From source file:advancedbrewing.renderer.ItemGlintOverlayRenderer.java
License:Minecraft Mod Public
private void renderItem2D(ItemRenderType type, ItemStack itemStack, Object... data) { TextureManager renderEngine = FMLClientHandler.instance().getClient().renderEngine; Tessellator tessellator = Tessellator.instance; if (this.shouldRenderOverlay(itemStack)) { // render colored overlay renderEngine.bindTexture(renderEngine.getResourceLocation(itemStack.getItemSpriteNumber())); this.setColorByItemStack(itemStack); Icon icon = this.getIcon(itemStack, 0); ItemGlintOverlayRenderer.RENDERITEM.renderIcon(0, 0, icon, 16, 16); // render glint if (itemStack.hasEffect(0)) { renderEngine.bindTexture(ItemGlintOverlayRenderer.RES_ITEM_GLINT); GL11.glDepthFunc(GL11.GL_GREATER); GL11.glDepthMask(false);// w w w . j av a2 s . com GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); // first pass float f2 = Minecraft.getSystemTime() % 3000L / 3000.0F * 256.0F; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-2, -2 + 20, -50.0F, (f2 + 20 * 4.0F) * 0.00390625F, 20 * 0.00390625F); tessellator.addVertexWithUV(-2 + 20, -2 + 20, -50.0F, (f2 + 20 + 20 * 4.0F) * 0.00390625F, 20 * 0.00390625F); tessellator.addVertexWithUV(-2 + 20, -2, -50.0F, (f2 + 20) * 0.00390625F, 0); tessellator.addVertexWithUV(-2, -2, -50.0F, (f2) * 0.00390625F, 0); tessellator.draw(); // second pass f2 = Minecraft.getSystemTime() % 4873L / 4873.0F * 256.0F; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-2, -2 + 20, -50.0F, (f2 + 20 * -1.0F) * 0.00390625F, 20 * 0.00390625F); tessellator.addVertexWithUV(-2 + 20, -2 + 20, -50.0F, (f2 + 20 + 20 * -1.0F) * 0.00390625F, 20 * 0.00390625F); tessellator.addVertexWithUV(-2 + 20, -2, -50.0F, (f2 + 20) * 0.00390625F, 0); tessellator.addVertexWithUV(-2, -2, -50.0F, (f2) * 0.00390625F, 0); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); } } // render uncolored icon renderEngine.bindTexture(renderEngine.getResourceLocation(itemStack.getItemSpriteNumber())); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Icon icon = this.getIcon(itemStack, 1); ItemGlintOverlayRenderer.RENDERITEM.renderIcon(0, 0, icon, 16, 16); }
From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java
License:Apache License
/** * {@inheritDoc} */ @Override public void glDepthFunc(int mode) { GL11.glDepthFunc(mode); }
From source file:buildcraftAdditions.client.render.BucketItemRenderer.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type, boolean flip) { if (mask == null || subIcon == null) return;//from w w w. j a v a2 s . c o m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001, flip); else preRenderWorldIcon(mask, 0.001, flip); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635, flip); else preRenderWorldIcon(mask, -0.0635, flip); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_BLOCK_SHEET); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001, flip); else preRenderWorldIcon(subIcon, 0.001, flip); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635, flip); else preRenderWorldIcon(subIcon, -0.0635, flip); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1, 1, 1, 1); }
From source file:buildcraftAdditions.client.render.CanisterItemRender.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) { if (mask == null || subIcon == null) return;/*w ww.ja v a 2s .co m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001D); else preRenderWorldIcon(mask, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635D); else preRenderWorldIcon(mask, -0.0635D); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(BLOCK_TEXTURE); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001D); else preRenderWorldIcon(subIcon, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635D); else preRenderWorldIcon(subIcon, -0.0635D); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:buildcraftAdditions.client.render.items.CanisterItemRender.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) { if (mask == null || subIcon == null) return;/* w w w .ja v a 2s .c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001); else preRenderWorldIcon(mask, 0.001); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635); else preRenderWorldIcon(mask, -0.0635); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_BLOCK_SHEET); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001); else preRenderWorldIcon(subIcon, 0.001); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635); else preRenderWorldIcon(subIcon, -0.0635); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1, 1, 1, 1); }
From source file:buildcraftAdditions.client.render.KineticToolItemRender.java
License:GNU General Public License
private void renderMask(IIcon mask, IIcon subIcon, ItemRenderType type) { if (mask == null || subIcon == null) return;/*www. ja v a2s .co m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, 0.001D); else preRenderWorldIcon(mask, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(mask, -0.0635D); else preRenderWorldIcon(mask, -0.0635D); tessellator.draw(); Minecraft.getMinecraft().renderEngine.bindTexture(BLOCK_TEXTURE); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, 0.001D); else preRenderWorldIcon(subIcon, 0.001D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); if (type.equals(ItemRenderType.INVENTORY)) preRenderInvIcon(subIcon, -0.0635D); else preRenderWorldIcon(subIcon, -0.0635D); tessellator.draw(); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); }
From source file:ccm.placeableTools.client.ToolRenderer.java
License:Open Source License
public static void doRenderPass(int i, int meta, ItemStack stack, double x, double y, double z) { Icon icon = stack.getItem().getIcon(stack, i); if (icon == null) return;/*from w w w . ja va 2 s . co m*/ GL11.glPushMatrix(); TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager(); texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber())); Tessellator tessellator = Tessellator.instance; GL11.glTranslated(x, y, z); //Center to block GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-0.5f, .5f, 0.5f); // Center on block if (stack.getItem() instanceof ItemSpade || stack.getItem() instanceof ItemHoe) { float shift = 0.3f; switch (ForgeDirection.values()[meta]) { case NORTH: GL11.glTranslatef(0, 0, -shift); GL11.glRotatef(15f, -0.5f, 0, 0); break; case SOUTH: GL11.glTranslatef(0, 0, shift); GL11.glRotatef(-15f, -0.5f, 0, 0); break; case EAST: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); GL11.glTranslatef(0, 0, shift); GL11.glRotatef(-15f, -0.5f, 0, 0); break; case WEST: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); GL11.glTranslatef(0, 0, -shift); GL11.glRotatef(15f, -0.5f, 0, 0); break; case DOWN: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); break; } GL11.glTranslatef(0, 0, -0.03f); //Icon depth of the shovel GL11.glRotatef(180f, 1, 0, 0); } else if (stack.getItem() instanceof ItemAxe || stack.getItem() instanceof ItemPickaxe) { float shift = 0.15f; switch (ForgeDirection.values()[meta]) { case NORTH: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(-1, 0, 1); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; case SOUTH: GL11.glRotatef(-90f, 0, 1, 0); GL11.glTranslatef(-1, 0, -1); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; case EAST: GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; case WEST: GL11.glRotatef(180f, 0, 1, 0); GL11.glTranslatef(-2, 0, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-10f, 0, 0, 1); break; } GL11.glTranslatef(0, 0, 0.03F); } else if (stack.getItem() instanceof ItemSword) { float shift = 0.15f; switch (ForgeDirection.values()[meta]) { case NORTH: GL11.glRotatef(90f, 0, 1, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); GL11.glTranslatef(-1, 0, 1); break; case SOUTH: GL11.glRotatef(-90f, 0, 1, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); GL11.glTranslatef(-1, 0, -1); break; case EAST: GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); GL11.glTranslatef(-1, 1, 0); break; case WEST: GL11.glRotatef(180f, 0, 1, 0); GL11.glTranslatef(-1, 1, 0); GL11.glTranslatef(shift, 0, 0); GL11.glRotatef(-90f, 0, 0, 1); break; case UP: GL11.glRotatef(180f, 1, 0, 0); GL11.glTranslatef(1, 0, 1); GL11.glRotatef(90f, 0, 1, 0); break; case DOWN: GL11.glRotatef(180f, 1, 0, 0); break; } GL11.glTranslatef(-0.05f, 0, 0.03F); } GL11.glRotatef(-45f, 0, 0, 1); GL11.glScalef(1.5f, 1.5f, 1.5f); ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.06F / 1.5f); if (stack.hasEffect(i)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); texturemanager.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.06F / 1.5f); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:cn.academy.core.client.gui.dev.PageMain.java
License:Open Source License
private void drawPlayer() { EntityPlayer player = dev.user;//from www . j av a 2s. c o m RenderUtils.loadTexture(RenderUtils.STEVE_TEXTURE); float x = 100, y = 100, scale = 2.1F; GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glPushMatrix(); { GL11.glTranslatef(183, 58, 100F); GL11.glScalef((-scale), scale, scale); GL11.glRotated(-25, 1, 0, 0); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(Minecraft.getSystemTime() / 100F, 0F, 1F, 0F); //Rotate around Y model.render(player, 0, 0, 0, 0, 0, 1F); } GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glDepthFunc(GL11.GL_ALWAYS); }
From source file:cn.academy.core.client.render.SkillRenderManager.java
License:Open Source License
@SubscribeEvent public void renderHudEvent(RenderGameOverlayEvent e) { ScaledResolution sr = e.resolution;//from w w w.j ava2s. co m EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (e.type != ElementType.CROSSHAIRS) return; GL11.glDepthFunc(GL11.GL_ALWAYS); long time = Minecraft.getSystemTime(); for (RenderNode node : renderers) { node.render.renderHud(player, sr, time - node.createTime); } RenderUtils.loadTexture(WIDGITS); GL11.glDepthFunc(GL11.GL_LEQUAL); }