List of usage examples for org.lwjgl.opengl GL11 glDepthMask
public static void glDepthMask(@NativeType("GLboolean") boolean flag)
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); 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);// w w w. j a v a 2s . c o m 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 glDepthMask(boolean activate) { GL11.glDepthMask(activate); }
From source file:boilerplate.client.fx.FXRaygun.java
License:Minecraft Mod Public
@Override public void renderParticle(final Tessellator tessellator, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) { tessellator.draw();// w w w . j a va2s . c om GL11.glPushMatrix(); final float var9 = 1.0F; final float slide = this.worldObj.getWorldTime(); final float rot = ((this.worldObj.provider.getWorldTime() % (360 / this.rotationspeed)) * this.rotationspeed) + (this.rotationspeed * f); float size = 0.5F; if (this.pulse) { size = Math.min(this.particleAge / 4.0F, 1.0F); size = this.prevSize + ((size - this.prevSize) * f); } float op = 0.4F; if ((this.pulse) && ((this.particleMaxAge - this.particleAge) <= 4)) { op = 0.4F - ((4 - (this.particleMaxAge - this.particleAge)) * 0.1F); } switch (this.type) { default: // In case I make another type of beam, I can change the beam // texture here break; case 1: // and here... break; case 2: ClientHelper.textureManager().bindTexture(rayTex); } GL11.glTexParameterf(3553, 10242, 10497.0F); GL11.glTexParameterf(3553, 10243, 10497.0F); GL11.glDisable(2884); float var11 = slide + f; if (this.reverse) { var11 *= -1.0F; // why name your variables "var11"? That is so // un-helpful } final float var12 = (-var11 * 0.2F) - MathHelper.floor_float(-var11 * 0.1F); GL11.glEnable(3042); GL11.glBlendFunc(770, 1); GL11.glDepthMask(false); double prex = this.player.prevPosX; double prey = this.player.prevPosY + this.offset; double prez = this.player.prevPosZ; double px = this.player.posX; double py = this.player.posY + this.offset; double pz = this.player.posZ; prex -= MathHelper.cos((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.066F; prey -= 0.06D; prez -= MathHelper.sin((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.04F; Vec3 vec3d = this.player.getLook(1.0F); prex += vec3d.xCoord * 0.3D; prey += vec3d.yCoord * 0.3D; prez += vec3d.zCoord * 0.3D; px -= MathHelper.cos((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.066F; py -= 0.06D; pz -= MathHelper.sin((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.04F; vec3d = this.player.getLook(1.0F); px += vec3d.xCoord * 0.3D; py += vec3d.yCoord * 0.3D; pz += vec3d.zCoord * 0.3D; final float xx = (float) ((prex + ((px - prex) * f)) - EntityFX.interpPosX); final float yy = (float) ((prey + ((py - prey) * f)) - EntityFX.interpPosY); final float zz = (float) ((prez + ((pz - prez) * f)) - EntityFX.interpPosZ); GL11.glTranslated(xx, yy, zz); final float ry = this.prevYaw + ((this.rotYaw - this.prevYaw) * f); final float rp = this.prevPitch + ((this.rotPitch - this.prevPitch) * f); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(180.0F + ry, 0.0F, 0.0F, -1.0F); GL11.glRotatef(rp, 1.0F, 0.0F, 0.0F); final double var44 = -0.15D * size; final double var17 = 0.15D * size; final double var44b = -0.15D * size * this.endMod; final double var17b = 0.15D * size * this.endMod; GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F); for (int t = 0; t < 5; t++) { final double var29 = this.length * size * var9; final double var31 = 0.0D; final double var33 = 1.0D; final double var35 = -1.0F + var12 + (t / 3.0F); final double var37 = (this.length * size * var9) + var35; GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.setBrightness(200); tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, op); tessellator.addVertexWithUV(var44b, var29, 0.0D, var33, var37); tessellator.addVertexWithUV(var44, 0.0D, 0.0D, var33, var35); tessellator.addVertexWithUV(var17, 0.0D, 0.0D, var31, var35); tessellator.addVertexWithUV(var17b, var29, 0.0D, var31, var37); tessellator.draw(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthMask(true); GL11.glDisable(3042); GL11.glEnable(2884); GL11.glPopMatrix(); tessellator.startDrawingQuads(); this.prevSize = size; }
From source file:buildcraft.core.render.BlockHighlightHandler.java
License:Minecraft Mod Public
@SideOnly(Side.CLIENT) @SubscribeEvent// w ww . j ava2 s . c o m public void handleBlockHighlight(DrawBlockHighlightEvent e) { if (e.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = e.target.blockX; int y = e.target.blockY; int z = e.target.blockZ; Block block = e.player.worldObj.getBlock(x, y, z); if (block instanceof ICustomHighlight) { AxisAlignedBB[] aabbs = ((ICustomHighlight) block).getBoxes(e.player.worldObj, x, y, z, e.player); Vec3 pos = e.player.getPosition(e.partialTicks); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); double exp = ((ICustomHighlight) block).getExpansion(); for (AxisAlignedBB aabb : aabbs) { RenderGlobal.drawOutlinedBoundingBox(aabb.copy().expand(exp, exp, exp).offset(x, y, z) .offset(-pos.xCoord, -pos.yCoord, -pos.zCoord), -1); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); e.setCanceled(true); } } }
From source file:buildcraft.robots.render.RenderRobot.java
License:Minecraft Mod Public
private void doRenderRobot(float factor, TextureManager texManager) { box.render(factor);//from w w w . j a v a 2 s. c o m GL11.glPushMatrix(); texManager.bindTexture(overlay); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDepthMask(true); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 61680, 0); box.render(factor); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
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;// w w w. ja v a 2 s. com 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;/*from w w w. 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.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;//from w ww . j a va 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); 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;//from www .j a va 2 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); 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.burialservices.client.renderers.GraveRenderer.java
License:Open Source License
private void renderSign(double x, double y, double z, float tickTime, String[] signText, int meta, boolean renderingItem) { if (signText.length == 0) return;/*w w w . j ava2 s .c o m*/ int i = 0; for (String line : signText) if (!Strings.isNullOrEmpty(line)) { i++; } if (i == 0) return; GL11.glPushMatrix(); float f1 = 0.6666667F; GL11.glTranslatef((float) x + 0.5F, (float) y + 0.75F * f1, (float) z + 0.5F); float f2 = 0.0F; switch (meta) { case 0: break; case 1: f2 = 90f; break; case 2: f2 = 180f; break; case 3: f2 = -90f; } GL11.glTranslated(0, -0.3, 0); if (renderingItem) GL11.glTranslated(0, 0.03, 0); GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F); GL11.glTranslated(0, -1.2, 0); GL11.glTranslatef(0.0F, -0.3125F, -0.4375F); GL11.glTranslatef(0f, 0.8F, 0.5f); MODEL_SIGN.signStick.showModel = false; this.bindTexture(SIGN_TEXTURE); GL11.glPushMatrix(); GL11.glScalef(f1, -f1, -f1); MODEL_SIGN.renderSign(); GL11.glPopMatrix(); FontRenderer fontrenderer = this.getFontRenderer(); f2 = 0.016666668F * f1; GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1); GL11.glScalef(f2, -f2, f2); GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2); GL11.glDepthMask(false); byte b0 = 0; for (int j = 0; j < signText.length; ++j) { GL11.glPushMatrix(); String s = signText[j]; int width = fontrenderer.getStringWidth(s); if (width > 95) { float f = 1f - ((width) * 0.0015f); GL11.glScalef(f, f, f); } fontrenderer.drawString(s, -width / 2, j * 10 - 20, b0); GL11.glPopMatrix(); } GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }