List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:cn.academy.core.client.ui.NotifyUI.java
License:GNU General Public License
public void addDrawing() { listen(FrameEvent.class, (w, e) -> { GL11.glDisable(GL11.GL_ALPHA_TEST); if (lastNotify != null) { long dt = GameTimer.getTime() - lastReceiveTime; GL11.glEnable(GL11.GL_BLEND); if (dt < BLEND_IN_TIME) { drawBack(Math.min(dt / 300.0, 1)); //Draw the icon double iconAlpha = Math.max(0, Math.min(1, (dt - 200) / 300.0)); drawIcon(lastNotify, start, iconAlpha); } else if (dt < SCAN_TIME + BLEND_IN_TIME) { //Slide-In stage double scanProgress = (dt - BLEND_IN_TIME) / SCAN_TIME; scanProgress = Math.sin(scanProgress * Math.PI / 2); //Use sin to simulation speed-down effect drawBack(1);/*from w w w.j av a2 s . co m*/ drawIcon(lastNotify, VecUtils.lerp(start, end, scanProgress), 1); drawText(lastNotify, scanProgress); } else if (dt < KEEP_TIME - BLEND_OUT_TIME) { drawBack(1); drawIcon(lastNotify, end, 1); drawText(lastNotify, 1); } else if (dt < KEEP_TIME) { double alpha = 1 - (dt - (KEEP_TIME - BLEND_OUT_TIME)) / BLEND_OUT_TIME; drawBack(alpha); drawIcon(lastNotify, end, alpha); drawText(lastNotify, alpha); } else { //Blah, kill it lastNotify = null; } GL11.glColor4d(1, 1, 1, 1); } GL11.glEnable(GL11.GL_ALPHA_TEST); }); }
From source file:cn.academy.crafting.client.render.block.RenderImagPhaseLiquid.java
License:GNU General Public License
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float w) { if (!(te.getBlockType() instanceof BlockFluidClassic)) return;/*from w w w . ja v a 2s. c om*/ BlockFluidClassic liq = (BlockFluidClassic) te.getBlockType(); double distSq = Minecraft.getMinecraft().thePlayer.getDistanceSq(te.xCoord + .5, te.yCoord + .5, te.zCoord + .5); double alpha = 1 / (1 + 0.2 * Math.pow(distSq, 0.5)); if (alpha < 1E-1) return; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glColor4d(1, 1, 1, alpha); //GL11.glColor4d(1, 1, 1, 1); RenderHelper.disableStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.defaultTexUnit, 240f, 240f); double ht = 1.2 * Math.sqrt(rbf.getFluidHeightForRender(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, (BlockFluidBase) te.getBlockType())); GL11.glEnable(GL11.GL_BLEND); drawLayer(0, -0.3 * ht, 0.3, 0.2, 0.7); drawLayer(1, 0.35 * ht, 0.3, 0.05, 0.7); if (ht > 0.5) drawLayer(2, 0.7 * ht, 0.1, 0.25, 0.7); RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glPopMatrix(); }
From source file:cn.academy.crafting.client.render.item.RendererMatterUnit.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { ItemMatterUnit item = ModuleCrafting.matterUnit; GL11.glColor4d(1, 1, 1, 1);//w w w .j a va 2 s .co m if (type != ItemRenderType.INVENTORY) { GL11.glPushMatrix(); { if (type == ItemRenderType.ENTITY) GL11.glTranslated(-.5, -0.1, 0); RenderUtils.drawEquippedItem(stack, 0.0625f); GL11.glColorMask(false, false, false, false); RenderUtils.drawEquippedItem(0.0626f, texMask, texMask); GL11.glColorMask(true, true, true, true); GL11.glDepthFunc(GL11.GL_EQUAL); MatterMaterial mat = item.getMaterial(stack); RenderUtils.drawEquippedItemOverlay(0.0626f, mat.texture); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glPopMatrix(); } else { ShaderMask shader = ShaderMask.instance; float du = -(GameTimer.getAbsTime() % 10000L) / 1e4f, dv = (GameTimer.getAbsTime() % 10000L) / 1e4f; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.renderItemInventory(stack); shader.start(texMask); RenderUtils.loadTexture(item.getMaterial(stack).texture); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0 + du, 0 + dv); shader.maskTexCoord(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0 + du, 1 + dv); shader.maskTexCoord(0, 1); GL11.glVertex2f(0, 16); GL11.glTexCoord2f(1 + du, 1 + dv); shader.maskTexCoord(1, 1); GL11.glVertex2f(16, 16); GL11.glTexCoord2f(1 + du, 0 + dv); shader.maskTexCoord(1, 0); GL11.glVertex2f(16, 0); GL11.glEnd(); shader.end(); GL11.glDisable(GL11.GL_BLEND); } }
From source file:cn.academy.energy.client.render.block.RenderCatEngine.java
License:GNU General Public License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float pt) { long time = GameTimer.getTime(); TileCatEngine engine = (TileCatEngine) tile; if (engine.lastRender != 0) { engine.rotation += (time - engine.lastRender) * engine.thisTickGen * 1e-2; //System.out.println(engine.thisTickGen); engine.rotation %= 360;/*from w w w . ja v a2 s .c om*/ } engine.lastRender = time; x += 0.5; z += 0.5; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslated(x, y + 0.03 * Math.sin(GameTimer.getTime() * 0.006), z); double yaw = Math.atan2(x, z) * 180 / Math.PI; GL11.glRotated(yaw + 180, 0, 1, 0); GL11.glTranslated(0, .5, 0); GL11.glRotated(engine.rotation, 1, 0, 0); GL11.glTranslated(-.5, -.5, 0); Tessellator t = Tessellator.instance; RenderUtils.loadTexture(TEXTURE); t.startDrawingQuads(); t.addVertexWithUV(0, 0, 0, 0, 0); t.addVertexWithUV(1, 0, 0, 1, 0); t.addVertexWithUV(1, 1, 0, 1, 1); t.addVertexWithUV(0, 1, 0, 0, 1); t.draw(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.academy.misc.achievements.client.RenderItemAchievement.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { RenderUtils.loadTexture(ItemAchievement.getTexture(item.getItemDamage())); GL11.glEnable(GL11.GL_BLEND);//w ww . ja va 2s .c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); HudUtils.rect(16, 16); GL11.glDisable(GL11.GL_BLEND); }
From source file:cn.academy.misc.client.render.RendererRayBase.java
License:Open Source License
@Override public final void doRender(Entity var1, double x, double y, double z, float h, float a) { long time = Minecraft.getSystemTime(); T er = (T) var1; if (!er.isLoaded()) { return;// w ww .j a v a2 s . c om } er.beforeRender(); x = er.posX - RenderManager.renderPosX; y = er.posY - RenderManager.renderPosY; z = er.posZ - RenderManager.renderPosZ; EntityPlayer clientPlayer = Minecraft.getMinecraft().thePlayer; boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && clientPlayer.equals(er.getSpawner()); double len = er.getDisplayRayLen(); //System.out.println(firstPerson); if (er.doesFollowSpawner()) { //Pos injection, for better viewing effect x = 0; y = 0; z = 0; } GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_CULL_FACE); if (disableLight) GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glRotated(er.rotationYaw, 0, -1, 0); GL11.glRotated(er.rotationPitch, 1, 0, 0); GL11.glColor4d(1, 1, 1, alpha * er.getAlpha()); if (firstPerson) { if (er.isNearPlayer()) transformFirstPerson(er, x, y, z); } else { if (er.isNearPlayer()) transformThirdPerson(er, x, y, z); optimizeView(er, x, y, z); } if (disableLight) { OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); Tessellator.instance.setBrightness(15728880); } drawAtOrigin(er, len, firstPerson); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.misc.client.render.RenderMarker.java
License:Open Source License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMarker marker = (EntityMarker) ent; Entity targ = marker.target;//from w w w.ja v a 2 s. c o m double width = targ.width, height = targ.height; Tessellator t = Tessellator.instance; if (targ != null) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glPushMatrix(); GL11.glTranslated(x - width / 2, y, z - width / 2); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); for (int i = 0; i < 8; ++i) { GL11.glPushMatrix(); boolean rev = i < 4; double sx = width * mulArray[i][0], sy = height * mulArray[i][1], sz = width * mulArray[i][2]; final double len = 0.2 * width; GL11.glTranslated(sx, sy, sz); GL11.glRotated(rotArray[i], 0, 1, 0); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); GL11.glLineWidth(3f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawing(GL11.GL_LINES); t.setBrightness(15728880); t.addVertex(0, 0, 0); t.addVertex(0, rev ? len : -len, 0); t.addVertex(0, 0, 0); t.addVertex(len, 0, 0); t.addVertex(0, 0, 0); t.addVertex(0, 0, len); t.draw(); GL11.glPushMatrix(); GL11.glScaled(0.1, 0.1, 0.1); //ACModels.MDL_SOLAR.renderAll(); GL11.glPopMatrix(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); } }
From source file:cn.academy.terminal.client.TerminalInstallerRenderer.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glDisable(GL11.GL_CULL_FACE); super.renderItem(type, item, data); GL11.glEnable(GL11.GL_CULL_FACE);/*from ww w . j a va2 s .com*/ }
From source file:cn.academy.terminal.client.TerminalUI.java
License:GNU General Public License
@Override public void draw(ScaledResolution sr) { //Frame update selection = (int) ((mouseY - 0.01) / MAX_MY * 3) * 3 + (int) ((mouseX - 0.01) / MAX_MX * 3); if (mouseY == 0) { mouseY = 1;/* w w w . j a v a 2s .c o m*/ if (scroll > 0) scroll--; } if (mouseY == MAX_MY) { mouseY -= 1; if (scroll < getMaxScroll()) scroll++; } //Draw Minecraft mc = Minecraft.getMinecraft(); long time = GameTimer.getTime(); if (lastFrameTime == 0) lastFrameTime = time; long dt = time - lastFrameTime; mouseX += helper.dx * SENSITIVITY; mouseY -= helper.dy * SENSITIVITY; mouseX = Math.max(0, Math.min(MAX_MX, mouseX)); mouseY = Math.max(0, Math.min(MAX_MY, mouseY)); buffX = balance(dt, buffX, mouseX); buffY = balance(dt, buffY, mouseY); helper.dx = helper.dy = 0; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); float aspect = (float) mc.displayWidth / mc.displayHeight; GLU.gluPerspective(50, aspect, 1f, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4d(1, 1, 1, 1); double scale = 1.0 / 310; GL11.glTranslated(.35 * aspect, 1.2, -4); GL11.glTranslated(1, -1.8, 0); GL11.glRotated(-1.6, 0, 0, 1); GL11.glRotated(-18 - 4 * (buffX / MAX_MX - 0.5) + 1 * Math.sin(time / 1000.0), 0, 1, 0); GL11.glRotated(7 + 4 * (buffY / MAX_MY - 0.5), 1, 0, 0); //DEBUG CODE // GL11.glPointSize(20); // GL11.glColor4d(1, 1, 1, 1); // GL11.glDisable(GL11.GL_TEXTURE_2D); // GL11.glBegin(GL11.GL_POINTS); // GL11.glVertex3f(0, 0, 0); // GL11.glEnd(); // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glTranslated(-1, 1.8, 0); GL11.glScaled(scale, -scale, scale); gui.draw(mouseX, mouseY); { GL11.glPushMatrix(); double csize = (getSelectedApp() == null ? 1 : 1.3) * (20 + Math.sin(time / 300.0) * 2); RenderUtils.loadTexture(CURSOR); GL11.glColor4d(1, 1, 1, .4); GL11.glTranslated(0, 0, -2); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); HudUtils.rect(-csize / 2 + buffX, -csize / 2 + buffY + 120, csize, csize); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glCullFace(GL11.GL_BACK); }
From source file:cn.academy.vanilla.electromaster.client.effect.CurrentChargingHUD.java
License:GNU General Public License
@Override public void draw(ScaledResolution sr) { double width = sr.getScaledWidth_double(), height = sr.getScaledHeight_double(); GL11.glDisable(GL11.GL_ALPHA_TEST); arcHandler.xScale = width / 2;//from w w w . j a va 2s . c om arcHandler.yScale = height / 2; double mAlpha; if (isBlendingOut()) { mAlpha = 1 - (double) (GameTimer.getTime() - blendTime) / BLEND_OUT_TIME; if (mAlpha < 0) mAlpha = 0; } else { mAlpha = Math.min((double) this.getTimeActive() / BLEND_TIME, 1.0); } /* Black Mask */ { GL11.glColor4d(0, 0, 0, 0.1 * mAlpha); HudUtils.colorRect(0, 0, width, height); GL11.glColor4d(1, 1, 1, 1); } /* Blue Mask */ { GL11.glColor4d(1, 1, 1, 1 * mAlpha); RenderUtils.loadTexture(mask); HudUtils.rect(0, 0, width, height); } /* SubArc */ { GL11.glColor4d(1, 1, 1, isBlendingOut() ? 0.4 : 0.3); GL11.glPushMatrix(); GL11.glTranslated(width / 2, height / 2, 0); arcHandler.drawAll(); GL11.glPopMatrix(); } if (isBlendingOut() && GameTimer.getTime() - blendTime > 1000) dispose(); }