Example usage for org.lwjgl.opengl GL11 glPopAttrib

List of usage examples for org.lwjgl.opengl GL11 glPopAttrib

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glPopAttrib.

Prototype

public static native void glPopAttrib();

Source Link

Document

Resets the values of those state variables that were saved with the last #glPushAttrib PushAttrib .

Usage

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();//  w ww .  j  a v  a 2  s .  c  o 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.effect.light.EffectLightning.java

License:Open Source License

public static void renderFast(float pTicks, List<EffectLightning> toBeRendered) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//from   w w  w  .j a  v a2  s.c  o m
    RenderingUtils.removeStandartTranslationFromTESRMatrix(pTicks);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    Blending.ADDITIVE_ALPHA.apply();
    connection.bind();

    Tessellator tes = Tessellator.getInstance();
    VertexBuffer buf = tes.getBuffer();
    buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);

    for (EffectLightning fl : new ArrayList<>(toBeRendered)) {
        fl.renderF(pTicks, buf);
    }

    buf.sortVertexData((float) TileEntityRendererDispatcher.staticPlayerX,
            (float) TileEntityRendererDispatcher.staticPlayerY,
            (float) TileEntityRendererDispatcher.staticPlayerZ);
    tes.draw();

    TextureHelper.refreshTextureBindState();
    Blending.DEFAULT.apply();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.effect.texture.TexturePlane.java

License:Open Source License

@Override
public void render(float partialTicks) {
    Entity rView = Minecraft.getMinecraft().getRenderViewEntity();
    if (rView == null)
        rView = Minecraft.getMinecraft().player;
    double dst = rView.getDistanceSq(pos.getX(), pos.getY(), pos.getZ());
    if (dst > Config.maxEffectRenderDistanceSq)
        return;/*w w w  .j  ava  2s . com*/

    float alphaMul = alphaFunction.getAlpha(counter, maxAge);
    float alphaGrad = (colorOverlay.getAlpha() / 255F) * alphaMul * this.alphaMultiplier;
    if (alphaGradient) {
        alphaGrad = getAlphaDistanceMultiplier(dst) * alphaMul * this.alphaMultiplier;
    }

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();
    //removeOldTranslate(rView, partialTicks);
    GL11.glColor4f(colorOverlay.getRed() / 255F, colorOverlay.getGreen() / 255F, colorOverlay.getBlue() / 255F,
            alphaGrad);
    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();
    Vector3 axis = this.axis.clone();
    float deg;
    if (ticksPerFullRot >= 0) {
        float anglePercent = ((float) (counter)) / ((float) ticksPerFullRot);
        deg = anglePercent * 360F;
        deg = RenderingUtils.interpolateRotation(lastRenderDegree, deg, partialTicks);
        this.lastRenderDegree = deg;
    } else {
        deg = fixDegree;
    }

    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);

    currRenderAroundAxis(partialTicks, Math.toRadians(deg), axis);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.event.ClientRenderEventHandler.java

License:Open Source License

