List of usage examples for org.lwjgl.opengl GL11 glDepthMask
public static void glDepthMask(@NativeType("GLboolean") boolean flag)
From source file:src.graphics.sfx.SFX.java
License:Open Source License
protected void renderTex(Vec3D[] verts, Texture tex) { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity();// w ww .jav a2 s. c o m tex.bindTex(); Vec3D v; GL11.glDepthMask(false); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); v = verts[0]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glTexCoord2f(0, 1); v = verts[1]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glTexCoord2f(1, 1); v = verts[2]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glTexCoord2f(1, 0); v = verts[3]; GL11.glVertex3f(v.x, v.y, v.z); GL11.glEnd(); GL11.glDepthMask(true); }
From source file:src.graphics.terrain.TerrainMesh.java
License:Open Source License
public void renderTo(Rendering rendering) { if (textures == null) I.complain("TEXTURE NOT ASSIGNED"); if (numFacets == 0) return;/* ww w . j a v a 2s .c o m*/ final Texture tex = textures[(int) animFrame]; if (tex == null) return; GL11.glDepthMask(false); textures[(int) animFrame].bindTex(); super.renderTo(rendering); if (textures.length > 1) { Texture nextTex = textures[(int) (animFrame + 1) % textures.length]; float opacity = animFrame - (int) animFrame; final Colour c = colour == null ? Colour.WHITE : colour; GL11.glColor4f(c.r, c.g, c.b, c.a * opacity); nextTex.bindTex(); render(1, 0, null, vertBuffer, normBuffer, textBuffer, numFacets); } GL11.glDepthMask(true); }
From source file:steamcraft.client.renderers.entity.RenderGhostSpider.java
License:Minecraft Mod Public
protected int shouldRenderPass(EntitySpider p_77032_1_, int p_77032_2_, float p_77032_3_) { if (p_77032_2_ != 0) { return -1; } else {/* w ww . j a v a 2s .c om*/ this.bindTexture(spiderEyesTextures); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); if (p_77032_1_.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); return 1; } }
From source file:steamcraft.client.renderers.tile.TileCastIronLampRenderer.java
License:Minecraft Mod Public
@Override public void renderTileEntityAt(TileEntity te, double dx, double dy, double dz, float scale) { Block block = te.getBlockType();/*w ww . j av a 2 s . c om*/ int metadata = te.getBlockMetadata(); GL11.glPushMatrix(); float f1 = 0.6666667F; float f2 = 0.0F; if ((metadata == 1) || (metadata == 4)) { f2 = 180F; } if (metadata == 2) { f2 = 90F; } if (metadata == 3) { f2 = -90F; } GL11.glTranslatef((float) dx + 0.5F, (float) dy + (0.75F * f1), (float) dz + 0.5F); GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(0.0F, -0.3125F, -0.4375F); if ((block == InitBlocks.blockCastIronLampOn) || (block == InitBlocks.blockInvertedCastIronLamp)) { ClientHelper.textureManager().bindTexture(lampOn); } else if ((block == InitBlocks.blockCastIronLamp) || (block == InitBlocks.blockInvertedCastIronLampOff)) { ClientHelper.textureManager().bindTexture(lampOff); } GL11.glPushMatrix(); GL11.glScalef(f1, -f1, -f1); if ((metadata == 0) || (metadata == 1)) { this.lampModelTop.renderLamp(); } else { this.lampModelSide.renderLamp(); this.lampModelSide.bracket.showModel = true; this.lampModelSide.bracket2.showModel = true; } GL11.glPopMatrix(); float f4 = 0.01666667F * f1; GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1); GL11.glScalef(f4, -f4, f4); GL11.glNormal3f(0.0F, 0.0F, -1F * f4); GL11.glDepthMask(false); GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:steamcraft.common.items.armor.ItemBrassGoggles.java
License:Minecraft Mod Public
@Override @SideOnly(Side.CLIENT)/* w w w .j av a 2 s. c om*/ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution, float partialTicks, boolean hasScreen, int mouseX, int mouseY) { if ((ClientHelper.player() == null) || (ClientHelper.screen() != null)) return; ItemStack helmet = ClientHelper.player().inventory.armorItemInSlot(3); if ((ClientHelper.settings().thirdPersonView == 0) && (helmet != null) && (helmet.getItem() == InitItems.itemBrassGoggles)) { ClientHelper.textureManager().bindTexture(overlay); Tessellator tessellator = Tessellator.instance; ScaledResolution scaledResolution = ClientHelper.resolution(); int width = scaledResolution.getScaledWidth(); int height = scaledResolution.getScaledHeight(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glClearDepth(1.0D); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, height, 90.0D, 0.0D, 1.0D); tessellator.addVertexWithUV(width, height, 90.0D, 1.0D, 1.0D); tessellator.addVertexWithUV(width, 0.0D, 90.0D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); } }
From source file:steamcraft.common.items.armor.ItemDivingHelmet.java
License:Minecraft Mod Public
@Override @SideOnly(Side.CLIENT)//from www .ja v a2 s . c o m public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution, float partialTicks, boolean hasScreen, int mouseX, int mouseY) { if ((ClientHelper.player() == null) || (ClientHelper.screen() != null)) return; ItemStack helmet = ClientHelper.player().inventory.armorItemInSlot(3); if ((ClientHelper.settings().thirdPersonView == 0) && (helmet != null) && (helmet.getItem() == InitItems.itemDivingHelmet))// && // KeyHandler.keyPressed) { ClientHelper.textureManager().bindTexture(overlay); Tessellator tessellator = Tessellator.instance; ScaledResolution scaledResolution = ClientHelper.resolution(); int width = scaledResolution.getScaledWidth(); int height = scaledResolution.getScaledHeight(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); // GL11.glEnable(GL11.GL_BLEND); // GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR); // GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glClearDepth(1.0D); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, height, 90.0D, 0.0D, 1.0D); tessellator.addVertexWithUV(width, height, 90.0D, 1.0D, 1.0D); tessellator.addVertexWithUV(width, 0.0D, 90.0D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); /* * if (!mc.gameSettings.hideGUI || mc.currentScreen != null) { int x = (Mouse.getX() * width) / mc.displayWidth; int y = height - (Mouse.getY() * * height) / mc.displayHeight - 1; mc.ingameGUI.renderGameOverlay(0.0F, mc.currentScreen != null, x, y); } */ } }
From source file:steamcraft.common.lib.events.EventHandlerClient.java
License:Minecraft Mod Public
private void drawSelectionBox(EntityPlayer player, MovingObjectPosition mop, int i, ItemStack is, float partialTicks) { if ((i == 0) && (mop.typeOfHit == MovingObjectType.BLOCK)) { GL11.glEnable(GL11.GL_BLEND);//from www . jav a 2 s .c o m GL11.glColor4f(0.0F, 1.0F, 0.0F, 1.0F); GL11.glLineWidth(3.5F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); float offset = 0.002F; Block block = player.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); if (block != Blocks.air) { block.setBlockBoundsBasedOnState(player.worldObj, mop.blockX, mop.blockY, mop.blockZ); double dx = player.lastTickPosX + ((player.posX - player.lastTickPosX) * partialTicks); double dy = player.lastTickPosY + ((player.posY - player.lastTickPosY) * partialTicks); double dz = player.lastTickPosZ + ((player.posZ - player.lastTickPosZ) * partialTicks); this.drawOutlinedBoundingBox( block.getSelectedBoundingBoxFromPool(player.worldObj, mop.blockX, mop.blockY, mop.blockZ) .expand(offset, offset, offset).getOffsetBoundingBox(-dx, -dy, -dz)); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); } if ((i == 0) && (mop.typeOfHit == MovingObjectType.ENTITY)) { GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0.0F, 1.0F, 0.0F, 1.0F); GL11.glLineWidth(3.5F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); float offset = 0.002F; Entity entity = mop.entityHit; if (entity != null) { entity.setPosition(entity.posX, entity.posY, entity.posZ); double dx = player.lastTickPosX + ((player.posX - player.lastTickPosX) * partialTicks); double dy = player.lastTickPosY + ((player.posY - player.lastTickPosY) * partialTicks); double dz = player.lastTickPosZ + ((player.posZ - player.lastTickPosZ) * partialTicks); this.drawOutlinedBoundingBox( entity.boundingBox.expand(offset, offset, offset).getOffsetBoundingBox(-dx, -dy, -dz)); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); } }
From source file:steamcraft.common.lib.events.EventHandlerClient.java
License:Minecraft Mod Public
@SubscribeEvent @SideOnly(Side.CLIENT)/*from w w w . ja v a 2 s. c o m*/ public void onRenderOverlay(RenderGameOverlayEvent.Post event) { ResourceLocation overlay = new ResourceLocation(ModInfo.PREFIX + "textures/misc/spyglass.png"); if (event.type != RenderGameOverlayEvent.ElementType.HELMET) return; EntityClientPlayerMP player = ClientHelper.player(); if ((player != null) && (ClientHelper.screen() == null) && (player.inventory.getCurrentItem() != null) && (player.inventory.getCurrentItem().getItem() == InitItems.itemSpyglass) && (ClientHelper.settings().thirdPersonView == 0)) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); ClientHelper.textureManager().bindTexture(overlay); Tessellator tessellator = Tessellator.instance; ScaledResolution scaledResolution = ClientHelper.resolution(); int width = scaledResolution.getScaledWidth(); int height = scaledResolution.getScaledHeight(); GL11.glDepthMask(false); GL11.glClearDepth(1.0D); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, height, 90.0D, 0.0D, 1.0D); tessellator.addVertexWithUV(width, height, 90.0D, 1.0D, 1.0D); tessellator.addVertexWithUV(width, 0.0D, 90.0D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); } }
From source file:steamcraft.common.lib.events.EventHandlerForge.java
License:Minecraft Mod Public
@SubscribeEvent @SideOnly(Side.CLIENT)/*ww w . ja va 2 s . com*/ public void onRenderOverlay(RenderGameOverlayEvent.Chat event) { EntityClientPlayerMP player = ClientHelper.player(); if ((player != null) && (ClientHelper.screen() == null) && (player.inventory.getCurrentItem() != null) && (player.inventory.getCurrentItem().getItem() == InitItems.itemSpyglass) && (ClientHelper.settings().thirdPersonView == 0)) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_DEPTH_TEST); ClientHelper.textureManager().bindTexture(overlay); Tessellator tessellator = Tessellator.instance; ScaledResolution scaledResolution = ClientHelper.resolution(); int width = scaledResolution.getScaledWidth(); int height = scaledResolution.getScaledHeight(); GL11.glDepthMask(false); GL11.glClearDepth(1.0D); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, height, 90.0D, 0.0D, 1.0D); tessellator.addVertexWithUV(width, height, 90.0D, 1.0D, 1.0D); tessellator.addVertexWithUV(width, 0.0D, 90.0D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); } }
From source file:steamcraft.common.worldgen.dimension.util.DeepsSkyRenderer.java
License:Minecraft Mod Public
@Override @SideOnly(Side.CLIENT)//from www . j av a 2 s. c o m public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D); Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks); float f1 = (float) vec3.xCoord; float f2 = (float) vec3.yCoord; float f3 = (float) vec3.zCoord; float f4; if (mc.gameSettings.anaglyph) { float f5 = ((f1 * 30.0F) + (f2 * 59.0F) + (f3 * 11.0F)) / 100.0F; float f6 = ((f1 * 30.0F) + (f2 * 70.0F)) / 100.0F; f4 = ((f1 * 30.0F) + (f3 * 70.0F)) / 100.0F; f1 = f5; f2 = f6; f3 = f4; } GL11.glColor3f(f1, f2, f3); Tessellator tessellator1 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(f1, f2, f3); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.disableStandardItemLighting(); float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks); float f7; float f8; float f9; float f10; if (afloat != null) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); f4 = afloat[0]; f7 = afloat[1]; f8 = afloat[2]; float f11; if (mc.gameSettings.anaglyph) { f9 = ((f4 * 30.0F) + (f7 * 59.0F) + (f8 * 11.0F)) / 100.0F; f10 = ((f4 * 30.0F) + (f7 * 70.0F)) / 100.0F; f11 = ((f4 * 30.0F) + (f8 * 70.0F)) / 100.0F; f4 = f9; f7 = f10; f8 = f11; } tessellator1.startDrawing(6); tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]); tessellator1.addVertex(0.0D, 100.0D, 0.0D); byte b0 = 16; tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F); for (int j = 0; j <= b0; ++j) { f11 = (j * (float) Math.PI * 2.0F) / b0; float f12 = MathHelper.sin(f11); float f13 = MathHelper.cos(f11); tessellator1.addVertex(f12 * 120.0F, f13 * 120.0F, -f13 * 40.0F * afloat[3]); } tessellator1.draw(); GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); f4 = 1.0F; f7 = 0.0F; f8 = 0.0F; f9 = 0.0F; GL11.glColor4f(1.0F, 1.0F, 1.0F, f4); GL11.glTranslatef(f7, f8, f9); GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); f10 = 15.0F; // Size of sun from center mc.renderEngine.bindTexture(new ResourceLocation(ModInfo.PREFIX + "textures/misc/sun.png")); // Sun texture + texture path tessellator1.startDrawingQuads(); tessellator1.addVertexWithUV((-f10), 100.0D, (-f10), 0.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, (-f10), 1.0D, 0.0D); tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D); tessellator1.addVertexWithUV((-f10), 100.0D, f10, 0.0D, 1.0D); tessellator1.draw(); // Draw sun GL11.glDisable(GL11.GL_TEXTURE_2D); float f18 = world.getStarBrightness(partialTicks) * f4; if (f18 > 0.0F) { GL11.glColor4f(f18, f18, f18, f18); GL11.glCallList(this.starGLCallList); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (d0 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); f8 = 1.0F; f9 = -((float) (d0 + 65.0D)); f10 = -f8; tessellator1.startDrawingQuads(); tessellator1.setColorRGBA_I(0, 255); tessellator1.addVertex((-f8), f9, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex((-f8), f10, f8); tessellator1.addVertex((-f8), f10, (-f8)); tessellator1.addVertex(f8, f10, (-f8)); tessellator1.addVertex(f8, f9, (-f8)); tessellator1.addVertex((-f8), f9, (-f8)); tessellator1.addVertex(f8, f10, (-f8)); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f9, f8); tessellator1.addVertex(f8, f9, (-f8)); tessellator1.addVertex((-f8), f9, (-f8)); tessellator1.addVertex((-f8), f9, f8); tessellator1.addVertex((-f8), f10, f8); tessellator1.addVertex((-f8), f10, (-f8)); tessellator1.addVertex((-f8), f10, (-f8)); tessellator1.addVertex((-f8), f10, f8); tessellator1.addVertex(f8, f10, f8); tessellator1.addVertex(f8, f10, (-f8)); tessellator1.draw(); } if (world.provider.isSkyColored()) { GL11.glColor3f(0.2F + 0.04F, (f2 * 0.2F) + 0.04F, (f3 * 0.6F) + 0.1F); } else { GL11.glColor3f(f1, f2, f3); } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }