List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:cn.lambdalib.cgui.gui.CGui.java
License:MIT License
/** * Go down the hierarchy tree and draw each widget node. Should be called each rendering frame. */// www .jav a2 s . c om public void draw(double mx, double my) { frameUpdate(); updateMouse(mx, my); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); drawTraverse(mx, my, null, this, getTopWidget(mx, my)); if (debug) { Widget hovering = getHoveringWidget(); if (hovering != null) { GL11.glColor4f(1, .5f, .5f, .8f); HudUtils.drawRectOutline(hovering.x, hovering.y, hovering.transform.width * hovering.scale, hovering.transform.height * hovering.scale, 3); IFont font = TrueTypeFont.defaultFont(); font.draw(hovering.getFullName(), hovering.x, hovering.y - 10, new FontOption(10)); } } GL11.glEnable(GL11.GL_ALPHA_TEST); }
From source file:cn.lambdalib.cgui.gui.component.ProgressBar.java
License:MIT License
public ProgressBar() { super("ProgressBar"); listen(FrameEvent.class, (wi, e) -> { if (illustrating) { progress = 0.5 * (1 + Math.sin(GameTimer.getAbsTime() / 1000.0)); }//from w w w .ja v a 2 s .com { double disp = MathUtils.clampd(0, 1, progress); double x, y, u = 0, v = 0, w, h, tw, th; double width = wi.transform.width, height = wi.transform.height; switch (dir) { case RIGHT: w = width * disp; h = height; x = y = 0; u = 0; v = 0; tw = disp; th = 1; break; case LEFT: w = width * disp; h = height; x = width - w; y = 0; u = (1 - disp); v = 0; tw = disp; th = 1; break; case UP: w = width; h = height * disp; x = 0; y = height * (1 - disp); u = 0; v = (1 - disp); tw = 1; th = disp; break; case DOWN: w = width; h = height * disp; x = y = 0; u = 0; v = 0; tw = 1; th = disp; break; default: throw new RuntimeException("niconiconi, WTF??"); } if (texture != null && !texture.getResourcePath().equals("<null>")) { RenderUtils.loadTexture(texture); } else { GL11.glDisable(GL11.GL_TEXTURE_2D); } color.bind(); HudUtils.rawRect(x, y, u, v, w, h, tw, th); GL11.glEnable(GL11.GL_TEXTURE_2D); } }); }
From source file:cn.lambdalib.cgui.gui.component.Tint.java
License:MIT License
public Tint(Color idle, Color hover) { super("Tint"); idleColor = idle;//from ww w .j av a2 s .c o m hoverColor = hover; listen(FrameEvent.class, (w, event) -> { if (affectTexture) { DrawTexture dt = DrawTexture.get(w); if (dt != null) { dt.color = event.hovering ? hoverColor : idleColor; } } else { if (event.hovering) hoverColor.bind(); else idleColor.bind(); GL11.glDisable(GL11.GL_ALPHA_TEST); HudUtils.pushZLevel(); HudUtils.zLevel = zLevel; HudUtils.colorRect(0, 0, w.transform.width, w.transform.height); HudUtils.popZLevel(); } }); }
From source file:cn.lambdalib.template.client.render.entity.RenderCrossedProjectile.java
License:MIT License
@Override public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9) { Motion3D motion = new Motion3D(entity); Tessellator t = Tessellator.instance; GL11.glPushMatrix();//w w w .j a v a2 s . c om { Vec3 v1 = newV3(0, HEIGHT, 0), v2 = newV3(0, -HEIGHT, 0), v3 = newV3(LENGTH, -HEIGHT, 0), v4 = newV3(LENGTH, HEIGHT, 0), v5 = newV3(0, 0, -HEIGHT), v6 = newV3(0, 0, HEIGHT), v7 = newV3(LENGTH, 0, HEIGHT), v8 = newV3(LENGTH, 0, -HEIGHT); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (renderTexture) { bindTexture(TEXTURE_PATH); } else { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(colorR, colorG, colorB); } if (ignoreLight) { GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); } GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(90 + entity.rotationYaw, 0.0F, -1.0F, 0.0F); // ? GL11.glRotatef(-entity.rotationPitch, 0.0F, 0.0F, 1.0F); // if (this.playerViewOptm) { boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; if (firstPerson) { GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ); } else { GL11.glTranslated(tpOffsetX, tpOffsetY, tpOffsetZ); } } t.startDrawingQuads(); if (ignoreLight) t.setBrightness(15728880); RenderUtils.addVertex(v1, 0, 0); RenderUtils.addVertex(v2, 0, 1); RenderUtils.addVertex(v3, 1, 1); RenderUtils.addVertex(v4, 1, 0); RenderUtils.addVertex(v5, 0, 0); RenderUtils.addVertex(v6, 0, 1); RenderUtils.addVertex(v7, 1, 1); RenderUtils.addVertex(v8, 1, 0); t.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); }
From source file:cn.lambdalib.template.client.render.entity.RenderIcon.java
License:MIT 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 2s .c o m GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_CULL_FACE); if (!hasLight) GL11.glDisable(GL11.GL_LIGHTING); //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, minTolerateAlpha); GL11.glPushMatrix(); { GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glScalef(size, size, size); postTranslate(par1Entity); if (icon != null) RenderUtils.loadTexture(icon); Tessellator t = Tessellator.instance; this.func_77026_a(par1Entity, t); } GL11.glPopMatrix(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.lambdalib.template.client.render.item.RenderModelItem.java
License:MIT License
public void renderInventory() { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushMatrix();/*from w ww . j a va2 s .c o m*/ { RenderUtils.loadTexture(texturePath); GL11.glTranslated(8.0F + invOffset.x, 8.0F + invOffset.y, 0.0F); GL11.glScaled(16F * invScale, 16F * invScale, 16F * invScale); float rotation = 145F; if (inventorySpin) rotation = GameTimer.getAbsTime() / 100F; GL11.glRotatef(rotation, 0, 1, 0); this.doRotation(invRotation); GL11.glScalef(-1F, -1F, 1F); renderAtStdPosition(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.lambdalib.template.client.render.item.RenderModelItem.java
License:MIT License
protected void renderAtStdPosition(float i) { GL11.glScaled(scale, scale, scale);/*from w w w. j a v a2 s. c o m*/ GL11.glDisable(GL11.GL_CULL_FACE); this.doTransformation(stdOffset); GL11.glScalef(-1F, -1F, 1F); GL11.glRotated(stdRotation.yCoord + 180, 0.0F, 1.0F, 0.0F); GL11.glRotated(stdRotation.zCoord, 0.0F, 0.0F, 1.0F); GL11.glRotated(stdRotation.xCoord, 1.0F, 0.0F, 0.0F); model.render(null, 0.0625F, i); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.lambdalib.util.client.auxgui.AuxGuiHandler.java
License:MIT License
@SubscribeEvent public void drawHudEvent(RenderGameOverlayEvent event) { GL11.glDepthFunc(GL11.GL_ALWAYS);//www .j a va 2s . c o m GL11.glDepthMask(false); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.pushTextureState(); if (event.type == ElementType.EXPERIENCE) { Iterator<AuxGui> iter = auxGuiList.iterator(); startIterating(); while (iter.hasNext()) { AuxGui gui = iter.next(); if (!gui.isDisposed()) { if (!gui.lastFrameActive) gui.lastActivateTime = GameTimer.getTime(); gui.draw(event.resolution); gui.lastFrameActive = true; } } endIterating(); } RenderUtils.popTextureState(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:cn.lambdalib.util.client.HudUtils.java
License:MIT License
public static void colorRect(double x, double y, double width, double height) { boolean prev = GL11.glIsEnabled(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_2D); Tessellator t = Tessellator.instance; t.startDrawingQuads();//w w w . ja va2 s .c om t.addVertex(x + 0, y + height, zLevel); t.addVertex(x + width, y + height, zLevel); t.addVertex(x + width, y + 0, zLevel); t.addVertex(x + 0, y + 0, zLevel); t.draw(); if (prev) GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:cn.lambdalib.util.client.HudUtils.java
License:MIT License
public static void drawRectOutline(double x, double y, double w, double h, float lineWidth) { GL11.glLineWidth(lineWidth);//from w w w .ja v a 2 s . co m Tessellator t = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); t.startDrawing(GL11.GL_LINE_LOOP); double lw = lineWidth * 0.2; x -= lw; y -= lw; w += 2 * lw; h += 2 * lw; t.addVertex(x, y, zLevel); t.addVertex(x, y + h, zLevel); t.addVertex(x + w, y + h, zLevel); t.addVertex(x + w, y, zLevel); t.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); }