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:gravestone.models.block.ModelGraveStone.java
License:LGPL
protected void renderEnchantment() { float tickModifier = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 48.0F; TileEntityGSGraveStoneRenderer.instance.bindTextureByName(Resources.SWORD_AURA); GL11.glEnable(GL11.GL_BLEND);//from w w w. j av a2 s .c o m GL11.glDepthMask(true); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glMatrixMode(GL11.GL_TEXTURE); for (int var21 = 0; var21 < 3; var21++) { GL11.glDisable(GL11.GL_LIGHTING); float var22 = 0.76F; GL11.glColor4f(0.5F * var22, 0.25F * var22, 0.8F * var22, 1.0F); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float var23 = tickModifier * (0.001F + (float) var21 * 0.0015F) * 15; float var24 = 0.33333334F; GL11.glScalef(var24, var24, var24); GL11.glRotatef(30 - (float) var21 * 60, 0, 0, 1); GL11.glTranslatef(0, var23, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); renderAll(); } GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glDepthMask(true); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:hellfirepvp.astralsorcery.client.effect.light.EffectLightbeam.java
License:Open Source License
public static void renderFast(List<EffectLightbeam> beams) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/*from w w w . j a va 2 s.co m*/ GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); SpriteLibrary.spriteLightbeam.getResource().bind(); //RenderingUtils.removeStandartTranslationFromTESRMatrix(Minecraft.getMinecraft().getRenderPartialTicks()); Tessellator t = Tessellator.getInstance(); VertexBuffer vb = t.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); Entity rView = Minecraft.getMinecraft().getRenderViewEntity(); if (rView == null) rView = Minecraft.getMinecraft().player; for (EffectLightbeam beam : beams) { if (rView.getDistanceSq(beam.from.getX(), beam.from.getY(), beam.from.getZ()) > Config.maxEffectRenderDistanceSq) return; beam.renderFast(vb); } t.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.container.GuiAltarAttunement.java
License:Open Source License
@Override public void renderGuiBackground(float partialTicks, int mouseX, int mouseY) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/*from www . java2s . c o m*/ GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float percFilled; if (containerAltarBase.tileAltar.getMultiblockState()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); percFilled = containerAltarBase.tileAltar.getAmbientStarlightPercent(); } else { GL11.glColor4f(1.0F, 0F, 0F, 1.0F); percFilled = 1.0F; } texBlack.bind(); drawRect(guiLeft + 11, guiTop + 104, 232, 10); if (percFilled > 0) { SpriteSheetResource spriteStarlight = SpriteLibrary.spriteStarlight; spriteStarlight.getResource().bind(); int t = containerAltarBase.tileAltar.getTicksExisted(); Tuple<Double, Double> uvOffset = spriteStarlight.getUVOffset(t); drawRect(guiLeft + 11, guiTop + 104, (int) (232 * percFilled), 10, uvOffset.key, uvOffset.value, spriteStarlight.getULength() * percFilled, spriteStarlight.getVLength()); AbstractAltarRecipe aar = findCraftableRecipe(true); if (aar != null) { int req = aar.getPassiveStarlightRequired(); int has = containerAltarBase.tileAltar.getStarlightStored(); if (has < req) { int max = containerAltarBase.tileAltar.getMaxStarlightStorage(); float percReq = (float) (req - has) / (float) max; int from = (int) (232 * percFilled); int to = (int) (232 * percReq); GL11.glColor4f(0.2F, 0.5F, 1.0F, 0.4F); drawRect(guiLeft + 11 + from, guiTop + 104, to, 10, uvOffset.key + spriteStarlight.getULength() * percFilled, uvOffset.value, spriteStarlight.getULength() * percReq, spriteStarlight.getVLength()); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); texAltarAttenuation.bind(); drawRect(guiLeft, guiTop, xSize, ySize); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.container.GuiAltarConstellation.java
License:Open Source License
@Override public void renderGuiBackground(float partialTicks, int mouseX, int mouseY) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();//from w w w. j ava2 s . c o m GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float percFilled; if (containerAltarBase.tileAltar.getMultiblockState()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); percFilled = containerAltarBase.tileAltar.getAmbientStarlightPercent(); } else { GL11.glColor4f(1.0F, 0F, 0F, 1.0F); percFilled = 1.0F; } texBlack.bind(); drawRect(guiLeft + 11, guiTop + 104, 232, 10); if (percFilled > 0) { SpriteSheetResource spriteStarlight = SpriteLibrary.spriteStarlight; spriteStarlight.getResource().bind(); int t = containerAltarBase.tileAltar.getTicksExisted(); Tuple<Double, Double> uvOffset = spriteStarlight.getUVOffset(t); drawRect(guiLeft + 11, guiTop + 104, (int) (232 * percFilled), 10, uvOffset.key, uvOffset.value, spriteStarlight.getULength() * percFilled, spriteStarlight.getVLength()); AbstractAltarRecipe aar = findCraftableRecipe(true); if (aar != null) { int req = aar.getPassiveStarlightRequired(); int has = containerAltarBase.tileAltar.getStarlightStored(); if (has < req) { int max = containerAltarBase.tileAltar.getMaxStarlightStorage(); float percReq = (float) (req - has) / (float) max; int from = (int) (232 * percFilled); int to = (int) (232 * percReq); GL11.glColor4f(0.2F, 0.5F, 1.0F, 0.4F); drawRect(guiLeft + 11 + from, guiTop + 104, to, 10, uvOffset.key + spriteStarlight.getULength() * percFilled, uvOffset.value, spriteStarlight.getULength() * percReq, spriteStarlight.getVLength()); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); texAltarConstellation.bind(); drawRect(guiLeft, guiTop, xSize, ySize); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.container.GuiAltarDiscovery.java
License:Open Source License
@Override public void renderGuiBackground(float partialTicks, int mouseX, int mouseY) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/* ww w .ja v a2s .c o m*/ GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); texBlack.bind(); drawRect(guiLeft + 6, guiTop + 69, 165, 10); float percFilled; if (containerAltarBase.tileAltar.getMultiblockState()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); percFilled = containerAltarBase.tileAltar.getAmbientStarlightPercent(); } else { GL11.glColor4f(1.0F, 0F, 0F, 1.0F); percFilled = 1.0F; } if (percFilled > 0) { SpriteSheetResource spriteStarlight = SpriteLibrary.spriteStarlight; spriteStarlight.getResource().bind(); int t = containerAltarBase.tileAltar.getTicksExisted(); Tuple<Double, Double> uvOffset = spriteStarlight.getUVOffset(t); drawRect(guiLeft + 6, guiTop + 69, (int) (165 * percFilled), 10, uvOffset.key, uvOffset.value, spriteStarlight.getULength() * percFilled, spriteStarlight.getVLength()); AbstractAltarRecipe aar = findCraftableRecipe(true); if (aar != null) { int req = aar.getPassiveStarlightRequired(); int has = containerAltarBase.tileAltar.getStarlightStored(); if (has < req) { int max = containerAltarBase.tileAltar.getMaxStarlightStorage(); float percReq = (float) (req - has) / (float) max; int from = (int) (165 * percFilled); int to = (int) (165 * percReq); GL11.glColor4f(0.2F, 0.5F, 1.0F, 0.4F); drawRect(guiLeft + 6 + from, guiTop + 69, to, 10, uvOffset.key + spriteStarlight.getULength() * percFilled, uvOffset.value, spriteStarlight.getULength() * percReq, spriteStarlight.getVLength()); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); texAltarDiscovery.bind(); drawRect(guiLeft, guiTop, xSize, ySize); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.container.GuiAltarTrait.java
License:Open Source License
@Override public void renderGuiBackground(float partialTicks, int mouseX, int mouseY) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();//from ww w. j a va2 s.c o m GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float percFilled; if (containerAltarBase.tileAltar.getMultiblockState()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); percFilled = containerAltarBase.tileAltar.getAmbientStarlightPercent(); } else { GL11.glColor4f(1.0F, 0F, 0F, 1.0F); percFilled = 1.0F; } texBlack.bind(); drawRect(guiLeft + 11, guiTop + 104, 232, 10); if (percFilled > 0) { SpriteSheetResource spriteStarlight = SpriteLibrary.spriteStarlight; spriteStarlight.getResource().bind(); int t = containerAltarBase.tileAltar.getTicksExisted(); Tuple<Double, Double> uvOffset = spriteStarlight.getUVOffset(t); drawRect(guiLeft + 11, guiTop + 104, (int) (232 * percFilled), 10, uvOffset.key, uvOffset.value, spriteStarlight.getULength() * percFilled, spriteStarlight.getVLength()); AbstractAltarRecipe aar = findCraftableRecipe(true); if (aar != null) { int req = aar.getPassiveStarlightRequired(); int has = containerAltarBase.tileAltar.getStarlightStored(); if (has < req) { int max = containerAltarBase.tileAltar.getMaxStarlightStorage(); float percReq = (float) (req - has) / (float) max; int from = (int) (232 * percFilled); int to = (int) (232 * percReq); GL11.glColor4f(0.2F, 0.5F, 1.0F, 0.4F); drawRect(guiLeft + 11 + from, guiTop + 104, to, 10, uvOffset.key + spriteStarlight.getULength() * percFilled, uvOffset.value, spriteStarlight.getULength() * percReq, spriteStarlight.getVLength()); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); texAltarTrait.bind(); drawRect(guiLeft, guiTop, xSize, ySize); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiConstellationPaper.java
License:Open Source License
private void drawConstellation(float parTicks) { GL11.glEnable(GL11.GL_BLEND);// w ww . j a v a2 s .com GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderConstellation.renderConstellationIntoGUI(new Color(0.4F, 0.4F, 0.4F, 0.8F), constellation, width / 2 - 110 / 2, guiTop + 84, zLevel, 110, 110, 2F, new RenderConstellation.BrightnessFunction() { @Override public float getBrightness() { //return 0.8F - (0.6F * (tierN / h)); return 0.5F; } }, true, false); GL11.glDisable(GL11.GL_BLEND); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionClusterRenderer.java
License:Open Source License
private void drawConnection(double originX, double originY, double targetX, double targetY, float zLevel) { GL11.glPushMatrix();/*from w w w .java2 s. c om*/ GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glLineWidth(3.5F); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); long clientTicks = ClientScheduler.getClientTick(); Vector3 origin = new Vector3(originX, originY, 0); Vector3 line = origin.vectorFromHereTo(targetX, targetY, 0); int segments = (int) Math.ceil(line.length() / 1); //1 = max line segment length int activeSegment = (int) (clientTicks % segments); Vector3 segmentIter = line.divide(segments); for (int i = segments; i >= 0; i--) { double lx = origin.getX(); double ly = origin.getY(); origin.add(segmentIter); float brightness = 0.4F; brightness += (0.6F * evaluateBrightness(i, activeSegment)); drawLinePart(lx, ly, origin.getX(), origin.getY(), zLevel, brightness); } GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionRenderer.java
License:Open Source License
private void renderCluster(ResearchProgression p, ClientJournalMapping.JournalCluster cluster, double lowerPosX, double lowerPosY, double higherPosX, double higherPosY, float zLevel) { double scaledLeft = this.mousePointScaled.getScaledPosX() - sizeHandler.widthToBorder; double scaledTop = this.mousePointScaled.getScaledPosY() - sizeHandler.heightToBorder; double xAdd = lowerPosX - scaledLeft; double yAdd = lowerPosY - scaledTop; double offsetX = realCoordLowerX + xAdd; double offsetY = realCoordLowerY + yAdd; GL11.glPushMatrix();//from w w w . ja va 2 s . c om GL11.glTranslated(offsetX, offsetY, 0); double width = higherPosX - lowerPosX; double height = higherPosY - lowerPosY; Rectangle r = new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), MathHelper.floor(width), MathHelper.floor(height)); clusterRectMap.put(r, p); Tessellator t = Tessellator.getInstance(); VertexBuffer vb = t.getBuffer(); cluster.cloudTexture.bind(); double scale = sizeHandler.getScalingFactor(); float br = 1F; if (scale > 8.01) { br = 0F; } else if (scale >= 6) { br = (float) (1F - ((scale - 6) / 2)); } GL11.glColor4f(br, br, br, br); Blending.ADDITIVEDARK.apply(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(0, height, zLevel).tex(0, 1).endVertex(); vb.pos(width, height, zLevel).tex(1, 1).endVertex(); vb.pos(width, 0, zLevel).tex(1, 0).endVertex(); vb.pos(0, 0, zLevel).tex(0, 0).endVertex(); t.draw(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionRenderer.java
License:Open Source License
private void drawClusterBackground(BindableResource tex, float zLevel) { double scale = sizeHandler.getScalingFactor(); float br = 0F; if (scale > 8.01) { br = 1F;// www . ja va2s . c o m } else if (scale >= 6) { br = (float) (((scale - 6) / 2)); } br *= 0.75F; GL11.glColor4f(br, br, br, br); tex.bind(); Blending.ADDITIVEDARK.apply(); VertexBuffer vb = Tessellator.getInstance().getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(realCoordLowerX, realCoordLowerY + realRenderHeight, zLevel).tex(0, 1).endVertex(); vb.pos(realCoordLowerX + realRenderWidth, realCoordLowerY + realRenderHeight, zLevel).tex(1, 1).endVertex(); vb.pos(realCoordLowerX + realRenderWidth, realCoordLowerY, zLevel).tex(1, 0).endVertex(); vb.pos(realCoordLowerX, realCoordLowerY, zLevel).tex(0, 0).endVertex(); Tessellator.getInstance().draw(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); }