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.ability.client.render.RenderDeveloperAdvanced.java

License:GNU General Public License

@Override
public void drawAtOrigin(TileEntity te) {
    GL11.glDisable(GL11.GL_CULL_FACE);//www .  ja v a  2  s.c o m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    super.drawAtOrigin(te);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.academy.ability.client.render.RenderDeveloperNormal.java

License:GNU General Public License

@Override
public void drawAtOrigin(TileEntity te) {
    GL11.glDisable(GL11.GL_CULL_FACE);
    super.drawAtOrigin(te);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.academy.ability.client.ui.BackgroundMask.java

License:GNU General Public License

@Override
public void draw(ScaledResolution sr) {
    long time = GameTimer.getTime();

    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    AbilityData aData = AbilityData.get(player);
    CPData cpData = CPData.get(player);// w  w w.  j a v  a  2  s .  c o  m

    double cr, cg, cb, ca;

    Color color = null;
    if (cpData.isOverloaded()) {
        color = CRL_OVERRIDE;
    } else if (cpData.isActivated()) {
        color = aData.getCategory().getColorStyle();
    }

    if (color == null) {
        cr = r;
        cg = g;
        cb = b;
        ca = 0;
    } else {
        cr = color.r;
        cg = color.g;
        cb = color.b;
        ca = color.a;
    }

    if (ca != 0 || a != 0) {
        long dt = lastFrame == 0 ? 0 : time - lastFrame;
        r = balanceTo(r, cr, dt);
        g = balanceTo(g, cg, dt);
        b = balanceTo(b, cb, dt);
        a = balanceTo(a, ca, dt);

        GL11.glColor4d(r, g, b, a);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        RenderUtils.loadTexture(MASK);
        HudUtils.rect(0, 0, sr.getScaledWidth_double(), sr.getScaledHeight_double());
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
    } else {
        r = cr;
        g = cg;
        b = cb;
    }

    lastFrame = time;
}

From source file:cn.academy.ability.client.ui.CPBar.java

License:GNU General Public License

private void drawOverload(float overload) {
    //Draw plain background
    color4d(1, 1, 1, 0.8);//from   w w w. jav a 2 s .  c om
    RenderUtils.loadTexture(TEX_BACK_OVERLOAD);
    HudUtils.rect(WIDTH, HEIGHT);

    // Draw back
    color4d(1, 1, 1, 1);

    if (shaderLoaded) {
        shaderOverloaded.useProgram();
        shaderOverloaded.updateTexOffset((GameTimer.getTime() % 10000L) / 10000.0f);
    }

    GL13.glActiveTexture(GL13.GL_TEXTURE0 + 4);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    RenderUtils.loadTexture(TEX_MASK);

    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    RenderUtils.loadTexture(TEX_FRONT_OVERLOAD);

    final double x0 = 30, width2 = WIDTH - x0 - 20;
    HudUtils.rect(x0, 0, 0, 0, width2, HEIGHT, width2, HEIGHT);

    GL13.glActiveTexture(GL13.GL_TEXTURE0 + 4);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL13.glActiveTexture(GL13.GL_TEXTURE0);

    GL20.glUseProgram(0);

    // Highlight
    color4d(1, 1, 1, 0.3 + 0.35 * (Math.sin(GameTimer.getTime() / 200.0) + 1));
    RenderUtils.loadTexture(TEX_OVERLOAD_HIGHLIGHT);
    HudUtils.rect(WIDTH, HEIGHT);
}

From source file:cn.academy.ability.client.ui.CPBar.java

License:GNU General Public License

private void drawCPBar(float prog, boolean cantuse) {
    float pre_mAlpha = mAlpha;
    if (cantuse) {
        mAlpha *= 0.3f;//  ww  w. ja  v a 2 s . c  o m
    }

    //We need a cut-angle effect so this must be done manually
    autoLerp(cpColors, prog);

    prog = 0.16f + prog * 0.8f;

    final double OFF = 103 * sin41, X0 = 47, Y0 = 30, WIDTH = 883, HEIGHT = 84;
    Tessellator t = Tessellator.instance;
    double len = WIDTH * prog, len2 = len - OFF;

    if (shaderLoaded) {
        shaderCPBar.useProgram();
    }

    GL13.glActiveTexture(GL13.GL_TEXTURE0 + 4);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    RenderUtils.loadTexture(overlayTexture);

    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    RenderUtils.loadTexture(TEX_CP);

    t.startDrawingQuads();
    addVertex(X0 + (WIDTH - len), Y0);
    addVertex(X0 + (WIDTH - len2), Y0 + HEIGHT);
    addVertex(X0 + WIDTH, Y0 + HEIGHT);
    addVertex(X0 + WIDTH, Y0);
    t.draw();

    GL20.glUseProgram(0);

    GL13.glActiveTexture(GL13.GL_TEXTURE0 + 4);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL13.glActiveTexture(GL13.GL_TEXTURE0);

    mAlpha = pre_mAlpha;
}

From source file:cn.academy.ability.electro.client.render.skill.ChargePlaneEffect.java

License:Open Source License

@SideOnly(Side.CLIENT)
@Override//from   w ww. j av  a2s  . c  o  m
public void renderHud(EntityPlayer player, ScaledResolution sr, long time) {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDepthMask(false);
    //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glPushMatrix();
    {
        GL11.glColor4d(1, 1, 1, 0.4);
        double w = sr.getScaledWidth_double(), h = sr.getScaledHeight_double();
        if (lct == 0 || time - lct > 200) {
            lct = time;
            seq.rebuild();
        }
        for (int i = 0; i < 4; ++i) {
            RenderUtils.loadTexture(TEXS[seq.get(i)]);
            HudUtils.drawRect(w * pts[i][0], h * pts[i][1], sizes[i] * w, sizes[i] * w);
        }
        RenderUtils.bindIdentity();
    }
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
}

From source file:cn.academy.ability.electro.client.render.skill.RailgunPlaneEffect.java

License:Open Source License

@SideOnly(Side.CLIENT)
@Override//from w w w  . ja v  a2 s  . com
public void renderHandEffect(EntityPlayer player, HandRenderType type, long dt) {
    if (type == HandRenderType.EQUIPPED)
        return;
    if (dt < DELAY)
        return;
    dt -= DELAY;

    double tz = dt * dt / 3e4;
    double TRANS_TIME = ANIM_LEN * 0.2;
    double alpha = (dt < TRANS_TIME ? dt / TRANS_TIME
            : (dt > ANIM_LEN - TRANS_TIME ? (ANIM_LEN - dt) / TRANS_TIME : 1));

    //Draw a screen-filling blackout
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluOrtho2D(0, 255, 0, 255);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glDepthMask(false);
    GL11.glLoadIdentity();
    {
        GL11.glTranslated(0, 0, 0);
        GL11.glColor4d(0, 0, 0, 0.2 * alpha);
        HudUtils.setZLevel(1);
        HudUtils.drawModalRect(0, 0, 255, 255);
        HudUtils.setZLevel(-90);
    }
    GL11.glDepthMask(true);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glMatrixMode(GL11.GL_MODELVIEW); //Restore the matrix

    //Draw the real effect

    GL11.glColor4d(1, 1, 1, alpha * 0.6);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.0f);
    GL11.glPushMatrix();
    {
        GL11.glTranslated(-.4, 0.85 + tz * 0.37, tz);
        GL11.glRotated(-20.4, 1, 0, 0);

        drawSingleSide(7);

        //         GL11.glPushMatrix(); {
        //            GL11.glTranslated(-2.3, 0, 0);
        //            drawSingleSide(7);
        //         } GL11.glPopMatrix();
    }
    GL11.glPopMatrix();

    GL11.glDisable(GL11.GL_ALPHA_TEST);
}

From source file:cn.academy.ability.electro.client.render.skill.SRSmallCharge.java

License:Open Source License

@Override
public void draw() {
    GL11.glDisable(GL11.GL_CULL_FACE);/*  ww  w.j  a  v a2  s .co m*/
    GL11.glDepthMask(false);
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4d(1, 1, 1, 0.7);

    GL11.glTranslated(0, 0.9, 0.2);
    GL11.glRotated(120, 1, 0, 0);
    GL11.glScaled(0.5, 0.5, 0.5);
    //RenderUtils.drawCube(1, 1, 2);
    for (ArcObject arc : arcs) {
        arc.draw();
    }

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

From source file:cn.academy.ability.teleport.client.render.entity.MarkRender.java

License:Open Source License

@Override
public void doRender(Entity ent, double x, double y, double z, float var8, float var9) {
    EntityTPMarking mark = (EntityTPMarking) ent;
    int texID = (int) ((mark.ticksExisted / 2.5) % tex.length);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LIGHTING);/*from w ww .j  a  va 2s  .  co m*/
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glPushMatrix();
    {
        GL11.glTranslated(x, y, z);

        GL11.glRotated(-mark.rotationYaw, 0, 1, 0);
        GL11.glScaled(-1, -1, 1);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
        Tessellator.instance.setBrightness(15728880);
        RenderUtils.loadTexture(tex[texID]);
        model.draw();
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:cn.academy.core.client.ACRenderingHelper.java

License:GNU General Public License

/**
 * Draws a circular progress bar at (0, 0) with radius 1
 *///from  w w w  .  j av a  2 s . c  o  m
public static void drawCircularProgbar(ResourceLocation texture, double progress) {

    progress *= 360;
    if (progress > 360)
        progress %= 360;

    Tessellator t = Tessellator.instance;

    GL11.glPushMatrix();
    RenderUtils.loadTexture(texture);
    for (int i = 0; i < 4; ++i) {
        double angle = Math.min(90, progress - 90 * i);
        if (angle <= 0)
            break;
        double u1, v1;
        t.startDrawing(GL11.GL_TRIANGLES);

        if (angle <= 45) {
            u1 = Math.tan(MathUtils.toRadians(angle));
            v1 = 0;
        } else {
            u1 = 1;
            v1 = 0;

            double x = Math.tan(MathUtils.toRadians(90 - angle));
            t.addVertexWithUV(1, -1, 0, 1, 0);
            t.addVertexWithUV(0, 0, 0, 0, 1);
            t.addVertexWithUV(1, -x, 0, 1, 1 - x);
        }

        t.addVertexWithUV(0, -1, 0, 0, 0);
        t.addVertexWithUV(0, 0, 0, 0, 1);
        t.addVertexWithUV(u1, -1 - v1, 0, u1, v1);
        t.draw();

        GL11.glRotated(90, 0, 0, 1);
    }
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}