List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:cn.liutils.util.HudUtils.java
License:Open Source License
public static void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { float f = (par5 >> 24 & 255) / 255.0F; float f1 = (par5 >> 16 & 255) / 255.0F; float f2 = (par5 >> 8 & 255) / 255.0F; float f3 = (par5 & 255) / 255.0F; float f4 = (par6 >> 24 & 255) / 255.0F; float f5 = (par6 >> 16 & 255) / 255.0F; float f6 = (par6 >> 8 & 255) / 255.0F; float f7 = (par6 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from w w w . ja v a 2 s . com GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.setColorRGBA_F(f1, f2, f3, f); t.addVertex(par3, par2, -90D); t.addVertex(par1, par2, -90D); t.setColorRGBA_F(f5, f6, f7, f4); t.addVertex(par1, par4, -90D); t.addVertex(par3, par4, -90D); t.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:cn.liutils.util.RenderUtils.java
License:Open Source License
public static void renderOverlay_Equip(ResourceLocation src) { //Setup//from www .ja v a2 s.com GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); loadTexture(src); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glMatrixMode(GL11.GL_TEXTURE); //Push texture mat GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); //xOffset loops between 0.0 and 8.0 GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); //Second pass GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; //Loop between 0 and 8, longer loop GL11.glTranslatef(-f9, 0.0F, 0.0F); //Still xOffset GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); //However, different rotation! ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); //Pop texture mat GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:cn.liutils.util.RenderUtils.java
License:Open Source License
public static void renderOverlay_Inv(ResourceLocation src) { GL11.glDepthFunc(GL11.GL_EQUAL);/*w w w. j a va 2s. c om*/ GL11.glDisable(GL11.GL_LIGHTING); loadTexture(src); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; //GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); t.startDrawingQuads(); t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0); t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0); t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0); t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0); t.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); t.startDrawingQuads(); t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0); t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0); t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0); t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0); t.draw(); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:cn.liutils.util.RenderUtils.java
License:Open Source License
public static void renderSimpleOverlay_Inv(ResourceLocation src) { //GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderUtils.loadTexture(src);/*from www . j a v a2 s.c om*/ t.startDrawingQuads(); t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0); t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0); t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0); t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0); t.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:cn.weaponmod.api.client.render.RenderBulletWeapon.java
License:Open Source License
public static void renderMuzzleflashIn2d(Tessellator t, String texture, double tx, double ty, double tz) { Vec3 a1 = RenderUtils.newV3(1.2, -0.4, -0.5), a2 = RenderUtils.newV3(1.2, 0.4, -0.5), a3 = RenderUtils.newV3(1.2, 0.4, 0.3), a4 = RenderUtils.newV3(1.2, -0.4, 0.3); float u1 = 0.0F, v1 = 0.0F, u2 = 1.0F, v2 = 1.0F; t = Tessellator.instance;//from ww w .j a v a 2 s. co m GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.loadTexture(texture); GL11.glRotatef(45, 0.0F, 0.0F, 1.0F); GL11.glTranslated(tx, ty + 0.1F, tz + 0.1F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawingQuads(); t.setColorRGBA_F(0.8F, .8F, .8F, 1.0F); t.setBrightness(15728880); addVertex(a1, u2, v2); addVertex(a2, u2, v1); addVertex(a3, u1, v1); addVertex(a4, u1, v2); t.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.weaponmod.api.client.render.RenderDualWieldWeapon.java
License:Open Source License
@Override public void renderEquipped(ItemStack item, RenderBlocks render, EntityLivingBase entity, ItemRenderType type) { GL11.glPushMatrix();/*from w ww . ja v a 2 s .co m*/ super.doRenderEquipped(item, render, entity, false, type); boolean firstPerson = (entity == Minecraft.getMinecraft().thePlayer && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) && Minecraft.getMinecraft().currentScreen == null; GL11.glTranslatef(0.0F, 0.0F, firstPerson ? -1.7F : 0.8F); GL11.glScalef(1.0F, 1.0F, -1.0F); GL11.glDisable(GL11.GL_CULL_FACE); super.doRenderEquipped(item, render, entity, true, type); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.weaponmod.api.client.render.RendererBulletWeapon.java
License:Open Source License
public static void renderMuzzleflashIn2d(Tessellator t, ResourceLocation texture, double tx, double ty, double tz, float size) { Vec3 a1 = RenderUtils.newV3(1.2, -0.4, -0.5), a2 = RenderUtils.newV3(1.2, 0.4, -0.5), a3 = RenderUtils.newV3(1.2, 0.4, 0.3), a4 = RenderUtils.newV3(1.2, -0.4, 0.3); float u1 = 0.0F, v1 = 0.0F, u2 = 1.0F, v2 = 1.0F; t = Tessellator.instance;/*from w w w . j a va 2 s .c o m*/ GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.loadTexture(texture); GL11.glRotatef(45, 0.0F, 0.0F, 1.0F); GL11.glTranslated(tx, ty + 0.1F, tz + 0.1F); GL11.glScalef(size, size, size); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawingQuads(); t.setBrightness(15728880); addVertex(a1, u2, v2); addVertex(a2, u2, v1); addVertex(a3, u1, v1); addVertex(a4, u1, v2); t.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.weaponry.api.client.render.RendererWeapon.java
License:Open Source License
private void handleHeldRender(RenderInfo info, boolean firstPerson) { GL11.glPushMatrix();//from w w w. j av a2s.c om model.pushTransformState(); { if (firstPerson) { doFirstPersonTansform(); fpTransform.doTransform(); } else { doThirdPersonTransform(); tpTransform.doTransform(); } stdTransform.doTransform(); doFixedTransform(); info.renderAll(model, firstPerson, 0); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); info.renderAll(model, firstPerson, 1); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); RenderUtils.loadTexture(texture); model.renderAll(); GL11.glEnable(GL11.GL_CULL_FACE); } model.popTransformState(); GL11.glPopMatrix(); }
From source file:cn.weaponry.impl.classic.client.animation.Muzzleflash.java
License:Open Source License
@Override public void render(ItemInfo info, PartedModel model, boolean firstPerson) { double alpha = 1.0; if (texture == null && textures != null) { texture = textures[RandUtils.nextInt(textures.length)]; }/*from ww w . j av a 2 s .c om*/ //Blend in long dt = getTime(); if (dt < 40) { alpha = dt / 40.0; } else if (dt > lifeTime - 40.0) { alpha = (lifeTime - dt) / 40.0; } GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); RenderUtils.loadTexture(texture == null ? MISSING : texture); GL11.glTranslated(x, y, z); material.setTexture(texture); GL11.glScaled(size, size, size); material.color.a = alpha * 0.8; GL11.glRotatef(90, 0, 1, 0); mesh.draw(material); GL11.glColor4d(1, 1, 1, 1); GL11.glPopMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:co.uk.silvania.rpgcore.client.skillgui.GuiScrollingList_Mod.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; var10 = mouseY - this.top - this.field_27261_r + (int) this.scrollDistance - 4; var11 = var10 / this.slotHeight; //Tells the GUI which element we're hovering over, for tooltip rendering. if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength) { hoverElement = var11; }/*ww w. j a va 2 s.co m*/ 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; } 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 var18 = Tessellator.instance; 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; var18.startDrawingQuads(); var18.setColorOpaque_I(2105376); var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, (double) ((float) this.left / var17), (double) ((float) (this.bottom + (int) this.scrollDistance) / var17)); var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, (double) ((float) this.right / var17), (double) ((float) (this.bottom + (int) this.scrollDistance) / var17)); var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D, (double) ((float) this.right / var17), (double) ((float) (this.top + (int) this.scrollDistance) / var17)); var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / var17), (double) ((float) (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((double) var14, (double) (var19 + var13 + 2), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) var15, (double) (var19 + var13 + 2), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) var15, (double) (var19 - 2), 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) var14, (double) (var19 - 2), 0.0D, 0.0D, 0.0D); var18.setColorOpaque_I(0); var18.addVertexWithUV((double) (var14 + 1), (double) (var19 + var13 + 1), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) (var15 - 1), (double) (var19 + var13 + 1), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) (var15 - 1), (double) (var19 - 1), 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) (var14 + 1), (double) (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; 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); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV((double) this.left, (double) (this.top + var20), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) this.right, (double) (this.top + var20), 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(0, 255); var18.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D); var18.setColorRGBA_I(0, 0); var18.addVertexWithUV((double) this.right, (double) (this.bottom - var20), 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) this.left, (double) (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((double) scrollBarXStart, (double) this.bottom, 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) this.bottom, 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) this.top, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) scrollBarXStart, (double) this.top, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(8421504, 255); var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) (var14 + var13), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) scrollBarXEnd, (double) var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) scrollBarXStart, (double) var14, 0.0D, 0.0D, 0.0D); var18.draw(); var18.startDrawingQuads(); var18.setColorRGBA_I(12632256, 255); var18.addVertexWithUV((double) scrollBarXStart, (double) (var14 + var13 - 1), 0.0D, 0.0D, 1.0D); var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) (var14 + var13 - 1), 0.0D, 1.0D, 1.0D); var18.addVertexWithUV((double) (scrollBarXEnd - 1), (double) var14, 0.0D, 1.0D, 0.0D); var18.addVertexWithUV((double) scrollBarXStart, (double) 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); }