Example usage for org.lwjgl.opengl GL11 glDisable

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

Introduction

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

Prototype

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

Source Link

Document

Disables the specified OpenGL state.

Usage

From source file:chessMod.client.ChessModDrawBlockHighlightHandler.java

License:LGPL

public static void highlightTile(EntityPlayer player, double x, double y, double z, float partialTicks) {

    x += 0.5D;/*from  w  ww  .  j a va2s  .  c om*/
    y += 0.5D;
    z += 0.5D;
    double iPX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks;
    double iPY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks;
    double iPZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks;

    float xScale = 1.0F;
    float yScale = 1;
    float zScale = 1.0F;
    float xShift = 0.0F;
    float yShift = 0.01F;
    float zShift = 0.0F;

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int i = 4; i < 5; i++) {
        ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
        int zCorrection = i == 2 ? -1 : 1;
        GL11.glPushMatrix();
        GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
        GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
        GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
        GL11.glTranslated(0, 0, 0.5f * zCorrection);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        drawQuad(-0.5F, -0.5F, 1F, 1F, 0F);
        GL11.glPopMatrix();
    }

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

From source file:chessMod.client.ChessModDrawBlockHighlightHandler.java

License:LGPL

public static void drawQuad(float x, float y, float width, float height, double zLevel) {

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_TEXTURE_2D);//from   w  w w  .  j  av  a2s .  c o  m
    GL11.glLineWidth(5.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(0F, 1F, 0F, pulseTransparency);

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertex(x + 0F, y + height, zLevel);
    tessellator.addVertex(x + width, y + height, zLevel);
    tessellator.addVertex(x + width, y + 0F, zLevel);
    tessellator.addVertex(x + 0F, y + 0F, zLevel);
    tessellator.draw();

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
}

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);
    GL11.glEnable(GL11.GL_BLEND);//from   w w  w  .  ja v  a2 s  .c  o  m
    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 ww  . j ava  2s  .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);//w w  w .j a  va  2 s.c o m
    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;/* www .  j av  a 2  s  . com*/
    }

    //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/* ww w.ja  v  a2  s . co  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/*w w  w.j  a v a 2 s  .  c  o  m*/
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);
    GL11.glDepthMask(false);//from  w  w w  .j av a 2 s  . co m
    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);
}