List of usage examples for org.lwjgl.opengl GL11 glShadeModel
public static native void glShadeModel(@NativeType("GLenum") int mode);
From source file:net.malisis.core.client.gui.component.UISlot.java
License:Open Source License
@Override public void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick) { MalisisInventoryContainer container = MalisisGui.currentGui().getInventoryContainer(); if (container == null) return;/*from w ww . j av a 2 s. c o m*/ ItemStack itemStack = slot.getItemStack() != null ? slot.getItemStack().copy() : null; ItemStack draggedItemStack = slot.getDraggedItemStack(); // if dragged slots contains an itemStack for this slot, add the stack size EnumChatFormatting format = null; if (itemStack == null) itemStack = draggedItemStack; else if (draggedItemStack != null) { itemStack.stackSize += draggedItemStack.stackSize; if (itemStack.stackSize == itemStack.getMaxStackSize()) format = EnumChatFormatting.YELLOW; } if (itemStack != null) renderer.drawItemStack(itemStack, screenX() + 1, screenY() + 1, format); // draw the white shade over the slot if (hovered || draggedItemStack != null) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); RenderParameters rp = new RenderParameters(); rp.colorMultiplier.set(0xFFFFFF); rp.alpha.set(80); rp.useTexture.set(false); shape.resetState(); shape.setSize(16, 16); shape.translate(1, 1, 100); renderer.drawShape(shape, rp); renderer.next(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); } GL11.glEnable(GL11.GL_ALPHA_TEST); // Dirty fix because Mojang can't count and masks overflow the slots shape.resetState(); shape.setSize(1, 18); shape.translate(0, 0, 50); rp.icon.set(iconLeft); renderer.drawShape(shape, rp); shape.resetState(); shape.setSize(18, 1); shape.translate(0, 0, 50); rp.icon.set(iconTop); renderer.drawShape(shape, rp); }
From source file:net.malisis.core.renderer.MalisisRenderer.java
License:Open Source License
/** * Prepares the {@link Tessellator} and the GL states for the <b>renderType</b>. <b>data</b> is only used for TESR and IRWL.<br> * TESR and IRWL rendering are surrounded by glPushAttrib(GL_LIGHTING_BIT) and block texture sheet is bound. * * @param renderType the render type//from w w w. jav a 2 s. c om * @param data the data */ public void prepare(RenderType renderType, double... data) { _initialize(); this.renderType = renderType; if (renderType == RenderType.ISBRH_WORLD) { tessellatorShift(); } else if (renderType == RenderType.ISBRH_INVENTORY) { GL11.glTranslatef(-0.5F, -0.5F, -0.5F); startDrawing(); } else if (renderType == RenderType.ITEM_INVENTORY) { GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); startDrawing(); } else if (renderType == RenderType.TESR_WORLD) { GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glTranslated(data[0], data[1], data[2]); bindTexture(TextureMap.locationBlocksTexture); startDrawing(); } else if (renderType == RenderType.WORLD_LAST) { GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); RenderHelper.disableStandardItemLighting(); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glPushMatrix(); GL11.glTranslated(data[0], data[1], data[2]); bindTexture(TextureMap.locationBlocksTexture); startDrawing(); } }
From source file:net.malisis.core.renderer.MalisisRenderer.java
License:Open Source License
/** * Enables the blending for the rendering. Ineffective for ISBRH. *//*www .ja va 2 s. c o m*/ public void enableBlending() { if (renderType == RenderType.ISBRH_WORLD) return; GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glShadeModel(GL11.GL_SMOOTH); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); }
From source file:net.malisis.doors.renderer.MixedBlockRenderer.java
License:Open Source License
@Override public void render() { if (!setup()) return;/* w w w .j a v a 2 s . com*/ if (MalisisDoorsSettings.simpleMixedBlockRendering.get()) { renderSimple(); return; } if (renderType == TYPE_ITEM_INVENTORY) { GL11.glAlphaFunc(GL11.GL_GREATER, 0.0F); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glShadeModel(GL11.GL_SMOOTH); enableBlending(); } set(block1, metadata1); drawPass(true); set(block2, metadata2); drawPass(false); }
From source file:net.minecraftforge.fml.client.GuiScrollingList.java
License:Open Source License
public void drawScreen(int mouseX, int mouseY, float p_22243_3_) { 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 w w. ja v a 2 s .c om*/ 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 = (float) mouseY; } else { this.initialMouseClickY = -2.0F; } } else { this.initialMouseClickY = -2.0F; } } else if (this.initialMouseClickY >= 0.0F) { this.scrollDistance -= ((float) mouseY - this.initialMouseClickY) * this.scrollFactor; this.initialMouseClickY = (float) 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 += (float) (var16 * this.slotHeight / 2); } } this.initialMouseClickY = -1.0F; } this.applyScrollLimits(); Tessellator tess = Tessellator.getInstance(); WorldRenderer worldr = tess.getWorldRenderer(); if (this.client.theWorld != null) { this.drawGradientRect(this.left, this.top, this.right, this.bottom, -1072689136, -804253680); } else { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); this.client.renderEngine.bindTexture(Gui.optionsBackground); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float var17 = 32.0F; worldr.startDrawingQuads(); worldr.setColorOpaque_I(2105376); worldr.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, (double) ((float) this.left / var17), (double) ((float) (this.bottom + (int) this.scrollDistance) / var17)); worldr.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, (double) ((float) this.right / var17), (double) ((float) (this.bottom + (int) this.scrollDistance) / var17)); worldr.addVertexWithUV((double) this.right, (double) this.top, 0.0D, (double) ((float) this.right / var17), (double) ((float) (this.top + (int) this.scrollDistance) / var17)); worldr.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / var17), (double) ((float) (this.top + (int) this.scrollDistance) / var17)); tess.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, tess); } 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); worldr.startDrawingQuads(); worldr.setColorOpaque_I(8421504); worldr.addVertexWithUV((double) var14, (double) (var19 + var13 + 2), 0.0D, 0.0D, 1.0D); worldr.addVertexWithUV((double) var15, (double) (var19 + var13 + 2), 0.0D, 1.0D, 1.0D); worldr.addVertexWithUV((double) var15, (double) (var19 - 2), 0.0D, 1.0D, 0.0D); worldr.addVertexWithUV((double) var14, (double) (var19 - 2), 0.0D, 0.0D, 0.0D); worldr.setColorOpaque_I(0); worldr.addVertexWithUV((double) (var14 + 1), (double) (var19 + var13 + 1), 0.0D, 0.0D, 1.0D); worldr.addVertexWithUV((double) (var15 - 1), (double) (var19 + var13 + 1), 0.0D, 1.0D, 1.0D); worldr.addVertexWithUV((double) (var15 - 1), (double) (var19 - 1), 0.0D, 1.0D, 0.0D); worldr.addVertexWithUV((double) (var14 + 1), (double) (var19 - 1), 0.0D, 0.0D, 0.0D); tess.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } this.drawSlot(var11, boxRight, var19, var13, tess); } } GL11.glDisable(GL11.GL_DEPTH_TEST); byte var20 = 4; if (this.client.theWorld == null) { 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); worldr.startDrawingQuads(); worldr.setColorRGBA_I(0, 0); worldr.addVertexWithUV((double) this.left, (double) (this.top + var20), 0.0D, 0.0D, 1.0D); worldr.addVertexWithUV((double) this.right, (double) (this.top + var20), 0.0D, 1.0D, 1.0D); worldr.setColorRGBA_I(0, 255); worldr.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D); worldr.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D); tess.draw(); worldr.startDrawingQuads(); worldr.setColorRGBA_I(0, 255); worldr.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D); worldr.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D); worldr.setColorRGBA_I(0, 0); worldr.addVertexWithUV((double) this.right, (double) (this.bottom - var20), 0.0D, 1.0D, 0.0D); worldr.addVertexWithUV((double) this.left, (double) (this.bottom - var20), 0.0D, 0.0D, 0.0D); tess.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; } worldr.startDrawingQuads(); worldr.setColorRGBA_I(0, 255); worldr.addVertexWithUV((double) scrollBarXStart, (double) this.bottom, 0.0D, 0.0D, 1.0D); worldr.addVertexWithUV((double) scrollBarXEnd, (double) this.bottom, 0.0D, 1.0D, 1.0D); worldr.addVertexWithUV((double) scrollBarXEnd, (double) this.top, 0.0D, 1.0D, 0.0D); worldr.addVertexWithUV((double) scrollBarXStart, (double) this.top, 0.0D, 0.0D, 0.0D); tess.draw(); worldr.startDrawingQuads(); worldr.setColorRGBA_I(8421504, 255); worldr.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13), 0.0D, 0.0D, 1.0D); worldr.addVertexWithUV((double) scrollBarXEnd, (double) (var14 + var13), 0.0D, 1.0D, 1.0D); worldr.addVertexWithUV((double) scrollBarXEnd, (double) var14, 0.0D, 1.0D, 0.0D); worldr.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D); tess.draw(); worldr.startDrawingQuads(); worldr.setColorRGBA_I(12632256, 255); worldr.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13 - 1), 0.0D, 0.0D, 1.0D); worldr.addVertexWithUV((double) (scrollBarXEnd - 1), (double) (var14 + var13 - 1), 0.0D, 1.0D, 1.0D); worldr.addVertexWithUV((double) (scrollBarXEnd - 1), (double) var14, 0.0D, 1.0D, 0.0D); worldr.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D); tess.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:net.minecraftforge.fml.client.GuiScrollingList.java
License:Open Source License
protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { float f = (float) (par5 >> 24 & 255) / 255.0F; float f1 = (float) (par5 >> 16 & 255) / 255.0F; float f2 = (float) (par5 >> 8 & 255) / 255.0F; float f3 = (float) (par5 & 255) / 255.0F; float f4 = (float) (par6 >> 24 & 255) / 255.0F; float f5 = (float) (par6 >> 16 & 255) / 255.0F; float f6 = (float) (par6 >> 8 & 255) / 255.0F; float f7 = (float) (par6 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D);/*from w w w . j av a 2 s .c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.startDrawingQuads(); worldrenderer.setColorRGBA_F(f1, f2, f3, f); worldrenderer.addVertex((double) par3, (double) par2, 0.0D); worldrenderer.addVertex((double) par1, (double) par2, 0.0D); worldrenderer.setColorRGBA_F(f5, f6, f7, f4); worldrenderer.addVertex((double) par1, (double) par4, 0.0D); worldrenderer.addVertex((double) par3, (double) par4, 0.0D); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:net.phatcode.rel.multimedia.Renderer.java
License:Open Source License
Renderer(int screenWidth, int screenHeight) { try {/*from w w w. j a va 2 s . c o m*/ Display.setDisplayMode(new DisplayMode(screenWidth, screenHeight)); Display.create(); Display.setTitle("AnyaBasic 0.4.0 beta"); } catch (LWJGLException e) { e.printStackTrace(); } this.screenWidth = screenWidth; this.screenHeight = screenHeight; GL11.glViewport(0, 0, screenWidth, screenHeight); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, screenWidth, screenHeight, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glShadeModel(GL11.GL_SMOOTH); //set shading to smooth(try GL_FLAT) GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //set Clear color to BLACK GL11.glClearDepth(1.0f); //Set Depth buffer to 1(z-Buffer) GL11.glDisable(GL11.GL_DEPTH_TEST); //Disable Depth Testing so that our z-buffer works GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.375f, 0.375f, 0); // magic trick }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 setSmoothLighting(boolean isSmooth) { if (isSmooth) { GL11.glShadeModel(GL11.GL_SMOOTH); } else {//from w w w. j a va 2 s.c om GL11.glShadeModel(GL11.GL_FLAT); } return this; }
From source file:net.wurstclient.gui.GuiWurstSlot.java
License:Open Source License
public void drawScreen(int p_148128_1_, int p_148128_2_, float p_148128_3_) { field_148150_g = p_148128_1_;/*from ww w .ja v a2 s . c om*/ field_148162_h = p_148128_2_; drawBackground(); int var4 = getSize(); int var5 = func_148137_d(); int var6 = var5 + 6; int var9; int var10; int var13; int var19; if (p_148128_1_ > field_148152_e && p_148128_1_ < field_148151_d && p_148128_2_ > field_148153_b && p_148128_2_ < field_148154_c) if (Mouse.isButtonDown(0) && func_148125_i()) { if (field_148157_o == -1.0F) { boolean var15 = true; if (p_148128_2_ >= field_148153_b && p_148128_2_ <= field_148154_c) { int var8 = field_148155_a / 2 - func_148139_c() / 2; var9 = field_148155_a / 2 + func_148139_c() / 2; var10 = p_148128_2_ - field_148153_b - field_148160_j + (int) field_148169_q - 4; int var11 = var10 / field_148149_f; if (p_148128_1_ >= var8 && p_148128_1_ <= var9 && var11 >= 0 && var10 >= 0 && var11 < var4) { boolean var12 = var11 == field_148168_r && Minecraft.getSystemTime() - field_148167_s < 250L; elementClicked(var11, var12, p_148128_1_, p_148128_2_); field_148168_r = var11; field_148167_s = Minecraft.getSystemTime(); } else if (p_148128_1_ >= var8 && p_148128_1_ <= var9 && var10 < 0) { func_148132_a(p_148128_1_ - var8, p_148128_2_ - field_148153_b + (int) field_148169_q - 4); var15 = false; } if (p_148128_1_ >= var5 && p_148128_1_ <= var6) { field_148170_p = -1.0F; var19 = func_148135_f(); if (var19 < 1) var19 = 1; var13 = (int) ((float) ((field_148154_c - field_148153_b) * (field_148154_c - field_148153_b)) / (float) func_148138_e()); if (var13 < 32) var13 = 32; if (var13 > field_148154_c - field_148153_b - 8) var13 = field_148154_c - field_148153_b - 8; field_148170_p /= (float) (field_148154_c - field_148153_b - var13) / (float) var19; } else field_148170_p = 1.0F; if (var15) field_148157_o = p_148128_2_; else field_148157_o = -2.0F; } else field_148157_o = -2.0F; } else if (field_148157_o >= 0.0F) { field_148169_q -= (p_148128_2_ - field_148157_o) * field_148170_p; field_148157_o = p_148128_2_; } } else { try { for (; !field_148161_k.gameSettings.touchscreen && Mouse.next(); field_148161_k.currentScreen .handleMouseInput()) { int var7 = Mouse.getEventDWheel(); if (var7 != 0) { if (var7 > 0) var7 = -1; else if (var7 < 0) var7 = 1; field_148169_q += var7 * field_148149_f / 2; } } } catch (IOException e) { e.printStackTrace(); } field_148157_o = -1.0F; } func_148121_k(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator ts = Tessellator.getInstance(); WorldRenderer wr = ts.getWorldRenderer(); field_148161_k.getTextureManager().bindTexture(Gui.optionsBackground); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float var16 = 32.0F; wr.startDrawingQuads(); wr.setColorOpaque_I(2105376); wr.addVertexWithUV(field_148152_e, field_148154_c, 0.0D, field_148152_e / var16, (field_148154_c + (int) field_148169_q) / var16); wr.addVertexWithUV(field_148151_d, field_148154_c, 0.0D, field_148151_d / var16, (field_148154_c + (int) field_148169_q) / var16); wr.addVertexWithUV(field_148151_d, field_148153_b, 0.0D, field_148151_d / var16, (field_148153_b + (int) field_148169_q) / var16); wr.addVertexWithUV(field_148152_e, field_148153_b, 0.0D, field_148152_e / var16, (field_148153_b + (int) field_148169_q) / var16); ts.draw(); var9 = field_148152_e + field_148155_a / 2 - func_148139_c() / 2 + 2; var10 = field_148153_b + 4 - (int) field_148169_q; if (field_148165_u) func_148129_a(var9, var10, Tessellator.getInstance()); func_148120_b(var9, var10, p_148128_1_, p_148128_2_); GL11.glDisable(GL11.GL_DEPTH_TEST); byte var18 = 4; func_148136_c(0, field_148153_b, 255, 255); func_148136_c(field_148154_c, field_148158_l, 255, 255); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 0, 1); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_TEXTURE_2D); wr.startDrawingQuads(); wr.setColorRGBA_I(0, 0); wr.addVertexWithUV(field_148152_e, field_148153_b + var18, 0.0D, 0.0D, 1.0D); wr.addVertexWithUV(field_148151_d, field_148153_b + var18, 0.0D, 1.0D, 1.0D); wr.setColorRGBA_I(0, 255); wr.addVertexWithUV(field_148151_d, field_148153_b, 0.0D, 1.0D, 0.0D); wr.addVertexWithUV(field_148152_e, field_148153_b, 0.0D, 0.0D, 0.0D); ts.draw(); wr.startDrawingQuads(); wr.setColorRGBA_I(0, 255); wr.addVertexWithUV(field_148152_e, field_148154_c, 0.0D, 0.0D, 1.0D); wr.addVertexWithUV(field_148151_d, field_148154_c, 0.0D, 1.0D, 1.0D); wr.setColorRGBA_I(0, 0); wr.addVertexWithUV(field_148151_d, field_148154_c - var18, 0.0D, 1.0D, 0.0D); wr.addVertexWithUV(field_148152_e, field_148154_c - var18, 0.0D, 0.0D, 0.0D); ts.draw(); var19 = func_148135_f(); if (var19 > 0) { var13 = (field_148154_c - field_148153_b) * (field_148154_c - field_148153_b) / func_148138_e(); if (var13 < 32) var13 = 32; if (var13 > field_148154_c - field_148153_b - 8) var13 = field_148154_c - field_148153_b - 8; int var14 = (int) field_148169_q * (field_148154_c - field_148153_b - var13) / var19 + field_148153_b; if (var14 < field_148153_b) var14 = field_148153_b; wr.startDrawingQuads(); wr.setColorRGBA_I(0, 255); wr.addVertexWithUV(var5, field_148154_c, 0.0D, 0.0D, 1.0D); wr.addVertexWithUV(var6, field_148154_c, 0.0D, 1.0D, 1.0D); wr.addVertexWithUV(var6, field_148153_b, 0.0D, 1.0D, 0.0D); wr.addVertexWithUV(var5, field_148153_b, 0.0D, 0.0D, 0.0D); ts.draw(); wr.startDrawingQuads(); wr.setColorRGBA_I(8421504, 255); wr.addVertexWithUV(var5, var14 + var13, 0.0D, 0.0D, 1.0D); wr.addVertexWithUV(var6, var14 + var13, 0.0D, 1.0D, 1.0D); wr.addVertexWithUV(var6, var14, 0.0D, 1.0D, 0.0D); wr.addVertexWithUV(var5, var14, 0.0D, 0.0D, 0.0D); ts.draw(); wr.startDrawingQuads(); wr.setColorRGBA_I(12632256, 255); wr.addVertexWithUV(var5, var14 + var13 - 1, 0.0D, 0.0D, 1.0D); wr.addVertexWithUV(var6 - 1, var14 + var13 - 1, 0.0D, 1.0D, 1.0D); wr.addVertexWithUV(var6 - 1, var14, 0.0D, 1.0D, 0.0D); wr.addVertexWithUV(var5, var14, 0.0D, 0.0D, 0.0D); ts.draw(); } func_148142_b(p_148128_1_, p_148128_2_); 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:org.craftmania.game.Game.java
License:Apache License
public void initOpenGL() throws IOException { // init OpenGL glMatrixMode(GL_PROJECTION);//from w w w .j a v a 2 s .c om glLoadIdentity(); glOrtho(0, 800, 600, 0, 1, 300); glMatrixMode(GL_MODELVIEW); GL11.glShadeModel(GL11.GL_SMOOTH); Vec3f fog = _configuration.getFogColor(); glClearColor(fog.x(), fog.y(), fog.z(), 1.0f); glEnable(GL_TEXTURE_2D); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // glEnable(GL_DEPTH_TEST); // glDepthFunc(GL_ALWAYS); glEnable(GL_CULL_FACE); glEnable(GL_FOG); glFog(GL_FOG_COLOR, GLUtils.wrapDirect(fog.x(), fog.y(), fog.z(), 1.0f)); glFogi(GL_FOG_MODE, GL11.GL_LINEAR); glFogf(GL_FOG_START, _configuration.getViewingDistance() * 0.55f); glFogf(GL_FOG_END, _configuration.getViewingDistance()); glFogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, NVFogDistance.GL_EYE_RADIAL_NV); glHint(GL_FOG_HINT, GL_NICEST); System.out.println("VBO Supported: " + GLUtils.isVBOSupported()); /* Instantiate the BufferManager */ BufferManager.getInstance(); }