List of usage examples for org.lwjgl.opengl GL11 glColor4f
public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);
From source file:cn.lambdacraft.deathmatch.client.gui.GuiMedFiller.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int a, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(ClientProps.GUI_MEDFILLER_PATH); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); int height = te.currentEnergy * 51 / te.maxEnergy; this.drawTexturedModalRect(x + 112, y + 73 - height, 200, 57 - height, 7, height); for (int i = 0; i < 3; i++) { int length = te.progresses[i] * 17 / TileMedkitFiller.CRAFT_LIMIT; this.drawTexturedModalRect(x + 29 * (i + 1), y + 77, 200, 3, length, 3); }//from w ww .j av a2 s .c om this.drawElements(); }
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);// ww w . j a va 2s .c om 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;/*ww w .ja v a 2 s .c om*/ 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.deathmatch.client.HEVRenderingUtils.java
License:Open Source License
private static void drawArmorTip(EntityPlayer player, TextureManager renderEngine, int k, int l) { int tx = k - 26, tx2 = k - 10; for (int i = 0, xOffset = -10; i < 4; i++) { ItemStack is = player.inventory.armorInventory[i]; ArmorHEV hev;//www . j av a 2s.c o m if (is != null && is.getItem() instanceof ArmorHEV) { hev = (ArmorHEV) is.getItem(); int energy = hev.getManager(is).discharge(is, Integer.MAX_VALUE, 0, true, true); int heightToDraw = energy * 16 / is.getMaxDamage(); int height = l - 65 - i * 16; if (is.getItemSpriteNumber() == 0) { renderEngine.bindTexture(renderEngine.getResourceLocation(0)); } else { renderEngine.bindTexture(renderEngine.getResourceLocation(1)); } //xOffset = (int) (xOffset * 0.7); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F); HudUtils.drawTexturedModelRectFromIcon(tx + xOffset, height, hev.getIcon(is, 0), 16, 16); renderEngine.bindTexture(ClientProps.HEV_HUD_PATH); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); HudUtils.drawTexturedModalRect(tx2 + xOffset, height + 16 - heightToDraw, 286, 64, 8, 16, 34, 64); //overlay GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.75F); HudUtils.drawTexturedModalRect(tx2 + xOffset, height + 16 - heightToDraw, 350, 128 - 4 * heightToDraw, 8, heightToDraw, 34, heightToDraw * 4); //actual } } }
From source file:cn.lambdacraft.deathmatch.client.HEVRenderingUtils.java
License:Open Source License
private static void drawTips(IHudTip[] tips, TextureManager engine, ItemStack itemStack, EntityPlayer player, int k, int l) { int startHeight = l - 5 - 24 * tips.length; for (int i = 0; i < tips.length; i++) { String s = tips[i].getTip(itemStack, player); int width = k - 32 - getStringLength(s); IIcon icon = tips[i].getRenderingIcon(itemStack, player); if (icon != null) { int sheetIndex = tips[i].getTextureSheet(itemStack); if (sheetIndex == 0) engine.bindTexture(engine.getResourceLocation(0)); else if (sheetIndex != 5) engine.bindTexture(engine.getResourceLocation(1)); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F); HudUtils.drawTexturedModelRectFromIcon(k - 30, startHeight, icon, 20, 20); GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F); //Bind the texture by Rikka0_0 RenderUtils.loadTexture(ClientProps.HEV_HUD_PATH); }// w w w. j ava 2s . c o m drawTipStringAt(s, width, startHeight); startHeight += 18; } }
From source file:cn.lambdacraft.mob.client.renderer.RenderAlienSlave.java
License:Open Source License
@Override public void doRender(Entity entity, double x, double y, double z, float par8, float par9) { GL11.glPushMatrix();/*from w w w .j a v a 2 s. com*/ EntityAlienSlave slave = (EntityAlienSlave) entity; Tessellator t = Tessellator.instance; if (slave.isCharging) { for (Vec3 vec : slave.electrolyze_left) { renderElectro(slave, vec, t, x, y, z, true); } for (Vec3 vec : slave.electrolyze_right) { renderElectro(slave, vec, t, x, y, z, false); } } if (entity.hurtResistantTime > 10) GL11.glColor4f(1.0F, 0.3F, 0.3F, 1.0F); super.doRender(entity, x, y, z, par8, par9); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:cn.lambdalib.cgui.gui.CGui.java
License:MIT License
/** * Go down the hierarchy tree and draw each widget node. Should be called each rendering frame. *///from www .ja va2 s . co m public void draw(double mx, double my) { frameUpdate(); updateMouse(mx, my); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); drawTraverse(mx, my, null, this, getTopWidget(mx, my)); if (debug) { Widget hovering = getHoveringWidget(); if (hovering != null) { GL11.glColor4f(1, .5f, .5f, .8f); HudUtils.drawRectOutline(hovering.x, hovering.y, hovering.transform.width * hovering.scale, hovering.transform.height * hovering.scale, 3); IFont font = TrueTypeFont.defaultFont(); font.draw(hovering.getFullName(), hovering.x, hovering.y - 10, new FontOption(10)); } } GL11.glEnable(GL11.GL_ALPHA_TEST); }
From source file:cn.lambdalib.cgui.gui.component.Outline.java
License:MIT License
public Outline(Color _color) { super("Outline"); color = _color;//www.j a v a2s .c o m listen(FrameEvent.class, (w, e) -> { color.bind(); HudUtils.drawRectOutline(0, 0, w.transform.width, w.transform.height, lineWidth); GL11.glColor4f(1, 1, 1, 1); }); }
From source file:cn.liutils.api.client.render.RenderIcon.java
License:Open Source License
private void func_77026_a(Tessellator tessllator) { float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glColor4f(r, g, b, alpha); if (!hasLight) OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); tessllator.startDrawingQuads();//from w w w .j a v a 2 s . c om if (!hasLight) tessllator.setBrightness(15728880); tessllator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, 0, 1); tessllator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, 1, 1); tessllator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, 1, 0); tessllator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, 0, 0); tessllator.draw(); }
From source file:cn.liutils.api.draw.prop.AssignColor.java
License:Open Source License
@Override public void onEvent(EventType event, DrawObject obj) { GL11.glColor4f(r, g, b, a); }