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:cn.lambdacraft.crafting.client.renderer.RenderWire.java

License:Open Source License

private void renderWireBox(Tessellator t, int side, boolean[] theArray) {
    ForgeDirection[] dirs = ForgeDirection.values();
    Vec3 v1 = RenderUtils.newV3(-WIDTH, -WIDTH, -WIDTH), v2 = RenderUtils.newV3(WIDTH, -WIDTH, -WIDTH),
            v3 = RenderUtils.newV3(WIDTH, -WIDTH, WIDTH), v4 = RenderUtils.newV3(-WIDTH, -WIDTH, WIDTH),
            v5 = RenderUtils.newV3(-WIDTH, WIDTH, -WIDTH), v6 = RenderUtils.newV3(WIDTH, WIDTH, -WIDTH),
            v7 = RenderUtils.newV3(WIDTH, WIDTH, WIDTH), v8 = RenderUtils.newV3(-WIDTH, WIDTH, WIDTH);
    GL11.glPushMatrix();/*from   ww  w.jav  a2s.co m*/
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float dx = 0.0F, dy = 0.0F, dz = 0.0F;
    switch (side) {
    case 0:
        dy = -1;
        break;
    case 1:
        dy = 1;
        break;
    case 4:
        dx = -1;
        break;
    case 5:
        dx = 1;
        break;
    case 2:
        dz = -1;
        break;
    case 3:
        dz = 1;
        break;
    }
    float offset = (0.5F + WIDTH) / 2F;
    GL11.glTranslatef(dx * offset, dy * offset, dz * offset);
    if (side != -1) {
        float scale = 2F;
        GL11.glScalef(Math.abs(dx == 0.0F ? 1 : dx * scale), Math.abs(dy == 0.0F ? 1 : dy * scale),
                Math.abs(dz == 0.0F ? 1 : dz * scale));
    }
    int a = 0;
    for (int i = 0; i < theArray.length; i++)
        if (theArray[i])
            a++;
    for (int i = 0; i < 6; i++) {
        if (!doesRenderSide(side, i, theArray))
            continue;
        Vec3 vec1 = null, vec2 = null, vec3 = null, vec4 = null;
        dx = 0.0F;
        dy = 0.0F;
        dz = 0.0F;
        switch (i) {
        case 0:
            vec1 = v4;
            vec2 = v3;
            vec3 = v2;
            vec4 = v1;
            dy = -1.0F;
            break;
        case 1:
            vec1 = v5;
            vec2 = v6;
            vec3 = v7;
            vec4 = v8;
            dy = 1.0F;
            break;
        case 4:
            vec1 = v1;
            vec2 = v5;
            vec3 = v8;
            vec4 = v4;
            dx = -1.0F;
            break;
        case 5:
            vec1 = v2;
            vec2 = v3;
            vec3 = v7;
            vec4 = v6;
            dx = 1.0F;
            break;
        case 2:
            vec1 = v1;
            vec2 = v2;
            vec3 = v6;
            vec4 = v5;
            dz = -1.0F;
            break;
        case 3:
            vec1 = v4;
            vec2 = v8;
            vec3 = v7;
            vec4 = v3;
            dz = 1.0F;
            break;
        }
        GL11.glPushMatrix();
        if (side == -1) {
            if (a == 1 && theArray[dirs[i].getOpposite().ordinal()])
                RenderUtils.loadTexture(ClientProps.WIRE_MAIN_PATH);
            else
                RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH);
        } else {
            RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH2);
        }

        t.startDrawingQuads();
        t.setNormal(dx, dy, dz);
        RenderUtils.addVertex(vec4, 0.0, 1.0);
        RenderUtils.addVertex(vec3, 1.0, 1.0);
        RenderUtils.addVertex(vec2, 1.0, 0.0);
        RenderUtils.addVertex(vec1, 0.0, 0.0);
        t.draw();
        GL11.glPopMatrix();
    }
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.mob.client.renderer.RenderAlienSlave.java

License:Open Source License

private void renderElectro(EntityAlienSlave ent, Vec3 vec3, Tessellator t, double x, double y, double z,
        boolean isLeft) {
    double dx = vec3.xCoord, dy = vec3.yCoord, dz = vec3.zCoord;
    double tx = 0.0, ty = 1.2, tz = 0.0;
    GL11.glPushMatrix();/*from w ww .  j  a  va  2  s.  c  o  m*/
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderUtils.loadTexture(ClientProps.VORTIGAUNT_RAY_PATH[rand.nextInt(3)]);

    Vec3 v1 = RenderUtils.newV3(tx - WIDTH, ty, tz), v2 = RenderUtils.newV3(tx + WIDTH, ty, tz),
            v3 = RenderUtils.newV3(tx, ty - WIDTH, tz), v4 = RenderUtils.newV3(tx, ty + WIDTH, tz);
    double d = Math.sqrt(dx * dx + dy * dy + dz * dz) * 1.3;

    GL11.glTranslated(x, y, z);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    t.startDrawingQuads();
    t.setBrightness(15728880);
    t.setColorRGBA_F(0.1F, 0.9F, 0.1F, 0.7F);
    RenderUtils.addVertex(v1, 0, 0);
    RenderUtils.addVertex(v2, 1, 0);
    RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d);

    RenderUtils.addVertex(v3, 0, 0);
    RenderUtils.addVertex(v4, 1, 0);
    RenderUtils.addVertex(v4.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v3.addVector(dx, dy, dz), 0, d);
    t.draw();

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

}

From source file:cn.lambdacraft.mob.client.renderer.RenderSentryRay.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) {
    this.doRender(tile, x, y, z, f);
    TileSentryRay ray = (TileSentryRay) tile, ray2 = ray.linkedBlock;
    double width = 0.015;
    if (ray2 != null) {
        Vec3 v = ray2.getRayOffset();/*ww w  . ja  v  a 2s .co  m*/
        Vec3 va = ray.getRayOffset();
        double x1 = x + ray2.xCoord + v.xCoord - ray.xCoord, y1 = y + ray2.yCoord + v.yCoord - ray.yCoord,
                z1 = z + ray2.zCoord + v.zCoord - ray.zCoord;
        x += va.xCoord;
        y += va.yCoord;
        z += va.zCoord;
        Vec3 v1 = getVec3(0, 0, -width).addVector(x, y, z), v2 = getVec3(0, 0, width).addVector(x, y, z),
                v3 = getVec3(0, 0, width).addVector(x1, y1, z1),
                v4 = getVec3(0, 0, -width).addVector(x1, y1, z1);

        Vec3 v5 = getVec3(-width, 0, 0).addVector(x, y, z), v6 = getVec3(width, 0, 0).addVector(x, y, z),
                v7 = getVec3(width, 0, 0).addVector(x1, y1, z1),
                v8 = getVec3(-width, 0, 0).addVector(x1, y1, z1);

        Vec3 v9 = getVec3(0, -width, 0).addVector(x, y, z), v10 = getVec3(0, width, 0).addVector(x, y, z),
                v11 = getVec3(0, width, 0).addVector(x1, y1, z1),
                v12 = getVec3(0, -width, 0).addVector(x1, y1, z1);
        double dist = ray.getDistanceFrom(ray2.xCoord, ray2.yCoord, ray2.zCoord);
        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        Tessellator t = Tessellator.instance;

        t.startDrawingQuads();
        t.setColorRGBA_F(1.0F, 0.2F, 0.2F, 0.65F);
        t.setBrightness(512);
        RenderUtils.addVertex(v1, 0, 0);
        RenderUtils.addVertex(v2, 0, 1);
        RenderUtils.addVertex(v3, dist, 1);
        RenderUtils.addVertex(v4, dist, 0);

        RenderUtils.addVertex(v5, 0, 0);
        RenderUtils.addVertex(v6, 0, 1);
        RenderUtils.addVertex(v7, dist, 1);
        RenderUtils.addVertex(v8, dist, 0);
        RenderUtils.addVertex(v9, 0, 0);
        RenderUtils.addVertex(v10, 0, 1);
        RenderUtils.addVertex(v11, dist, 1);
        RenderUtils.addVertex(v12, dist, 0);

        t.draw();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
}

From source file:cn.lambdacraft.mob.client.renderer.RenderShockwave.java

License:Open Source License

protected void renderWave(Tessellator t, double x, double y, double z, float radius) {
    GL11.glPushMatrix();/*  w ww  . j a  v  a 2  s  . c o  m*/

    GL11.glTranslated(x, y, z);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    t.startDrawingQuads();
    t.setColorRGBA(255, 255, 255, 128);
    t.setBrightness(15728880);

    t.addVertexWithUV(-radius, 0.0, -radius, 0.0, 0.0);
    t.addVertexWithUV(-radius, 0.0, radius, 0.0, 1.0);
    t.addVertexWithUV(radius, 0.0, radius, 1.0, 1.0);
    t.addVertexWithUV(radius, 0.0, -radius, 1.0, 0.0);

    t.draw();

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

From source file:cn.lambdacraft.mob.client.renderer.RenderTurret.java

License:Open Source License

@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float f1) {
    EntitySentry turret = (EntitySentry) entity;
    GL11.glPushMatrix();//from   w  w w  .  j  ava 2  s  . c o m
    GL11.glDisable(GL11.GL_CULL_FACE);
    RenderUtils.loadTexture(ClientProps.TURRET_PATH);
    super.doRender(entity, par2, par4, par6, par8, f1);
    GL11.glTranslatef((float) par2, (float) par4 + turret.height - turret.deathTime * 0.06F, (float) par6);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    if (turret.hurtResistantTime > 15)
        GL11.glColor3f(1.0F, 0.3F, 0.3F);
    GL11.glRotatef(turret.deathTime * 3, 1.0F, 0.2F, -1.0F);
    GL11.glRotatef(180.0F - turret.rotationYawHead, 0.0F, 1.0F, 0.0F);
    model.renderTop(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.mob.client.renderer.RenderVortigauntRay.java

License:Open Source License

@Override
public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1) {
    EntityVortigauntRay ray = (EntityVortigauntRay) entity;

    Tessellator tessellator = Tessellator.instance;

    GL11.glPushMatrix();/*  w  ww.ja  va  2 s  .  co  m*/

    double dx = ray.destX - ray.startX;
    double dy = ray.destY - ray.startY;
    double dz = ray.destZ - ray.startZ;
    double d = Math.sqrt(dx * dx + dy * dy + dz * dz);
    float angle = ray.ticksExisted;
    double tx = 0.0, tz = 0.0;
    double ty = -0.63;

    Vec3 v1 = RenderUtils.newV3(0, 0, -WIDTH), v2 = RenderUtils.newV3(0, 0, WIDTH),

            v5 = RenderUtils.newV3(0, WIDTH, 0), v6 = RenderUtils.newV3(0, -WIDTH, 0);

    // Translations and rotations
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslatef((float) d0, (float) d1, (float) d2);
    // GL11.glRotatef(angle, 1.0F, 0, 0);
    int rand = RenderUtils.rand.nextInt(3);
    Minecraft.getMinecraft().renderEngine.bindTexture(ClientProps.VORTIGAUNT_RAY_PATH[rand]);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    tessellator.startDrawingQuads();
    tessellator.setBrightness(15728880);
    tessellator.setColorRGBA(50, 200, 50, 200);

    RenderUtils.addVertex(v1.addVector(tx, ty, tz), 0, 0);
    RenderUtils.addVertex(v2.addVector(tx, ty, tz), 1, 0);
    RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d);

    RenderUtils.addVertex(v5.addVector(tx, ty, tz), 0, d);
    RenderUtils.addVertex(v6.addVector(tx, ty, tz), 1, d);
    RenderUtils.addVertex(v6.addVector(dx, dy, dz), 1, 0);
    RenderUtils.addVertex(v5.addVector(dx, dy, dz), 0, 0);

    tessellator.draw();

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.terrain.client.renderer.RenderItemPortal.java

License:Open Source License

private void renderEntity(ItemStack item, RenderBlocks render, EntityItem ent) {
    GL11.glEnable(GL11.GL_BLEND);//from w w  w.j av  a2  s .co  m
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
    RenderUtils.renderItemIn2d(item, 0.0625F);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:cn.lambdacraft.terrain.client.renderer.RenderItemPortal.java

License:Open Source License

private void renderEquipped(ItemStack is, RenderBlocks render, EntityLivingBase entity) {
    GL11.glEnable(GL11.GL_BLEND);/*from  w  ww. jav  a  2s.c o  m*/
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
    RenderUtils.renderItemIn2d(is, 0.0625F);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:cn.lambdacraft.terrain.client.renderer.RenderItemPortal.java

License:Open Source License

private void renderInventory(ItemStack is, RenderBlocks render) {
    GL11.glEnable(GL11.GL_BLEND);//from   ww  w  .java2 s. c o  m
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
    RenderUtils.renderItemInventory(is);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:cn.lambdacraft.terrain.client.renderer.RenderTileXenAmethyst.java

License:Open Source License

/**
 * Render the Amethyst ray// www  . j  ava 2 s .com
 * @param ent
 * @param t
 * @param x
 * @param y
 * @param z
 */
private void renderRay(TileEntityXenAmethyst ent, Tessellator t, double x, double y, double z) {
    double dx = ent.lastxCoord, dy = ent.lastyCoord, dz = ent.lastzCoord;
    //       double tx = 0.0, ty = 0.4, tz = 0.0;
    double tx = 0.5, ty = 0.2, tz = 0.5;
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderUtils.loadTexture(ClientProps.VORTIGAUNT_RAY_PATH[rng.nextInt(3)]);

    Vec3 v1 = RenderUtils.newV3(tx - WIDTH, ty, tz), v2 = RenderUtils.newV3(tx + WIDTH, ty, tz),
            v3 = RenderUtils.newV3(tx, ty - WIDTH, tz), v4 = RenderUtils.newV3(tx, ty + WIDTH, tz);
    double d = Math.sqrt(dx * dx + dy * dy + dz * dz) * 1.3;

    GL11.glTranslated(x, y, z);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    t.startDrawingQuads();
    t.setBrightness(15728880);
    t.setColorRGBA_F(0.663F, 0.263F, 1.0F, 0.65F);
    RenderUtils.addVertex(v1, 0, 0);
    RenderUtils.addVertex(v2, 1, 0);
    RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d);

    RenderUtils.addVertex(v3, 0, 0);
    RenderUtils.addVertex(v4, 1, 0);
    RenderUtils.addVertex(v4.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v3.addVector(dx, dy, dz), 0, d);
    t.draw();

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();

}