List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
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 av a 2s . c o 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.tile.RenderMatrix.java
License:Open Source License
@Override public void renderAtOrigin(TileEntity te) { TileMatrix tm = (TileMatrix) te;//from w w w.j a va 2 s .c om GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); { GL11.glTranslated(-1, 0, -1); double scale = 0.22; GL11.glScaled(scale, scale, scale); RenderUtils.loadTexture(tex); GL11.glDepthMask(true); model.renderPart("base"); GL11.glPushMatrix(); { GL11.glTranslated(0, 6.3, 0); drawCube(tm.isLoaded); } GL11.glPopMatrix(); GL11.glDepthMask(false); RenderUtils.loadTexture(tex); model.renderPart("plate"); } 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);/*from ww w . java 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;/*from w ww .j a v a 2 s. com*/ } 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.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;//from www .j ava2s . co 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.meltdowner.client.render.RenderMdShield.java
License:GNU General Public License
@Override public void doRender(Entity _entity, double x, double y, double z, float a, float b) { if (RenderUtils.isInShadowPass()) { return;// www . ja v a 2 s . c om } long time = GameTimer.getTime(); EntityMdShield entity = (EntityMdShield) _entity; // Calculate rotation long dt; if (entity.lastRender == 0) dt = 0; else dt = time - entity.lastRender; float rotationSpeed = MathUtils.lerpf(0.8f, 2f, Math.min(entity.ticksExisted / 30.0f, 1f)); entity.rotation += rotationSpeed * dt; if (entity.rotation >= 360f) entity.rotation -= 360f; ShaderSimple.instance().useProgram(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glAlphaFunc(GL11.GL_GREATER, 0.05f); 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.glRotatef(-entity.rotationYaw, 0, 1, 0); GL11.glRotatef(entity.rotationPitch, 1, 0, 0); GL11.glRotatef(entity.rotation, 0, 0, 1); float size = EntityMdShield.SIZE * MathUtils.lerpf(0.2f, 1f, Math.min(entity.ticksExisted / 15.0f, 1f)); float alpha = Math.min(entity.ticksExisted / 6.0f, 1.0f); GL11.glScalef(size, size, 1); RenderUtils.loadTexture(texture); mesh.draw(ShaderSimple.instance()); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f); GL20.glUseProgram(0); entity.lastRender = time; }
From source file:cn.lambdacraft.crafting.block.crafter.GuiElectricCrafter.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glPushMatrix();//from w ww. j a v a2 s .c om GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); RenderUtils.loadTexture(ClientProps.GUI_ELCRAFTER_PATH); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); int height = tileEntity.heatForRendering * 46 / tileEntity.maxHeat; if (height > 0) { drawTexturedModalRect(x + 138, y + 63 - height, 181, 0, 6, height); } height = tileEntity.currentEnergy * 46 / TileElCrafter.MAX_STORAGE; if (height > 0) { drawTexturedModalRect(x + 116, y + 63 - height, 174, 0, 6, height); } if (tileEntity.isCrafting && tileEntity.currentRecipe != null) { if (tileEntity.heatRequired > 0) { height = tileEntity.heatRequired * 46 / tileEntity.maxHeat; drawTexturedModalRect(x + 136, y + 63 - height, 207, 1, 6, 3); } } this.drawElements(i, j); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.crafting.client.gui.GuiBatBox.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glPushMatrix();/*from ww w .j a v a 2s . c o m*/ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(ClientProps.GUI_BATBOX_PATH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); if (te.currentEnergy > 0) { int len = te.currentEnergy * 68 / te.maxStorage; this.drawTexturedModalRect(x + 53, y + 38, 173, 10, len, 7); } this.drawElements(); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.crafting.client.gui.GuiElectricCrafter.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glPushMatrix();/*from w w w .j a va 2 s. c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bindTexture(ClientProps.GUI_ELCRAFTER_PATH); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); int height = tileEntity.heatForRendering * 46 / tileEntity.maxHeat; if (height > 0) { drawTexturedModalRect(x + 138, y + 63 - height, 181, 0, 6, height); } height = tileEntity.currentEnergy * 46 / TileElCrafter.MAX_STORAGE; if (height > 0) { drawTexturedModalRect(x + 116, y + 63 - height, 174, 0, 6, height); } if (tileEntity.isCrafting && tileEntity.currentRecipe != null) { if (tileEntity.heatRequired > 0) { height = tileEntity.heatRequired * 46 / tileEntity.maxHeat; drawTexturedModalRect(x + 136, y + 63 - height, 207, 1, 6, 3); } } GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:cn.lambdacraft.crafting.client.gui.GuiGenFire.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glPushMatrix();// www. j av a 2s .com GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bindTexture(ClientProps.GUI_GENFIRE_PATH); int x = (width - xSize) / 2; int y = (height - ySize) / 2; this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); int len = 0; if (te.maxBurnTime > 0) { len = te.tickLeft * 39 / te.maxBurnTime; this.drawTexturedModalRect(x + 109, y + 52, 173, 0, len, 3); } len = te.currentEnergy * 50 / te.maxStorage; if (len > 0) this.drawTexturedModalRect(x + 75, y + 65 - len, 173, 55 - len, 14, len); this.drawElements(); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }