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.ACRenderingHelper.java

License:GNU General Public License

public static void lineSegment(double x0, double y0, double x1, double y1, float width) {
    boolean pre = GL11.glIsEnabled(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from  w w  w .java2s . com*/

    dirQuad(x0, y0, x1, y1, width);

    if (pre)
        GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

@Override
public void draw(double mx, double my, boolean mouseHovering) {
    // Background
    GL11.glEnable(GL11.GL_BLEND);
    super.draw(mx, my, mouseHovering);

    //Player//from  w  w w  .  j a v  a  2s .  c o m
    GL11.glPushMatrix();
    {
        drawPlayer();
    }
    GL11.glPopMatrix();
    GL11.glColor4f(1, 1, 1, 1);

    // Page name
    String pname = dev.getCurPage().getDisplayName();
    RenderUtils.bindColor(dev.DEFAULT_COLOR);
    ACUtils.drawText(pname, 156, 4.5, 8.5, Align.CENTER);

    //Titles
    ACUtils.drawText(ACLangs.holoView(), 147, 20.5, 7.5);

    ACUtils.drawText(ACLangs.ad_UserInfo(), 147.5, 119, 7.5);

    //Misc
    drawUserInfo();
}

From source file:cn.academy.core.client.gui.dev.PageMain.java

License:Open Source License

private void drawPlayer() {
    EntityPlayer player = dev.user;//from ww  w.ja v a 2s  .  co m
    RenderUtils.loadTexture(RenderUtils.STEVE_TEXTURE);
    float x = 100, y = 100, scale = 2.1F;
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glPushMatrix();
    {
        GL11.glTranslatef(183, 58, 100F);
        GL11.glScalef((-scale), scale, scale);
        GL11.glRotated(-25, 1, 0, 0);
        RenderHelper.enableStandardItemLighting();
        GL11.glRotatef(Minecraft.getSystemTime() / 100F, 0F, 1F, 0F); //Rotate around Y
        model.render(player, 0, 0, 0, 0, 0, 1F);
    }
    GL11.glPopMatrix();
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
}

From source file:cn.academy.core.client.gui.GuiMainScreen.java

License:Open Source License

@Override
public void draw(ScaledResolution sr) {
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    AbilityData data = AbilityDataMain.getData(player);
    double w = sr.getScaledWidth_double(), h = sr.getScaledHeight_double();
    double size = 80.0, x = w - 80, y = h - 65;
    boolean active = EventHandlerClient.isSkillEnabled();
    long time = Minecraft.getSystemTime();

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();/*from  w  w  w  . ja  v a 2 s .  c  om*/
    {
        GL11.glPushMatrix();
        { //Logo rendering
            double scale = .25;
            double mAlpha = active ? 0.8 : 0.4;
            HudUtils.setTextureResolution(256, 256);

            GL11.glTranslated(w - 80, h - 70, 0);
            GL11.glScaled(scale, scale, 1);

            GL11.glColor4d(1, 1, 1, mAlpha);
            logoBack.draw();

            GL11.glColor4d(1, 1, 1, (mAlpha * 1.25) * (0.7 + Math.sin(time / 900D) * 0.3));
            logoRays.draw();

            GL11.glColor4d(1, 1, 1, mAlpha);
            logoBack.draw();
            logoFrame.draw();

            RenderUtils.loadTexture(data.getCategory().getLogo());
            HudUtils.drawRect(63, 63, 129, 129);

            logoGeom.getTransform().setRoll(time / 1000D);
            logoGeom.draw();
        }
        GL11.glPopMatrix();
        RenderUtils.bindIdentity();

        //CPBar rendering
        if (active) {
            lastActiveTime = time;
        } else {
            lastInactiveTime = time;
        }
        double mAlpha = active ? Math.min((time - lastInactiveTime) / 300D, 1.0)
                : Math.max((300 + lastActiveTime - time) / 300D, 0.0);

        if (mAlpha > 0) {
            //Cooldown
            drawCooldownBars(data, mAlpha, w, h);

            GL11.glColor4d(1, 1, 1, mAlpha * 0.6);
            RenderUtils.loadTexture(ACClientProps.TEX_HUD_BAR);
            HudUtils.setTextureResolution(512, 200);
            double scale = .4;
            GL11.glTranslated(w - 193, 17, 0);
            GL11.glScaled(scale, scale, 0);
            //Back
            HudUtils.drawRect(0, 0, 0, 73, 455, 127, 455, 127);

            //CPBar
            double prog = data.getCurrentCP() / data.getMaxCP();
            int[] cs = data.getCategory().getColorStyle();
            RenderUtils.bindColor(cs[0], cs[1], cs[2], (int) (mAlpha * 255));
            HudUtils.drawRect(439 - 436 * prog, 3, 439 - 436 * prog, 4, 436 * prog, 28, 436 * prog, 28);

            //CPBar glow
            double alpha = Math.max(0, (prog - 0.6) / 0.4);
            GL11.glColor4d(1, 1, 1, alpha * mAlpha);
            HudUtils.drawRect(3, 3, 3, 42, 436, 28, 436, 28);

            //Chip
            HudUtils.drawRect(269, 46, 478, 40, 26, 26, 26, 26);
            alpha = 0.5 + 0.5 * Math.sin(Minecraft.getSystemTime() / 500D);
            RenderUtils.bindColor(cs[0], cs[1], cs[2], (int) (alpha * mAlpha * 255)); //Chip glow light
            HudUtils.drawRect(266, 45, 474, 5, 32, 32, 32, 32);

            //Level
            GL11.glColor4d(1, 1, 1, mAlpha * .6);
            ACClientProps.FONT_YAHEI_32.drawAdjusted(data.getLevel().getDisplayName(), 184, 58, 20, 69);

            //Numeric CP
            String str = String.format("%.0f/%.0f", data.getCurrentCP(), data.getMaxCP());
            font.drawAdjusted(str, 316, 87, 22, Align.CENTER, 167);
        }
    }
    GL11.glPopMatrix();
    RenderUtils.bindIdentity();
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:cn.academy.core.client.gui.GuiPresetSelect.java

License:Open Source License

@Override
public void draw(ScaledResolution sr) {
    int h = sr.getScaledHeight(), w = sr.getScaledWidth();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glPushMatrix();/*from   w  ww  . j av  a2  s .  c  o m*/
    {
        float x0 = w / 2F, y0 = h / 2F, scale = 0.32F;
        GL11.glTranslated(0, -5, 0);
        GL11.glTranslatef(x0, y0, 0);
        GL11.glScalef(scale, scale, 1);

        HudUtils.setTextureResolution(768, 512);
        RenderUtils.loadTexture(ACClientProps.TEX_GUI_PRESET);
        long dt = Minecraft.getSystemTime() - lastOpenTime;
        drawSelectionMenu(w, h, dt);
        drawPresetInfo(w, h, dt);
        drawTag(w, h, dt);
    }
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:cn.academy.core.client.render.ray.RendererRayCylinder.java

License:GNU General Public License

@Override
protected void draw(Entity entity, double len) {
    if (RenderUtils.isInShadowPass())
        return;/*from   w  w w.ja v  a  2  s . co m*/

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glPushMatrix();

    IRay ray = (IRay) entity;

    //HACK: Store the previous alpha
    double oldA = color.a;
    color.a *= ray.getAlpha();

    double width = this.width * ray.getWidth();

    color.bind();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glPushMatrix();
    double offset = width * (1 - headFix);
    GL11.glTranslated(offset, 0, 0);
    GL11.glScaled(width * headFix, width, width);
    head.draw(shader);
    GL11.glPopMatrix();

    //Draw the cylinder
    GL11.glPushMatrix();
    GL11.glTranslated(width, 0, 0);
    GL11.glScaled(len - width, width, width);
    cylinder.draw(shader);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(len + width - offset, 0, 0);
    GL11.glScaled(-width * headFix, width, -width);
    head.draw(shader);
    GL11.glPopMatrix();

    GL11.glPopMatrix();

    color.a = oldA;
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glColor4d(1, 1, 1, 1);
}

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

License:Open Source License

public static final void renderHand(EntityPlayer player) {

    GL11.glDisable(GL11.GL_CULL_FACE);/*from  w  w  w .j  av  a 2 s  . co m*/
    GL11.glPushMatrix();

    RenderUtils.renderEnchantGlint_Equip();
    RenderUtils.loadTexture(steveTexture);
    GL11.glRotated(-23.75, 0.0F, 0.0F, 1.0F);
    GL11.glRotated(21.914, 0.0F, 1.0F, 0.0F);
    GL11.glRotated(32.75, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(.758F, -.072F, -.402F);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);

    model.onGround = 0.0F;
    model.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player);
    model.bipedRightArm.render(0.0625F);

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.academy.core.client.render.shader.ShaderMask.java

License:GNU General Public License

public void start(ResourceLocation texture) {
    this.useProgram();
    GL13.glActiveTexture(GL13.GL_TEXTURE0 + MASK_TEXID);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    RenderUtils.loadTexture(texture);//  www.  j  a  v a 2  s  .  c o m
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
}

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

License:Open Source License

@SideOnly(Side.CLIENT)
@Override/*from   www  . j  a  va2 s. c om*/
public void renderSurroundings(EntityPlayer player, long time) {
    GL11.glPushMatrix();
    {
        GL11.glTranslated(-.5, 0, -.5);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glColor4f(1, 1, 1, 0.3F);
        RenderUtils.drawCube(1, 1, 2);
        GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glPopMatrix();
}

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

License:Open Source License

public static void renderThirdPerson(EntityLivingBase ent, ItemStack stack, ItemRenderType type) {
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || !(ent instanceof EntityPlayer))
        return;/*  ww w .  ja v  a2  s .  c  o m*/
    EntityPlayer player = (EntityPlayer) ent;
    Item item = stack.getItem();
    Block block = Block.getBlockFromItem(stack.getItem());
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {

        GL11.glColor4d(1, 0.6, 0.6, 0.55);

        if (stack.getItemSpriteNumber() == 0 && item instanceof ItemBlock) { //block render routine
            GL11.glTranslated(0, 0, 1.5);
            GL11.glScalef(2F, 2F, 2F);
            GL11.glRotated(45, 1, 0, 1);
            GL11.glRotated(45, 0, 1, 0);
            GL11.glRotated(180, 1, 0, 0);
        } else if (item.isFull3D()) {
            GL11.glTranslated(0.1, 0.8, -.4);
            GL11.glScalef(.8F, .8F, .8F);
            GL11.glRotated(45, 0, 0, -1);
        } else {
            GL11.glTranslated(-.3, 1.2, -.6);
            GL11.glRotatef(90, 1, 0, 0);
            GL11.glScalef(1.5F, 1.5F, 1.5F);
        }

        traverseHandRender(player, HandRenderType.EQUIPPED);

    }
    GL11.glPopMatrix();
}