List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:cn.lambdacraft.crafting.client.gui.GuiGenLava.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glPushMatrix();//w ww. j ava 2 s .co m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bindTexture(ClientProps.GUI_GENLAVA_PATH); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); int len = 0; len = te.bucketCnt * 47 / te.maxStorage; len += Math.round(2.35F * te.currentEnergy / TileGeneratorLava.ENERGY_PER_BUCKET); this.drawTexturedModalRect(x + 91, y + 65 - len, 173, 59 - len, 6, len); this.drawElements(); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.crafting.client.gui.GuiGenSolar.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glPushMatrix();//from w w w. j av a 2 s . com GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bindTexture(ClientProps.GUI_GENSOLAR_PATH); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); int len = 0; len = te.currentEnergy * 48 / te.maxStorage; if (len > 0) this.drawTexturedModalRect(x + 24, y + 52, 174, 70, len, 7); if (te.worldObj.isDaytime()) { this.drawTexturedModalRect(x + 13, y + 19, 173, 0, 60, 30); this.drawTexturedModalRect(x + 86, y + 44, 186, 9, 5, 5); } else { this.drawTexturedModalRect(x + 13, y + 19, 173, 34, 60, 30); this.drawTexturedModalRect(x + 86, y + 44, 186, 44, 5, 5); } this.drawElements(); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.deathmatch.client.HEVRenderingUtils.java
License:Open Source License
public static void drawPlayerHud(EntityPlayer player, ScaledResolution resolution, float partialTickTime) { int k = resolution.getScaledWidth(); int l = resolution.getScaledHeight(); int i2 = k / 2 - 91; int k2 = l - 32 + 3; Minecraft mc = Minecraft.getMinecraft(); TextureManager engine = mc.renderEngine; GL11.glEnable(GL11.GL_BLEND);//from w w w. ja v a 2s . c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F); engine.bindTexture(ClientProps.HEV_HUD_PATH); GL11.glPushMatrix(); double scale = 0.00026 * mc.displayWidth + 0.3; float xOffset, yOffset; xOffset = 10; yOffset = l - 20; GL11.glTranslatef(xOffset, yOffset, 0.0F); GL11.glScaled(scale, scale, 1.0); //Health Section HudUtils.setTextureResolution(TEX_WIDTH, TEX_HEIGHT); GL11.glColor4f(0.7F, 0.7F, 0.7F, 0.6F); HudUtils.drawTexturedModalRect(0, 0, 64, 64, 24, 24, 64, 64); GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F); int h = (int) (player.getHealth() * 16 / 20); HudUtils.drawTexturedModalRect(0, 24 - (int) (h * 1.5), 192, 128 - 4 * h, 24, (int) (1.5 * h), 64, 4 * h); if (player.getHealth() <= 5) GL11.glColor4f(0.9F, 0.1F, 0.1F, 0.6F); drawNumberAt((byte) (player.getHealth() * 5), 18, 0); GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.9F); //Armor Section GL11.glColor4f(0.7F, 0.7F, 0.7F, 0.6F); HudUtils.drawTexturedModalRect(70, 0, 0, 64, 24, 24, 64, 64); GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F); h = player.getTotalArmorValue() * 16 / 20; if (h > 16) h = 16; HudUtils.drawTexturedModalRect(70, 24 - (int) (h * 1.5), 128, 128 - 4 * h, 24, (int) (h * 1.5), 64, 4 * h); drawNumberAt(player.getTotalArmorValue() * 5, 70 + 12, 0); GL11.glPopMatrix(); //Other section drawArmorTip(player, engine, k, l); if (LCClientPlayer.drawArmorTip) drawWeaponTip(player, engine, k, l); engine.bindTexture(engine.getResourceLocation(1)); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.7F); }
From source file:cn.lambdacraft.deathmatch.client.HEVRenderingUtils.java
License:Open Source License
public static void drawCrosshair(ItemStack stack, int k, int l) { String xhairPath = null;//from w w w. j a v a 2 s .c o m TextureManager engine = Minecraft.getMinecraft().renderEngine; int h = 12; if (stack != null) { if (stack.getItem() instanceof ISpecialCrosshair) { h = ((ISpecialCrosshair) stack.getItem()).getHalfWidth(); int i = ((ISpecialCrosshair) stack.getItem()).getCrosshairID(stack); if (i >= 0) xhairPath = ClientProps.xhair_path + "xhair" + i + ".png"; } else xhairPath = ClientProps.getCrosshairPath(stack.getItem().getUnlocalizedName(stack)); if (xhairPath == null) xhairPath = ClientProps.DEFAULT_XHAIR_PATH; } else { xhairPath = ClientProps.DEFAULT_XHAIR_PATH; } GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int par1 = k / 2 - h, par2 = l / 2 - h; RenderUtils.loadTexture(xhairPath); Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.setColorRGBA(ClientProps.xHairR, ClientProps.xHairG, ClientProps.xHairB, 255); t.addVertexWithUV(par1 + 0, par2 + 2 * h, -90, 0, 1); t.addVertexWithUV(par1 + 2 * h, par2 + 2 * h, -90, 1, 1); t.addVertexWithUV(par1 + 2 * h, par2 + 0, -90, 1, 0); t.addVertexWithUV(par1 + 0, par2 + 0, -90, 0, 0); t.draw(); //TODO: maybe buggy here GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.7F); GL11.glPopMatrix(); engine.bindTexture(Gui.icons); }
From source file:cn.lambdacraft.mob.client.renderer.RenderAlienSlave.java
License:Open Source License
private void renderElectro(EntityAlienSlave ent, Vec3 vec3, Tessellator t, double x, double y, double z, boolean isLeft) { double dx = vec3.xCoord, dy = vec3.yCoord, dz = vec3.zCoord; double tx = 0.0, ty = 1.2, tz = 0.0; GL11.glPushMatrix();//from w ww . j a v a2 s .co m GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.loadTexture(ClientProps.VORTIGAUNT_RAY_PATH[rand.nextInt(3)]); Vec3 v1 = RenderUtils.newV3(tx - WIDTH, ty, tz), v2 = RenderUtils.newV3(tx + WIDTH, ty, tz), v3 = RenderUtils.newV3(tx, ty - WIDTH, tz), v4 = RenderUtils.newV3(tx, ty + WIDTH, tz); double d = Math.sqrt(dx * dx + dy * dy + dz * dz) * 1.3; GL11.glTranslated(x, y, z); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawingQuads(); t.setBrightness(15728880); t.setColorRGBA_F(0.1F, 0.9F, 0.1F, 0.7F); RenderUtils.addVertex(v1, 0, 0); RenderUtils.addVertex(v2, 1, 0); RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d); RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d); RenderUtils.addVertex(v3, 0, 0); RenderUtils.addVertex(v4, 1, 0); RenderUtils.addVertex(v4.addVector(dx, dy, dz), 1, d); RenderUtils.addVertex(v3.addVector(dx, dy, dz), 0, d); t.draw(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.mob.client.renderer.RenderSentryRay.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) { this.doRender(tile, x, y, z, f); TileSentryRay ray = (TileSentryRay) tile, ray2 = ray.linkedBlock; double width = 0.015; if (ray2 != null) { Vec3 v = ray2.getRayOffset();/*from w ww . j a va2s . c om*/ Vec3 va = ray.getRayOffset(); double x1 = x + ray2.xCoord + v.xCoord - ray.xCoord, y1 = y + ray2.yCoord + v.yCoord - ray.yCoord, z1 = z + ray2.zCoord + v.zCoord - ray.zCoord; x += va.xCoord; y += va.yCoord; z += va.zCoord; Vec3 v1 = getVec3(0, 0, -width).addVector(x, y, z), v2 = getVec3(0, 0, width).addVector(x, y, z), v3 = getVec3(0, 0, width).addVector(x1, y1, z1), v4 = getVec3(0, 0, -width).addVector(x1, y1, z1); Vec3 v5 = getVec3(-width, 0, 0).addVector(x, y, z), v6 = getVec3(width, 0, 0).addVector(x, y, z), v7 = getVec3(width, 0, 0).addVector(x1, y1, z1), v8 = getVec3(-width, 0, 0).addVector(x1, y1, z1); Vec3 v9 = getVec3(0, -width, 0).addVector(x, y, z), v10 = getVec3(0, width, 0).addVector(x, y, z), v11 = getVec3(0, width, 0).addVector(x1, y1, z1), v12 = getVec3(0, -width, 0).addVector(x1, y1, z1); double dist = ray.getDistanceFrom(ray2.xCoord, ray2.yCoord, ray2.zCoord); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.setColorRGBA_F(1.0F, 0.2F, 0.2F, 0.65F); t.setBrightness(512); RenderUtils.addVertex(v1, 0, 0); RenderUtils.addVertex(v2, 0, 1); RenderUtils.addVertex(v3, dist, 1); RenderUtils.addVertex(v4, dist, 0); RenderUtils.addVertex(v5, 0, 0); RenderUtils.addVertex(v6, 0, 1); RenderUtils.addVertex(v7, dist, 1); RenderUtils.addVertex(v8, dist, 0); RenderUtils.addVertex(v9, 0, 0); RenderUtils.addVertex(v10, 0, 1); RenderUtils.addVertex(v11, dist, 1); RenderUtils.addVertex(v12, dist, 0); t.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } }
From source file:cn.lambdacraft.mob.client.renderer.RenderShockwave.java
License:Open Source License
protected void renderWave(Tessellator t, double x, double y, double z, float radius) { GL11.glPushMatrix();//from w w w. ja va 2 s.c o m GL11.glTranslated(x, y, z); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawingQuads(); t.setColorRGBA(255, 255, 255, 128); t.setBrightness(15728880); t.addVertexWithUV(-radius, 0.0, -radius, 0.0, 0.0); t.addVertexWithUV(-radius, 0.0, radius, 0.0, 1.0); t.addVertexWithUV(radius, 0.0, radius, 1.0, 1.0); t.addVertexWithUV(radius, 0.0, -radius, 1.0, 0.0); t.draw(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.mob.client.renderer.RenderVortigauntRay.java
License:Open Source License
@Override public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) { EntityVortigauntRay ray = (EntityVortigauntRay) entity; Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix();// w w w .j ava 2 s . c o m double dx = ray.destX - ray.startX; double dy = ray.destY - ray.startY; double dz = ray.destZ - ray.startZ; double d = Math.sqrt(dx * dx + dy * dy + dz * dz); float angle = ray.ticksExisted; double tx = 0.0, tz = 0.0; double ty = -0.63; Vec3 v1 = RenderUtils.newV3(0, 0, -WIDTH), v2 = RenderUtils.newV3(0, 0, WIDTH), v5 = RenderUtils.newV3(0, WIDTH, 0), v6 = RenderUtils.newV3(0, -WIDTH, 0); // Translations and rotations GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslatef((float) d0, (float) d1, (float) d2); // GL11.glRotatef(angle, 1.0F, 0, 0); int rand = RenderUtils.rand.nextInt(3); Minecraft.getMinecraft().renderEngine.bindTexture(ClientProps.VORTIGAUNT_RAY_PATH[rand]); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); tessellator.startDrawingQuads(); tessellator.setBrightness(15728880); tessellator.setColorRGBA(50, 200, 50, 200); RenderUtils.addVertex(v1.addVector(tx, ty, tz), 0, 0); RenderUtils.addVertex(v2.addVector(tx, ty, tz), 1, 0); RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d); RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d); RenderUtils.addVertex(v5.addVector(tx, ty, tz), 0, d); RenderUtils.addVertex(v6.addVector(tx, ty, tz), 1, d); RenderUtils.addVertex(v6.addVector(dx, dy, dz), 1, 0); RenderUtils.addVertex(v5.addVector(dx, dy, dz), 0, 0); tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.terrain.client.renderer.RenderItemPortal.java
License:Open Source License
private void renderEntity(ItemStack item, RenderBlocks render, EntityItem ent) { GL11.glEnable(GL11.GL_BLEND);/*from w w w.jav a2 s. c o m*/ GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR); RenderUtils.renderItemIn2d(item, 0.0625F); GL11.glDisable(GL11.GL_BLEND); }
From source file:cn.lambdacraft.terrain.client.renderer.RenderItemPortal.java
License:Open Source License
private void renderEquipped(ItemStack is, RenderBlocks render, EntityLivingBase entity) { GL11.glEnable(GL11.GL_BLEND);/*ww w. j a va2 s. c o m*/ GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR); RenderUtils.renderItemIn2d(is, 0.0625F); GL11.glDisable(GL11.GL_BLEND); }