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.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
/** ************************************************************************* */ private void startPainting() { if (this.composite != null) { try {/*from ww w .j ava 2s .c om*/ GL11.glColor4f(1.0f, 1.0f, 1.0f, ((AlphaComposite) this.composite).getAlpha()); } catch (ClassCastException e) { } } }
From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java
License:Open Source License
private void drawRect(int x, int y, int width, int height, int type, Color col) { GL11.glDisable(GL11.GL_TEXTURE_2D);//from w w w . j av a 2s . co m GL11.glColor4f((float) col.getRed() / 255f, (float) col.getGreen() / 255f, (float) col.getBlue() / 255f, (float) col.getAlpha() / 255f); GL11.glLineWidth(1.0f); GL11.glBegin(type); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:com.hea3ven.pandoraschest.client.gui.GuiClayDrawer.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(field_110421_t); int xOffset = (this.width - this.xSize) / 2; int middleXOffset = xOffset; if (leftInventory != null) { middleXOffset += 7 + 18 * 9 + 3; }/*from w w w . j av a2 s . com*/ int yOffset = (this.height - this.ySize) / 2; this.drawTexturedModalRect(middleXOffset, yOffset, 0, 0, 7 + 18 * 9 + 7, 4); yOffset += 4; if (topInventory != null) { this.drawTexturedModalRect(middleXOffset, yOffset, 0, 4, 7 + 18 * 9 + 7, 13 + 3 * 18); yOffset += 13 + 3 * 18; } this.drawTexturedModalRect(middleXOffset, yOffset, 0, 4, 7 + 18 * 9 + 7, 13 + 3 * 18); int middleYOffset = yOffset; yOffset += 13 + 3 * 18; if (bottomInventory != null) { this.drawTexturedModalRect(middleXOffset, yOffset, 0, 4, 7 + 18 * 9 + 7, 13 + 3 * 18); yOffset += 13 + 3 * 18; } this.drawTexturedModalRect(middleXOffset, yOffset, 0, 78, 7 + 18 * 9 + 7, 14 + 3 * 18 + 4 + 18 + 7); if (leftInventory != null) { this.drawTexturedModalRect(xOffset, middleYOffset - 4, 0, 0, 4, 13 + 3 * 18 + 11); this.drawTexturedModalRect(xOffset + 4, middleYOffset - 4, 4, 176, 3 + 18 * 9 + 7, 13 + 3 * 18 + 12); if (topInventory == null) this.drawTexturedModalRect(middleXOffset - 4, middleYOffset - 4, 8, 0, 8, 3); } if (rightInventory != null) { this.drawTexturedModalRect(middleXOffset + 3 + 18 * 9 + 7, middleYOffset - 4, 0, 176, 3 + 18 * 9 + 7, 13 + 3 * 18 + 11); this.drawTexturedModalRect(middleXOffset + 3 + 18 * 9 + 7 + 4 + 18 * 9 + 5, middleYOffset - 4, 171, 0, 4, 13 + 3 * 18 + 11); if (topInventory == null) this.drawTexturedModalRect(middleXOffset + 3 + 18 * 9 + 4, middleYOffset - 4, 8, 0, 8, 3); } }
From source file:com.hea3ven.pandoraschest.client.gui.GuiPandorasChest.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(field_110421_t); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, 3 * 18 + 17); this.drawTexturedModalRect(k, l + 3 * 18 + 17, 0, 126, this.xSize, 96); }
From source file:com.headswilllol.mineflat.gui.GuiElement.java
License:Open Source License
public void draw() { if (isActive()) { GL11.glColor4f(color.getX(), color.getY(), color.getZ(), color.getW()); GL11.glBegin(GL11.GL_QUADS);// w ww . jav a 2 s . c o m GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + size.getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + size.getX(), getAbsolutePosition().getY() + size.getY()); GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY() + size.getY()); GL11.glEnd(); for (GuiElement ge : children.values()) { ge.draw(); } } }
From source file:com.headswilllol.mineflat.gui.TextField.java
License:Open Source License
@Override public void draw() { if (isActive()) { GL11.glColor4f(bgColor.getX(), bgColor.getY(), bgColor.getZ(), bgColor.getW()); GL11.glBegin(GL11.GL_QUADS);/*w w w . j a va 2 s . co m*/ GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + getSize().getX(), getAbsolutePosition().getY()); GL11.glVertex2i(getAbsolutePosition().getX() + getSize().getX(), getAbsolutePosition().getY() + getSize().getY()); GL11.glVertex2i(getAbsolutePosition().getX(), getAbsolutePosition().getY() + getSize().getY()); GL11.glEnd(); GL11.glColor4f(textColor.getX(), textColor.getY(), textColor.getZ(), textColor.getW()); GraphicsHandler.drawString(getText(), getAbsolutePosition().getX() + 3, getAbsolutePosition().getY() + 3, getSize().getY() - 6, false); if (selected == this) { GL11.glBegin(GL11.GL_QUADS); int /* I got 'em foaming from the mouth and I just hit 'em with the */ baseX = getAbsolutePosition() .getX() + GraphicsHandler.getStringLength(getText().substring(0, column + 1), getSize().getY() - 6) + 1; int baseY = getAbsolutePosition().getY() + 1; GL11.glVertex2i(baseX, baseY); GL11.glVertex2i(baseX + 2, baseY); GL11.glVertex2i(baseX + 2, baseY + getSize().getY() - 2); GL11.glVertex2i(baseX, baseY + getSize().getY() - 2); GL11.glEnd(); } } }
From source file:com.irr310.i3d.scene.I3dEye3DCamera.java
License:Open Source License
private void displayTarget() { GL11.glColor4f(1.0f, 0.5f, 0.5f, 0.8f); GL11.glLineWidth(1.2f);/*from w ww . j av a 2s.c o m*/ GL11.glBegin(GL11.GL_LINES); { GL11.glColor4f(1.0f, 0.0f, 0.0f, 0.8f); GL11.glVertex3d(-1, 0, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, 0.1, 0); GL11.glVertex3d(1, 0, 0); GL11.glVertex3d(0.9, -0.1, 0); GL11.glVertex3d(1, 0, 0); // y GL11.glColor4f(0.0f, 1.0f, 0.0f, 0.8f); GL11.glVertex3d(0, -1, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); GL11.glVertex3d(-0.1, 0.9, 0); GL11.glVertex3d(0, 1, 0); // z GL11.glColor4f(0.0f, 0.0f, 1.0f, 0.8f); GL11.glVertex3d(0, 0, -1); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); GL11.glVertex3d(-0.1, 0, 0.9); GL11.glVertex3d(0, 0, 1); } GL11.glEnd(); GL11.glPointSize(1.2f); GL11.glBegin(GL11.GL_POINTS); { GL11.glVertex3d(position.x, position.y, position.z); } GL11.glEnd(); }
From source file:com.itszuvalex.femtocraft.research.gui.GuiResearch.java
License:Open Source License
protected void genAchievementBackground(int par1, int par2, float par3) { int k = MathHelper.floor_double(field_74117_m + (guiMapX - field_74117_m) * (double) par3); int l = MathHelper.floor_double(field_74115_n + (guiMapY - field_74115_n) * (double) par3); if (k < guiMapTop) { k = guiMapTop;/*from w w w . j av a 2 s . com*/ } if (l < guiMapLeft) { l = guiMapLeft; } if (k >= guiMapBottom) { k = guiMapBottom - 1; } if (l >= guiMapRight) { l = guiMapRight - 1; } int i1 = (this.width - this.researchPaneWidth) / 2; int j1 = (this.height - this.researchPaneHeight) / 2; int k1 = i1 + 16; int l1 = j1 + 17; this.zLevel = 0.0F; GL11.glDepthFunc(GL11.GL_GEQUAL); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 0.0F, -200.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); int i2 = k + 288 >> 4; int j2 = l + 288 >> 4; int k2 = (k + 288) % 16; int l2 = (l + 288) % 16; Random random = new Random(); int i3; int j3; int k3; // Make background for (i3 = 0; i3 * 16 - l2 < 155; ++i3) { float f1 = 0.6F - (float) (j2 + i3) / 25.0F * 0.3F; GL11.glColor4f(f1, f1, f1, 1.0F); for (k3 = 0; k3 * 16 - k2 < 224; ++k3) { random.setSeed((long) (1234 + i2 + k3)); random.nextInt(); j3 = random.nextInt(1 + j2 + i3) + (j2 + i3) / 2; IIcon icon = Blocks.sand.getIcon(0, 0); if (j3 <= 37 && j2 + i3 != 35) { if (j3 == 22) { if (random.nextInt(2) == 0) { icon = Femtocraft.blockOrePlatinum().getIcon(0, 0); } else { icon = Femtocraft.blockOreFarenite().getIcon(0, 0); } } else if (j3 == 10) { icon = Femtocraft.blockOreTitanium().getIcon(0, 0); } else if (j3 == 8) { icon = Femtocraft.blockOreThorium().getIcon(0, 0); } else if (j3 > 4) { icon = Blocks.stone.getIcon(0, 0); } else if (j3 > 0) { icon = Blocks.dirt.getIcon(0, 0); } } else { icon = Blocks.bedrock.getIcon(0, 0); } Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); this.drawTexturedModelRectFromIcon(k1 + k3 * 16 - k2, l1 + i3 * 16 - l2, icon, 16, 16); } } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); // GL11.glDisable(GL11.GL_TEXTURE_2D); int l3; int i4; int j4; for (ITechnology tech : Femtocraft.researchManager().getTechnologies()) { ResearchStatus rs = researchStatus.getTechnology(tech.getName()); if (rs == null) { continue; } if (tech.getPrerequisites() != null) { for (String cr : tech.getPrerequisites()) { TechNode node = Femtocraft.researchManager().getNode(tech); for (IGraphNode parent : node.getParents()) { IGraphNode next = parent; IGraphNode prev = node; while (next instanceof DummyTechNode) { k3 = prev.getDisplayX() * 24 - k + 11 + k1; j3 = prev.getDisplayY() * 24 - l + 11 + l1 - 11; j4 = next.getDisplayX() * 24 - k + 11 + k1; l3 = next.getDisplayY() * 24 - l + 11 + l1 + 11; boolean flag6 = !rs.researched(); i4 = Math.sin( (double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D ? 255 : 130; int color = tech.getLevel().getColor(); if (flag6) { color += (i4 << 24); } else { color += (255 << 24); } // this.drawHorizontalLine(k3, j4, j3, color); // this.drawVerticalLine(j4, j3, l3, color); RenderUtils.drawLine(k3, j4, j3, l3, 1, color); RenderUtils.drawLine(j4, j4, l3 - 22, l3, 1, color); // Dummy nodes should only have 1 parent prev = next; next = next.getParents().get(0); } k3 = prev.getDisplayX() * 24 - k + 11 + k1; j3 = prev.getDisplayY() * 24 - l + 11 + l1 - 11; j4 = next.getDisplayX() * 24 - k + 11 + k1; l3 = next.getDisplayY() * 24 - l + 11 + l1 + 11; boolean flag6 = !rs.researched(); i4 = Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D ? 255 : 130; int color = tech.getLevel().getColor(); if (flag6) { color += (i4 << 24); } else { color += (255 << 24); } // this.drawHorizontalLine(k3, j4, j3, color); // this.drawVerticalLine(j4, j3, l3, color); RenderUtils.drawLine(k3, j4, j3, l3, 1, color); } } } } ITechnology tooltipTech = null; RenderItem renderitem = new RenderItem(); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); int l4; int i5; for (ITechnology tech : Femtocraft.researchManager().getTechnologies()) { ResearchStatus ts = researchStatus.getTechnology(tech.getName()); if (ts == null) { continue; } TechNode node = Femtocraft.researchManager().getNode(tech); j4 = node.getDisplayX() * 24 - k; l3 = node.getDisplayY() * 24 - l; if (j4 >= -24 && l3 >= -24 && j4 <= 224 && l3 <= 155) { float f2; if (ts.researched()) { f2 = 1.0F; GL11.glColor4f(f2, f2, f2, 1.0F); } else { f2 = Math.sin((double) (Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) < 0.6D ? 0.6F : 0.8F; GL11.glColor4f(f2, f2, f2, 1.0F); } // else { // f2 = 0.3F; // GL11.glColor4f(f2, f2, f2, 1.0F); // } Minecraft.getMinecraft().getTextureManager().bindTexture(achievementTextures); i5 = k1 + j4; l4 = l1 + l3; GL11.glEnable(GL11.GL_BLEND);// Forge: Specifically enable blend because it is needed here. And we // fix Generic RenderItem's leakage of it. if (tech.isKeystone()) { this.drawTexturedModalRect(i5 - 2, l4 - 2, 26, 202, 26, 26); } else { this.drawTexturedModalRect(i5 - 2, l4 - 2, 0, 202, 26, 26); } GL11.glDisable(GL11.GL_BLEND); //Forge: Cleanup states we set. // // if (!this.statFileWriter.canUnlockAchievement(achievement2)) // { // float f3 = 0.1F; // GL11.glColor4f(f3, f3, f3, 1.0F); // renderitem.renderWithColor = false; // } GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure Lighting is disabled. Fixes MC-33065 GL11.glEnable(GL11.GL_CULL_FACE); RenderHelper.enableGUIStandardItemLighting(); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glBlendFunc(GL11.GL_DST_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // GL11.glEnable(GL12.GL_RESCALE_NORMAL); // GL11.glEnable(GL11.GL_COLOR_MATERIAL); // GL11.glEnable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_CULL_FACE); renderitem.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), tech.getDisplayItem(), i5 + 3, l4 + 3); RenderHelper.disableStandardItemLighting(); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LIGHTING); // if (!this.statFileWriter.canUnlockAchievement(achievement2)) // { // renderitem.renderWithColor = true; // } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (par1 >= k1 && par2 >= l1 && par1 < k1 + 224 && par2 < l1 + 155 && par1 >= i5 && par1 <= i5 + 22 && par2 >= l4 && par2 <= l4 + 22) { tooltipTech = tech; } } } GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(achievementTextures); this.drawTexturedModalRect(i1, j1, 0, 0, this.researchPaneWidth, this.researchPaneHeight); // GL11.glPopMatrix(); this.zLevel = 0.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); super.drawScreen(par1, par2, par3); if (tooltipTech != null) { ResearchStatus status = researchStatus.getTechnology(tooltipTech.getName()); String s = tooltipTech.getName(); String s1 = tooltipTech.getShortDescription(); j4 = par1 + 12; l3 = par2 - 4; i5 = Math.max(this.fontRendererObj.getStringWidth(s), 120); l4 = this.fontRendererObj.splitStringWidth(s1, i5); if (status.researched()) { l4 += 12; } this.drawGradientRect(j4 - 3, l3 - 3, j4 + i5 + 3, l3 + l4 + 3 + 12, -1073741824, -1073741824); this.fontRendererObj.drawSplitString(s1, j4, l3 + 12, i5, -6250336); if (status.researched()) { this.fontRendererObj.drawStringWithShadow("Researched!", j4, l3 + l4 + 4, -7302913); } // Keep Commented // else { // i5 = Math.max(this.fontRenderer.getStringWidth(s), 120); // String s2 = I18n.getStringParams("achievement.requires", // new Object[] { I18n // .getString(tooltipTech.parentAchievement // .getName()) }); // i4 = this.fontRenderer.splitStringWidth(s2, i5); // this.drawGradientRect(j4 - 3, l3 - 3, j4 + i5 + 3, l3 + i4 + 12 // + 3, -1073741824, -1073741824); // this.fontRenderer // .drawSplitString(s2, j4, l3 + 12, i5, -9416624); // } this.fontRendererObj.drawStringWithShadow(s, j4, l3, status.researched() ? (tooltipTech.isKeystone() ? -128 : -1) : (tooltipTech.isKeystone() ? -8355776 : -8355712)); } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); RenderHelper.disableStandardItemLighting(); }
From source file:com.itszuvalex.femtocraft.research.gui.GuiResearchConsole.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); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); int k = (this.width - xSize) / 2; int l = (this.height - ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, xSize, ySize); int progress = console.getResearchProgressScaled(78); this.drawTexturedModalRect(k + 64, l + 65, 0, 166, progress, 6); if (console.displayTech() != null || console.isResearching()) { String name;//from w w w .ja v a2 s . c om if (console.isResearching()) { name = console.getResearchingName(); } else { name = console.displayTech(); } ITechnology tech = Femtocraft.researchManager().getTechnology(name); if (tech != null) { String s = tech.getName(); this.fontRendererObj.drawString(s, k + 71 + (165 - 71 - this.fontRendererObj.getStringWidth(s)) / 2, l + 20, FemtocraftUtils.colorFromARGB(255, 255, 255, 255)); if (console.isResearching()) { s = String.format("%d%s", console.getResearchProgressScaled(100), "%"); this.fontRendererObj.drawString(s, k + 168 - this.fontRendererObj.getStringWidth(s), l + 40, FemtocraftUtils.colorFromARGB(255, 255, 255, 255)); } else { s = "Begin"; this.fontRendererObj.drawString(s, k + 85 - this.fontRendererObj.getStringWidth(s) / 2, l + 36 + (52 - 36 - this.fontRendererObj.FONT_HEIGHT) / 2, FemtocraftUtils.colorFromARGB(255, 255, 255, 255)); } RenderItem render = new RenderItem(); GL11.glDisable(GL11.GL_BLEND); //Forge: Cleanup states we set. GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure Lighting is disabled. Fixes MC-33065 GL11.glEnable(GL11.GL_CULL_FACE); RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); render.renderItemAndEffectIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(), tech.getDisplayItem(), k + 110, l + 33); RenderHelper.disableStandardItemLighting(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } } }
From source file:com.jadarstudios.rankcapes.forge.gui.GuiCapeSelect.java
License:MIT License
@Override public void drawScreen(int mouseX, int mouseY, float delta) { // draws the black background this.drawDefaultBackground(); // reset color GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); // set GUI texture mc.getTextureManager().bindTexture(background); // draw GUI texture this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 166); // new GL matrix GL11.glPushMatrix();//w ww.j ava 2 s . co m { // move matrix into position GL11.glTranslatef(this.guiLeft + 51, this.guiTop + 114, 130); // rotate matrix GL11.glRotatef(180, 0, 1, 0); // draw player GuiInventory.func_147046_a(-77, -5, 50, mouseX - (this.guiLeft + 127), this.guiTop + 32 - mouseY, mc.thePlayer); } // end GL11.glPopMatrix(); // draws buttons. if (this.buttonPages != null && this.buttonPages.size() > 0) { GuiButton[] buttonPage = this.buttonPages.get(this.currentPage); for (GuiButton bttn : buttonPage) { if (bttn != null) { bttn.drawButton(mc, mouseX, mouseY); } } } // super call. super.drawScreen(mouseX, mouseY, delta); }