Example usage for org.lwjgl.opengl GL11 glEnable

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

Introduction

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

Prototype

public static void glEnable(@NativeType("GLenum") int target) 

Source Link

Document

Enables the specified OpenGL state.

Usage

From source file:cn.academy.core.client.render.SkillRenderManager.java

License:Open Source License

public static void renderFirstPerson() {
    //System.out.println("rfp");
    GL11.glDepthFunc(GL11.GL_LEQUAL);//from   www  .  ja v  a 2s. c  om
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {
        GL11.glTranslated(0.28, -0.55, -.9);
        GL11.glColor4d(1, 0.6, 0.6, 0.55);
        GL11.glScalef(0.66F, 0.66F, 0.66F);
        GL11.glRotatef(20, 1, 0, 0);

        //RenderUtils.loadTexture(ACClientProps.TEX_ARC_SHELL[0]);
        //RenderUtils.drawCube(1, 1, 1, false);
        traverseHandRender(Minecraft.getMinecraft().thePlayer, HandRenderType.FIRSTPERSON);
        //rpe.renderHandEffect(Minecraft.getMinecraft().thePlayer, null, HandRenderType.FIRSTPERSON);

    }
    GL11.glPopMatrix();
}

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 a  v  a  2s.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  2  s  . c  o m*/

    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);/* ww w  .  j  a v a  2s .c  om*/
    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.gui.EnergyUIHelper.java

License:GNU General Public License

public static void drawTextBox(String str, double x, double y, double limit, FontOption option, boolean mono) {
    GL11.glEnable(GL11.GL_BLEND);
    final IFont font = Resources.font();

    Extent extent = font.drawSeperated_Sim(str, limit, option);
    if (extent.linesDrawn == 0) {
        extent.height = option.fontSize;
    }//from  w  ww . ja  v  a2 s . c  o m
    double X0 = x, Y0 = y, MARGIN = Math.min(5, option.fontSize * 0.3);
    X0 -= extent.width * option.align.lenOffset;

    drawBox(X0, Y0, MARGIN * 2 + extent.width, MARGIN * 2 + extent.height, mono);
    GL11.glPushMatrix();
    GL11.glTranslated(0, 0, 1);
    font.drawSeperated(str, x + MARGIN, Y0 + MARGIN, limit, option);
    GL11.glPopMatrix();
}

From source file:cn.academy.energy.client.gui.GuiPhaseGen.java

License:Open Source License

@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
    GL11.glPushMatrix();/*  w  w  w.  ja v a 2  s.c o m*/
    GL11.glTranslated(-guiLeft, -guiTop, 0);

    Widget w = gui.getTopWidget(x, y);
    if (w != null) {
        String text = null;
        switch (w.getName()) {
        case "prog_liquid":
            text = tile.getLiquidAmount() + "/" + tile.getTankSize() + "mB";
            break;
        case "prog_buffer":
            text = String.format("%.1f/%.1fIF", tile.getEnergy(), tile.bufferSize);
            break;
        }

        if (text != null) {
            //int offsetX = -160, offsetY = -45;
            GL11.glEnable(GL11.GL_BLEND);
            EnergyUIHelper.drawTextBox(text, x + 5, y + 5, 10);
        }
    }

    GL11.glPopMatrix();
}

From source file:cn.academy.energy.client.gui.wind.GuiWindGenBase.java

License:Open Source License

@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
    GL11.glPushMatrix();//w ww  . ja  v  a 2s.c  o m
    GL11.glTranslated(-guiLeft, -guiTop, 0);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    Widget w = gui.getTopWidget(x, y);
    if (w != null) {
        String text = null;
        switch (w.getName()) {
        case "prog_fancap":
            text = getFanCap() + "/" + ModuleEnergy.windgenFan.getMaxDamage();
            break;
        case "prog_speed":
            text = tile.getSimulatedGeneration() + "IF/T";
            break;
        case "prog_buffer":
            text = String.format("%.1f/%.1fIF", tile.getEnergy(), tile.bufferSize);
            break;
        }

        if (text != null) {
            //int offsetX = -160, offsetY = -45;
            EnergyUIHelper.drawTextBox(text, x + 5, y, 10);
        }
    }

    GL11.glPopMatrix();
}

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;//  www .j  a  va 2s . com
    }
    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.energy.client.render.tile.RenderMatrix.java

License:Open Source License

@Override
public void renderAtOrigin(TileEntity te) {
    TileMatrix tm = (TileMatrix) te;//from   w ww .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);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    HudUtils.rect(16, 16);//from ww w. j a va  2s .c  o m
    GL11.glDisable(GL11.GL_BLEND);
}