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:com.bluepowermod.client.gui.GuiCircuitDatabaseMain.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); this.drawString(guiLeft + 95, guiTop + 25, I18n.format("gui.circuitDatabase.name"), false); nameField.drawTextBox();// w ww .ja va2 s . com GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(copyTabTexture); int processPercentage = circuitDatabase.curCopyProgress * 22 / TileCircuitDatabase.UPLOAD_AND_COPY_TIME; if (processPercentage > 0) drawTexturedModalRect(guiLeft + 77, guiTop + 64, 176, 0, processPercentage, 15); processPercentage = circuitDatabase.curUploadProgress * 22 / TileCircuitDatabase.UPLOAD_AND_COPY_TIME; if (processPercentage > 0) drawTexturedModalRect(guiLeft + 57, guiTop + 57 - processPercentage, 176, 37 - processPercentage, 15, processPercentage); }
From source file:com.bluepowermod.client.gui.GuiMonitor.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(resLoc); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect2(k, l, 0, 0, this.xSize, this.ySize); // screen color this.mc.getTextureManager().bindTexture(chracterSetResLoc); GL11.glColor4f(monitor.screenColor[0], monitor.screenColor[1], monitor.screenColor[2], 1.0F); for (int row = 0; row < 50; row++) { for (int col = 0; col < 80; col++) { byte character = monitor.screenMemory[row * 80 + col]; // TODO: overlay cursor character if (character != 32) { drawCharacter(row, col, character); }//from w w w . ja v a 2 s.c o m } } }
From source file:com.builtbroken.assemblyline.content.rail.carts.Gui.GuiChestCart.java
@Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(field_147017_u); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.inventoryRows * 18 + 17); this.drawTexturedModalRect(k, l + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); }
From source file:com.builtbroken.atomic.content.effects.client.RenderRadOverlay.java
@SubscribeEvent public void renderOverlay(RenderGameOverlayEvent.Post event) { int width = event.resolution.getScaledWidth(); int height = event.resolution.getScaledHeight(); Minecraft mc = Minecraft.getMinecraft(); if (event.type == RenderGameOverlayEvent.ElementType.ALL) { //Start//from www . jav a2 s .c om GL11.glPushMatrix(); GL11.glTranslatef(0, 0, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); //Position TODO config TODO fire event int left = 5; int top = 5; //Get data final float rad_player = interpolate(ClientProxy.PREV_RAD_PLAYER, ClientProxy.RAD_PLAYER, event.partialTicks); final float rad_area = interpolate(ClientProxy.PREV_RAD_EXPOSURE, ClientProxy.RAD_EXPOSURE, event.partialTicks); final float rad_dead_min = ConfigRadiation.RADIATION_DEATH_POINT / (60 * 20); //Radiation needed to die in 1 min //Format String remDisplay = formatDisplay("PER:", rad_player, "rem"); String radDisplay = formatDisplay("ENV: ", rad_area * 20, "rem/s"); //Render Render2DHelper.renderTextWithShadow(remDisplay, left, top, interpolate(startColor, endColor, rad_player / ConfigRadiation.RADIATION_DEATH_POINT).getRGB()); Render2DHelper.renderTextWithShadow(radDisplay, left, top + 10, interpolate(startColor, endColor, rad_area / rad_dead_min).getRGB()); if (AtomicScience.runningAsDev) { Render2DHelper.renderTextWithShadow("" + ClientProxy.RAD_REMOVE_TIMER, left + 60, top, endColor.getRGB()); } //Set prev ClientProxy.PREV_RAD_PLAYER = rad_player; ClientProxy.PREV_RAD_EXPOSURE = rad_area; //End GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } }
From source file:com.builtbroken.atomic.content.items.cell.RendererItemCell.java
protected void renderFluid(ItemRenderType type, ItemStack item) { final FluidStack fluidStack = ((ItemFluidCell) item.getItem()).getFluid(item); if (fluidStack != null) { final Fluid fluid = fluidStack.getFluid(); if (fluid != null) { final IIcon maskIcon = ASItems.itemFluidCell.getIconFromDamage(-1); final IIcon subIcon = fluid.getFlowingIcon() != null ? fluid.getFlowingIcon() : fluid.getIcon(); if (maskIcon != null && subIcon != null) { 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; //Render mask TODO change mask verts to show fill % bindItemTexture(item.getItem()); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); generatedGeometry(maskIcon, type, 10, 0.001); tessellator.draw();// w ww . j a v a 2 s .c o m tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); //TODO don't think is needed for inventory generatedGeometry(maskIcon, type, -0.0635, -0.0635); tessellator.draw(); //Render fluid bindFluidTexture(fluid); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, 1); generatedGeometry(subIcon, type, 10, 0.001); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0, 0, -1); //TODO don't think is needed for inventory generatedGeometry(subIcon, type, -0.0635, -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:com.builtbroken.atomic.lib.gui.slot.SlotEnergy.java
@Override protected void drawIcon(Gui gui, int x, int y) { Minecraft.getMinecraft().renderEngine.bindTexture(GuiContainerBase.GUI_COMPONENTS); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); gui.drawTexturedModalRect(x, y, 0, 18, 18, 18); }
From source file:com.builtbroken.atomic.lib.gui.slot.SlotFluid.java
@Override protected void drawIcon(Gui gui, int x, int y) { Minecraft.getMinecraft().renderEngine.bindTexture(GuiContainerBase.GUI_COMPONENTS); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); gui.drawTexturedModalRect(x, y, 0, 18 * 2, 18, 18); }
From source file:com.builtbroken.atomic.lib.gui.slot.SlotMachine.java
@Override public void renderSlotOverlay(Gui gui, int x, int y) { Minecraft.getMinecraft().renderEngine.bindTexture(GuiContainerBase.GUI_COMPONENTS); if (edgeColor != null) { GL11.glColor4f(edgeColor.getRed() / 255f, edgeColor.getGreen() / 255f, edgeColor.getBlue() / 255f, edgeColor.getAlpha() / 255f); gui.drawTexturedModalRect(x, y, 0, 0, 18, 18); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); gui.drawTexturedModalRect(x + 1, y + 1, 1, 1, 16, 16); } else {//from w ww. jav a 2 s . com GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); gui.drawTexturedModalRect(x, y, 0, 0, 18, 18); } if (!getHasStack()) { drawIcon(gui, x, y); } }
From source file:com.builtbroken.atomic.lib.Render2DHelper.java
/** * Draws a solid color rectangle with the specified coordinates and color. Args: x1, y1, x2, y2, color *//*from w w w . ja va 2 s .com*/ public static void drawRect(int x1, int y1, int x2, int y2, int color) { int j1; if (x1 < x2) { j1 = x1; x1 = x2; x2 = j1; } if (y1 < y2) { j1 = y1; y1 = y2; y2 = j1; } float f3 = (float) (color >> 24 & 255) / 255.0F; float f = (float) (color >> 16 & 255) / 255.0F; float f1 = (float) (color >> 8 & 255) / 255.0F; float f2 = (float) (color & 255) / 255.0F; Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(f, f1, f2, f3); tessellator.startDrawingQuads(); tessellator.addVertex((double) x1, (double) y2, 0.0D); tessellator.addVertex((double) x2, (double) y2, 0.0D); tessellator.addVertex((double) x2, (double) y1, 0.0D); tessellator.addVertex((double) x1, (double) y1, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.builtbroken.atomic.lib.Render2DHelper.java
/** * Used by the overlay to render text with shadow behind the text * * @param text/*from w w w .ja v a 2 s . c om*/ * @param x * @param y * @param colorRGB */ public static void renderTextWithShadow(String text, int x, int y, int colorRGB) { GL11.glPushMatrix(); FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer; fontrenderer.drawString(text, x + 1, y, 0); fontrenderer.drawString(text, x - 1, y, 0); fontrenderer.drawString(text, x, y + 1, 0); fontrenderer.drawString(text, x, y - 1, 0); fontrenderer.drawString(text, x, y, colorRGB); GL11.glColor4f(1, 1, 1, 1); GL11.glPopMatrix(); }