List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawLatencyTesterColoredQuad(float r, float g, float b, float a) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/*www . ja va 2s . c om*/ // Setup ortho projection GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0f, 0.0f, -0.7f); // Cover the appropriate areas of the screen with the colored quad GL11.glBegin(GL11.GL_QUADS); GL11.glColor4f(r, g, b, a); GL11.glVertex3f(-0.6f, -0.6f, 0.0f); // Bottom Left Of The Texture and Quad GL11.glVertex3f(0.6f, -0.6f, 0.0f); // Bottom Right Of The Texture and Quad GL11.glVertex3f(0.6f, 0.6f, 0.0f); // Top Right Of The Texture and Quad GL11.glVertex3f(-0.6f, 0.6f, 0.0f); // Top Left Of The Texture and Quad GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
private void drawMouseQuad(int mouseX, int mouseY) { GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST);// w ww .java 2s .c om GL11.glColor3f(1, 1, 1); this.mc.mcProfiler.endStartSection("mouse pointer"); this.mc.getTextureManager().bindTexture(Gui.icons); this.mc.ingameGUI.drawTexturedModalRect(mouseX - 7, mouseY - 7, 0, 0, 16, 16); GL11.glEnable(GL11.GL_BLEND); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawBoundingBox(EntityPlayer par1EntityPlayer, AxisAlignedBB bb, float par4) { GL11.glEnable(GL11.GL_BLEND);//from ww w . j a va 2s . c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); float var5 = 0.002F; double var7 = par1EntityPlayer.lastTickPosX + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4; double var9 = par1EntityPlayer.lastTickPosY + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4; double var11 = par1EntityPlayer.lastTickPosZ + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4; drawOutlinedBoundingBox( bb.expand((double) var5, (double) var5, (double) var5).getOffsetBoundingBox(-var7, -var9, -var11)); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.mtbs3d.minecrift.VRRenderer.java
License:LGPL
public void drawLine(EntityPlayer par1EntityPlayer, Vec3 start, Vec3 end, float par4) { GL11.glEnable(GL11.GL_BLEND);/*from w w w . jav a 2 s . c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); float var5 = 0.002F; double var7 = par1EntityPlayer.lastTickPosX + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4; double var9 = par1EntityPlayer.lastTickPosY + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4; double var11 = par1EntityPlayer.lastTickPosZ + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4; Tessellator var2 = Tessellator.instance; var2.startDrawing(GL11.GL_LINE_STRIP); var2.addVertex(start.xCoord, start.yCoord, start.zCoord); var2.addVertex(end.xCoord, end.yCoord, end.zCoord); var2.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.n8lm.zener.nifty.NiftyGUISystem.java
License:Open Source License
@Override protected void processSystem() { glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();/*w ww . java 2 s . co m*/ GL11.glOrtho(0, game.getContainer().getWidth(), game.getContainer().getHeight(), 0, -9999, 9999); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); glPushAttrib(GL_ENABLE_BIT); GL11.glDisable(GL11.GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_NOTEQUAL, 0); GL11.glDisable(GL11.GL_LIGHTING); // Back to GL Texture 0 Unit glActiveTexture(GL_TEXTURE0); glEnable(GL_TEXTURE_2D); //glBindTexture(); nifty.update(); nifty.render(false); glPopAttrib(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); }
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.gui.GuiModList.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float tick) { if (this.modList == null) return;/*w w w. j a v a2 s. c o m*/ this.modList.drawScreen(mouseX, mouseY, tick); this.drawCenteredString(this.fontRenderer, this.title, this.width / 2, 16, 0xFFFFFF); int offsetX = this.listWidth + 20; if (this.selectedMod != null) { GL11.glEnable(GL11.GL_BLEND); String requires = ""; String[] requiresOrig = this.selectedMod.requiredModules().split(","); int i = 0; for (String modId : requiresOrig) { if (modId.trim().length() <= 0 || modId == null) continue; Module mod = ModuleManager.getInstance().getModule(modId); if (mod != null) { requires += mod.name(); } else { requires += modId; } if (i < requiresOrig.length - 1) requires += ", "; i++; } if (requires.trim().length() == 0) requires = "Nothing"; String recommends = ""; String[] recommendsOrig = this.selectedMod.recommendedModules().split(","); i = 0; for (String modId : recommendsOrig) { if (modId.trim().length() <= 0 || modId == null) continue; Module mod = ModuleManager.getInstance().getModule(modId); if (mod != null) { recommends += mod.name(); } else { recommends += modId; } if (i < recommendsOrig.length - 1) recommends += ", "; i++; } if (recommends.trim().length() == 0) recommends = "Nothing"; String incompatibles = ""; String[] incompatiblesOrig = this.selectedMod.incompatibleModules().split(","); i = 0; for (String modId : incompatiblesOrig) { if (modId.trim().length() <= 0 || modId == null) continue; Module mod = ModuleManager.getInstance().getModule(modId); if (mod != null) { incompatibles += mod.name(); } else { incompatibles += modId; } if (i < incompatiblesOrig.length - 1) incompatibles += ", "; i++; } if (incompatibles.trim().length() == 0) incompatibles = "Nothing"; int offsetY = 0; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); TextureManager tm = this.mc.func_110434_K(); String logoBase64 = ModuleManager.getInstance().getModuleLogo(this.selectedMod); if (logoBase64 != null) { InputStream logoIn = new ByteArrayInputStream(DatatypeConverter.parseBase64Binary(logoBase64)); if (logoIn != null) { try { BufferedImage logo = ImageIO.read(logoIn); ResourceLocation rl = tm.func_110578_a(this.selectedMod.moduleId() + "-logo", new DynamicTexture(logo)); tm.func_110577_a(rl); Dimension dim = new Dimension(logo.getWidth(), logo.getHeight()); double scaleX = dim.width / 200.0; double scaleY = dim.height / 65.0; double scale = 1.0; if (scaleX > 1 || scaleY > 1) { scale = 1.0 / Math.max(scaleX, scaleY); } dim.width *= scale; dim.height *= scale; int top = 32; Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); tess.addVertexWithUV(offsetX, top + dim.height, this.zLevel, 0, 1); tess.addVertexWithUV(offsetX + dim.width, top + dim.height, this.zLevel, 1, 1); tess.addVertexWithUV(offsetX + dim.width, top, this.zLevel, 1, 0); tess.addVertexWithUV(offsetX, top, this.zLevel, 0, 0); tess.draw(); offsetY += dim.height + 2; } catch (IOException e) { e.printStackTrace(); } } } offsetY += 35; this.drawString(this.fontRenderer, this.selectedMod.name(), offsetX, offsetY, 0xFFFFFF); offsetY += 9; this.drawString(this.fontRenderer, "Version: " + (ModuleManager.getInstance().isModuleUpToDate(this.selectedMod.moduleId(), ModuleManager.getInstance().getModuleVersion(this.selectedMod.moduleId())) ? "2" : "4") + ModuleManager.getInstance().getModuleVersion(this.selectedMod.moduleId()) + "r", offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "State: " + (ModuleManager.getInstance().getLoadedModules().containsKey(this.selectedMod) ? "Loaded" : (ModuleManager.getInstance().getDisabledModules().containsValue( this.selectedMod) ? "4Disabledr" : "4Not loadedr")), offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "Required Minecraft Version: " + this.selectedMod.compatibleMCVersion(), offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "Required Ziah_'s Client Version: " + this.selectedMod.compatibleZCVersion(), offsetX, offsetY, 0xDDDDDD); offsetY += 9; offsetY += 9; i = 0; for (String curStr : ((List<String>) this.fontRenderer.listFormattedStringToWidth( "Description: " + this.selectedMod.description(), (this.width - 5) - offsetX))) { this.drawString(this.fontRenderer, curStr, offsetX, offsetY, 0xDDDDDD); offsetY += 9; i++; } offsetY += 9; this.drawString(this.fontRenderer, "Required Modules: " + requires, offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "Recommended Modules: " + recommends, offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "Incompatible with: " + incompatibles, offsetX, offsetY, 0xDDDDDD); offsetY += 9; GL11.glDisable(GL11.GL_BLEND); } super.drawScreen(mouseX, mouseY, tick); }
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.gui.GuiRepoModList.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float tick) { if (this.modList == null) return;//from ww w. j a va 2 s.com this.modList.drawScreen(mouseX, mouseY, tick); this.drawCenteredString(this.fontRenderer, this.title, this.width / 2, 16, 0xFFFFFF); int offsetX = this.listWidth + 20; if (this.selectedMod != null) { Module modAnnot = ModuleManager.getInstance().getModule(this.selectedMod.getId()); GL11.glEnable(GL11.GL_BLEND); int offsetY = 35; this.drawString(this.fontRenderer, this.selectedMod.getName(), offsetX, offsetY, 0xFFFFFF); offsetY += 9; this.drawString(this.fontRenderer, modAnnot != null ? "2Installedr" : "cNot Installedr", offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "Release Version: " + this.selectedMod.getVersion(), offsetX, offsetY, 0xDDDDDD); offsetY += 9; if (modAnnot != null) { this.drawString(this.fontRenderer, "Installed Version: " + ModuleManager.getInstance().getModuleVersion(modAnnot.moduleId()), offsetX, offsetY, 0xDDDDDD); offsetY += 9; if (!ModuleManager.getInstance().isModuleUpToDate(this.selectedMod.getId(), ModuleManager.getInstance().getModuleVersion(modAnnot.moduleId()))) { this.drawString( this.fontRenderer, "cA new version of " + this.selectedMod.getName() + " is available: " + this.selectedMod.getVersion() + "r", offsetX, offsetY, 0xDDDDDD); offsetY += 9; } } offsetY += 9; int i = 0; for (String curStr : this.descriptionLines) { this.drawString(this.fontRenderer, curStr, offsetX, offsetY, 0xDDDDDD); offsetY += 9; i++; } offsetY += 9; this.drawString(this.fontRenderer, "Required Modules: " + this.requires, offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "Recommended Modules: " + this.recommends, offsetX, offsetY, 0xDDDDDD); offsetY += 9; this.drawString(this.fontRenderer, "Incompatible with: " + this.incompatible, offsetX, offsetY, 0xDDDDDD); offsetY += 9; GL11.glDisable(GL11.GL_BLEND); } super.drawScreen(mouseX, mouseY, tick); }
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.gui.GuiScrollingList.java
License:Open Source License
public void drawScreen(int mouseX, int mouseY, float tick) { this.mouseX = mouseX; this.mouseY = mouseY; this.drawBackground(); int listLength = this.getSize(); int scrollBarXStart = this.left + this.listWidth - 6; int scrollBarXEnd = scrollBarXStart + 6; int boxLeft = this.left; int boxRight = scrollBarXStart - 1; int var10; int var11; int var13; int var19; if (Mouse.isButtonDown(0)) { if (this.initialMouseClickY == -1.0F) { boolean var7 = true; if (mouseY >= this.top && mouseY <= this.bottom) { var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4; var11 = var10 / this.slotHeight; if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) { boolean var12 = var11 == this.selectedIndex && System.currentTimeMillis() - this.lastClickTime < 250L; this.elementClicked(var11, var12); this.selectedIndex = var11; this.lastClickTime = System.currentTimeMillis(); } else if (mouseX >= boxLeft && mouseX <= boxRight && var10 < 0) { this.func_27255_a(mouseX - boxLeft, mouseY - this.top + (int) this.scrollDistance - 4); var7 = false; }/*from w ww . j ava 2s . c o m*/ if (mouseX >= scrollBarXStart && mouseX <= scrollBarXEnd) { this.scrollFactor = -1.0F; var19 = this.getContentHeight() - (this.bottom - this.top - 4); if (var19 < 1) { var19 = 1; } var13 = (int) ((float) ((this.bottom - this.top) * (this.bottom - this.top)) / (float) this.getContentHeight()); if (var13 < 32) { var13 = 32; } if (var13 > this.bottom - this.top - 8) { var13 = this.bottom - this.top - 8; } this.scrollFactor /= (float) (this.bottom - this.top - var13) / (float) var19; } else { this.scrollFactor = 1.0F; } if (var7) { this.initialMouseClickY = mouseY; } else { this.initialMouseClickY = -2.0F; } } else { this.initialMouseClickY = -2.0F; } } else if (this.initialMouseClickY >= 0.0F) { this.scrollDistance -= (mouseY - this.initialMouseClickY) * this.scrollFactor; this.initialMouseClickY = mouseY; } } else { while (Mouse.next()) { int var16 = Mouse.getEventDWheel(); if (var16 != 0) { if (var16 > 0) { var16 = -1; } else if (var16 < 0) { var16 = 1; } this.scrollDistance += var16 * this.slotHeight / 2; } } this.initialMouseClickY = -1.0F; } this.applyScrollLimits(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator var18 = Tessellator.instance; try { ((TextureManager) ModLoader.getPrivateValue(Minecraft.class, this.client, 7)) .func_110577_a(Gui.field_110325_k); } catch (Exception e) { e.printStackTrace(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float var17 = 32.0F; var18.startDrawingQuads(); var18.setColorOpaque_I(2105376); var18.addVertexWithUV(this.left, this.bottom, 0.0D, this.left / var17, (this.bottom + (int) this.scrollDistance) / var17); var18.addVertexWithUV(this.right, this.bottom, 0.0D, this.right / var17, (this.bottom + (int) this.scrollDistance) / var17); var18.addVertexWithUV(this.right, this.top, 0.0D, this.right / var17, (this.top + (int) this.scrollDistance) / var17); var18.addVertexWithUV(this.left, this.top, 0.0D, this.left / var17, (this.top + (int) this.scrollDistance) / var17); var18.draw(); // boxRight = this.listWidth / 2 - 92 - 16; var10 = this.top + 4 - (int) this.scrollDistance; if (this.field_27262_q) { this.func_27260_a(boxRight, var10, var18); } int var14; for (var11 = 0; var11 < listLength; ++var11) { var19 = var10 + var11 * this.slotHeight + this.field_27261_r; var13 = this.slotHeight - 4; if (var19 <= this.bottom && var19 + var13 >= this.top) { if (this.field_25123_p && this.isSelected(var11)) { var14 = boxLeft; int var15 = boxRight; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); var18.startDrawingQuads(); var18.setColorOpaque_I(8421504); var18.addVertexWithUV(var14, var19 + var13 + 2, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(var15, var19 + var13 + 2, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(var15, var19 - 2, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(var14, var19 - 2, 0.0D, 0.0D, 0.0D); var18.setColorOpaque_I(0); var18.addVertexWithUV(var14 + 1, var19 + var13 + 1, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(var15 - 1, var19 + var13 + 1, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(var15 - 1, var19 - 1, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(var14 + 1, var19 - 1, 0.0D, 0.0D, 0.0D); var18.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } this.drawSlot(var11, boxRight, var19, var13, var18); } } GL11.glDisable(GL11.GL_DEPTH_TEST); byte var20 = 4; this.overlayBackground(0, this.top, 255, 255); this.overlayBackground(this.bottom, this.listHeight, 255, 255); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_TEXTURE_2D); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV(this.left, this.top + var20, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(this.right, this.top + var20, 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV(this.right, this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(this.left, this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV(this.left, this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(this.right, this.bottom, 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV(this.right, this.bottom - var20, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(this.left, this.bottom - var20, 0.0D, 0.0D, 0.0D); var18.draw(); var19 = this.getContentHeight() - (this.bottom - this.top - 4); if (var19 > 0) { var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); if (var13 < 32) { var13 = 32; } if (var13 > this.bottom - this.top - 8) { var13 = this.bottom - this.top - 8; } var14 = (int) this.scrollDistance * (this.bottom - this.top - var13) / var19 + this.top; if (var14 < this.top) { var14 = this.top; } var18.startDrawingQuads(); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV(scrollBarXStart, this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, this.bottom, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(scrollBarXStart, this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(8421504, 255); var18.addVertexWithUV(scrollBarXStart, var14 + var13, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, var14 + var13, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd, var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(scrollBarXStart, var14, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(12632256, 255); var18.addVertexWithUV(scrollBarXStart, var14 + var13 - 1, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd - 1, var14 + var13 - 1, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV(scrollBarXEnd - 1, var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV(scrollBarXStart, var14, 0.0D, 0.0D, 0.0D); var18.draw(); } this.func_27257_b(mouseX, mouseY); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.util.Utils.java
License:Open Source License
/** * Draws a solid color rectangle with the specified coordinates and color. Args: x1, y1, x2, y2, color */// w w w .j av a 2 s . c o m public static void drawRect(int x1, int y1, int x2, int y2, int color, float zLevel) { int var5; if (x1 < x2) { var5 = x1; x1 = x2; x2 = var5; } if (y1 < y2) { var5 = y1; y1 = y2; y2 = var5; } float var10 = (color >> 24 & 255) / 255.0F; float var6 = (color >> 16 & 255) / 255.0F; float var7 = (color >> 8 & 255) / 255.0F; float var8 = (color & 255) / 255.0F; Tessellator var9 = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(var6, var7, var8, var10); var9.startDrawingQuads(); var9.addVertex(x1, y2, zLevel); var9.addVertex(x2, y2, zLevel); var9.addVertex(x2, y1, zLevel); var9.addVertex(x1, y1, zLevel); var9.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:com.oneofthesevenbillion.ziah.ZiahsClient.util.Utils.java
License:Open Source License
/** * Draws a rectangle with a vertical gradient between the specified colors. *///from w w w . j av a2 s .com public static void drawGradientRect(int x, int y, int x1, int y2, int color1, int color2, float zLevel) { float var7 = (color1 >> 24 & 255) / 255.0F; float var8 = (color1 >> 16 & 255) / 255.0F; float var9 = (color1 >> 8 & 255) / 255.0F; float var10 = (color1 & 255) / 255.0F; float var11 = (color2 >> 24 & 255) / 255.0F; float var12 = (color2 >> 16 & 255) / 255.0F; float var13 = (color2 >> 8 & 255) / 255.0F; float var14 = (color2 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator var15 = Tessellator.instance; var15.startDrawingQuads(); var15.setColorRGBA_F(var8, var9, var10, var7); var15.addVertex(x1, y, zLevel); var15.addVertex(x, y, zLevel); var15.setColorRGBA_F(var12, var13, var14, var11); var15.addVertex(x, y2, zLevel); var15.addVertex(x1, y2, zLevel); var15.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }