List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:cn.lambdalib.util.client.HudUtils.java
License:MIT License
public static void drawHoveringText(List par1List, int x, int y, FontRenderer font, int width, int height) { if (!par1List.isEmpty()) { GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; float zLevel = -90.0F; Iterator iterator = par1List.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); int l = font.getStringWidth(s); if (l > k) { k = l;/* w ww . j a v a2 s . c o m*/ } } int i1 = x + 12; int j1 = y - 12; int k1 = 8; if (par1List.size() > 1) { k1 += 2 + (par1List.size() - 1) * 10; } if (i1 + k > width) { i1 -= 28 + k; } if (j1 + k1 + 6 > height) { j1 = height - k1 - 6; } zLevel = 300.0F; int l1 = -267386864; drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1); drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1); drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1); int i2 = 1347420415; int j2 = (i2 & 16711422) >> 1 | i2 & -16777216; drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2); drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2); drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2); drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); for (int k2 = 0; k2 < par1List.size(); ++k2) { String s1 = (String) par1List.get(k2); font.drawStringWithShadow(s1, i1, j1, -1); if (k2 == 0) { j1 += 2; } j1 += 10; } GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } }
From source file:cn.lambdalib.util.client.HudUtils.java
License:MIT License
public static void drawGradientRect(int x0, int y0, int x1, int y1, int color1, int color2) { float f = (color1 >> 24 & 255) / 255.0F; float f1 = (color1 >> 16 & 255) / 255.0F; float f2 = (color1 >> 8 & 255) / 255.0F; float f3 = (color1 & 255) / 255.0F; float f4 = (color2 >> 24 & 255) / 255.0F; float f5 = (color2 >> 16 & 255) / 255.0F; float f6 = (color2 >> 8 & 255) / 255.0F; float f7 = (color2 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from w w w . ja va2 s .co m 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(x1, y0, -90D); t.addVertex(x0, y0, -90D); t.setColorRGBA_F(f5, f6, f7, f4); t.addVertex(x0, y1, -90D); t.addVertex(x1, y1, -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.lambdalib.util.client.RenderUtils.java
License:MIT License
public static void renderOverlayEquip(ResourceLocation src) { //Setup/*w w w. ja va 2s. c om*/ 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 = GameTimer.getAbsTime() % 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 = GameTimer.getAbsTime() % 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.lambdalib.util.client.RenderUtils.java
License:MIT License
public static void renderOverlayInv(ResourceLocation src) { GL11.glDepthFunc(GL11.GL_EQUAL);// w ww . j a va 2 s . co m 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 = GameTimer.getAbsTime() % 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 = GameTimer.getAbsTime() % 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.lambdalib.util.client.RenderUtils.java
License:MIT License
public static void drawBlackout() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST);//from w ww. j a va 2 s . c om GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluOrtho2D(1, 0, 1, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glColor4d(0, 0, 0, 0.7); GL11.glTranslated(0, 0, 0); HudUtils.colorRect(0, 0, 1, 1); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor4d(1, 1, 1, 1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:cn.lambdalib.util.deprecated.SimpleMaterial.java
License:MIT License
@Override public void onRenderStage(RenderStage stage) { if (stage == RenderStage.BEFORE_TESSELLATE) { GL11.glEnable(GL11.GL_BLEND);/*from w w w .ja v a 2 s .c o m*/ //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); color.bind(); if (mainTexture != null) { RenderUtils.loadTexture(mainTexture); } else { GL11.glDisable(GL11.GL_TEXTURE_2D); } if (ignoreLight) { GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); } } else if (stage == RenderStage.START_TESSELLATE) { if (ignoreLight) { Tessellator.instance.setBrightness(15728880); } } else if (stage == RenderStage.END) { if (ignoreLight) { GL11.glEnable(GL11.GL_LIGHTING); } GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:cn.liutils.api.client.render.RenderIcon.java
License:Open Source License
@Override public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { GL11.glEnable(GL11.GL_BLEND);/*from ww w.j a v a 2 s . c om*/ GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_CULL_FACE); if (!enableDepth) GL11.glDisable(GL11.GL_DEPTH_TEST); if (!hasLight) GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); { GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glScalef(size, size, size); if (this.viewOptimize) { boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; if (firstPerson) { GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ); } else { GL11.glTranslated(tpOffsetX, tpOffsetY, tpOffsetZ); } } if (icon != null) RenderUtils.loadTexture(icon); Tessellator t = Tessellator.instance; this.func_77026_a(t); } GL11.glPopMatrix(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.liutils.api.draw.prop.DisableCullFace.java
License:Open Source License
@Override public void onEvent(EventType event, DrawObject obj) { switch (event) { case PRE_DRAW: GL11.glDisable(GL11.GL_CULL_FACE); break;//from w w w . j av a 2 s .co m case POST_DRAW: GL11.glEnable(GL11.GL_CULL_FACE); break; default: } }
From source file:cn.liutils.api.draw.prop.DisableLight.java
License:Open Source License
@Override public void onEvent(EventType event, DrawObject obj) { switch (event) { case PRE_DRAW: GL11.glDisable(GL11.GL_LIGHTING); break;/*from w w w . j a va 2 s . c om*/ case PRE_TESS: OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); break; case IN_TESS: Tessellator.instance.setBrightness(15728880); break; case POST_DRAW: GL11.glEnable(GL11.GL_LIGHTING); break; default: } }
From source file:cn.liutils.api.draw.prop.DisableTexture.java
License:Open Source License
@Override public void onEvent(EventType event, DrawObject obj) { switch (event) { case PRE_DRAW: GL11.glDisable(GL11.GL_TEXTURE_2D); break;/*w w w .j a v a 2 s . c o m*/ case POST_DRAW: GL11.glEnable(GL11.GL_TEXTURE_2D); break; default: } }