@SideOnly(Side.CLIENT)
private void renderAlignmentChargeOverlay(float partialTicks) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();// w w  w  . j  ava2  s.  c  o  m
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();

    float height = 128F;
    float width = 32F;
    float offsetX = 0F;
    float offsetY = 5F;

    texChargeFrame.bind();
    GL11.glColor4f(1F, 1F, 1F, visibilityPermCharge * 0.9F);

    //Draw hud itself
    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();
    vb.begin(7, DefaultVertexFormats.POSITION_TEX);
    vb.pos(offsetX, offsetY + height, 10).tex(0, 1).endVertex();
    vb.pos(offsetX + width, offsetY + height, 10).tex(1, 1).endVertex();
    vb.pos(offsetX + width, offsetY, 10).tex(1, 0).endVertex();
    vb.pos(offsetX, offsetY, 10).tex(0, 0).endVertex();
    tes.draw();

    //Draw charge
    float filled = ConstellationPerkLevelManager.getPercToNextLevel(ResearchManager.clientProgress);
    height = 78F;
    offsetY = 27.5F + (1F - filled) * height;
    GL11.glColor4f(255F / 255F, 230F / 255F, 0F / 255F, visibilityPermCharge * 0.9F);
    texChargeCharge.bind();
    height *= filled;

    vb.begin(7, DefaultVertexFormats.POSITION_TEX);
    vb.pos(offsetX, offsetY + height, 10).tex(0, 1).endVertex();
    vb.pos(offsetX + width, offsetY + height, 10).tex(1, 1).endVertex();
    vb.pos(offsetX + width, offsetY, 10).tex(1, 1F - filled).endVertex();
    vb.pos(offsetX, offsetY, 10).tex(0, 1F - filled).endVertex();
    tes.draw();

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    TextureHelper.refreshTextureBindState();
    //Draw level
    int level = ResearchManager.clientProgress.getAlignmentLevel();
    GL11.glColor4f(0.86F, 0.86F, 0.86F, visibilityPermCharge);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();
    GL11.glTranslated(offsetX + 13, 94, 0);
    GL11.glScaled(1.2, 1.2, 1.2);
    int c = 0x00DDDDDD;
    c |= ((int) (255F * visibilityPermCharge)) << 24;
    if (visibilityPermCharge > 0.1E-4) {
        Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(String.valueOf(level + 1), 0, 0, c);
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    TextureHelper.refreshTextureBindState();
    Blending.DEFAULT.apply();
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GlStateManager.color(1F, 1F, 1F, 1F);
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.gui.container.GuiAltarAttunement.java

License:Open Source License

@Override
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    AbstractAltarRecipe rec = findCraftableRecipe();
    if (rec != null) {
        ItemStack out = rec.getOutputForRender();
        zLevel = 10F;/*ww  w. ja va  2 s.  c  o m*/
        itemRender.zLevel = 10F;

        RenderHelper.enableGUIStandardItemLighting();

        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glPushMatrix();
        GL11.glTranslated(190, 35, 0);
        GL11.glScaled(2.5, 2.5, 2.5);

        itemRender.renderItemAndEffectIntoGUI(mc.player, out, 0, 0);
        itemRender.renderItemOverlayIntoGUI(fontRenderer, out, 0, 0, null);

        GL11.glPopMatrix();
        GL11.glPopAttrib();

        //RenderHelper.disableStandardItemLighting();

        zLevel = 0F;
        itemRender.zLevel = 0F;

        TextureHelper.refreshTextureBindState();
    }
}

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();//  w ww  .  j a va 2  s. c  om

    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 drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    AbstractAltarRecipe rec = findCraftableRecipe();
    if (rec != null) {
        ItemStack out = rec.getOutputForRender();
        zLevel = 10F;//from w  ww. jav a  2 s .c o m
        itemRender.zLevel = 10F;

        RenderHelper.enableGUIStandardItemLighting();

        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glPushMatrix();
        GL11.glTranslated(190, 35, 0);
        GL11.glScaled(2.5, 2.5, 2.5);

        itemRender.renderItemAndEffectIntoGUI(mc.player, out, 0, 0);
        itemRender.renderItemOverlayIntoGUI(fontRenderer, out, 0, 0, null);

        GL11.glPopMatrix();
        GL11.glPopAttrib();

        zLevel = 0F;
        itemRender.zLevel = 0F;

        TextureHelper.refreshTextureBindState();
    }
}

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 .ja v  a2 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 drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    AbstractAltarRecipe rec = findCraftableRecipe();
    if (rec != null) {
        ItemStack out = rec.getOutputForRender();
        zLevel = 10F;//from   ww  w  .ja  va  2  s.  c  o m
        itemRender.zLevel = 10F;

        RenderHelper.enableGUIStandardItemLighting();

        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glPushMatrix();
        GL11.glTranslated(130, 20, 0);
        GL11.glScaled(1.7, 1.7, 1.7);

        itemRender.renderItemAndEffectIntoGUI(mc.player, out, 0, 0);
        itemRender.renderItemOverlayIntoGUI(fontRenderer, out, 0, 0, null);

        GL11.glPopMatrix();
        GL11.glPopAttrib();

        RenderHelper.disableStandardItemLighting();

        zLevel = 0F;
        itemRender.zLevel = 0F;

        TextureHelper.refreshTextureBindState();
    }
}

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();//from  w w  w  .  j a v  a 2 s  .com

    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();
}