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.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();//from   ww w.j  av  a2 s  .c om
        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 w  w  . j  a v  a 2 s .c  om*/

    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 .ja v a2  s .  c om
    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();/*from   ww  w  . ja  va 2  s.c  om*/

    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);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
    RenderUtils.renderItemIn2d(item, 0.0625F);
    GL11.glDisable(GL11.GL_BLEND);/*from w ww.jav  a  2  s  .com*/
}

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);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
    RenderUtils.renderItemIn2d(is, 0.0625F);
    GL11.glDisable(GL11.GL_BLEND);//from w  ww.  ja v a2 s .  co  m
}

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);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
    RenderUtils.renderItemInventory(is);
    GL11.glDisable(GL11.GL_BLEND);/* ww w  .j a va2  s  .  c om*/
}

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

License:Open Source License

/**
 * Render the Amethyst ray/*ww  w.  j  a  va2 s  .c o m*/
 * @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();

}

From source file:cn.lambdalib.cgui.gui.CGui.java

License:MIT License

/**
 * Go down the hierarchy tree and draw each widget node. Should be called each rendering frame.
 *///from  w  w  w.j  av  a2 s  .  com
public void draw(double mx, double my) {
    frameUpdate();
    updateMouse(mx, my);

    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    drawTraverse(mx, my, null, this, getTopWidget(mx, my));

    if (debug) {
        Widget hovering = getHoveringWidget();
        if (hovering != null) {
            GL11.glColor4f(1, .5f, .5f, .8f);
            HudUtils.drawRectOutline(hovering.x, hovering.y, hovering.transform.width * hovering.scale,
                    hovering.transform.height * hovering.scale, 3);
            IFont font = TrueTypeFont.defaultFont();
            font.draw(hovering.getFullName(), hovering.x, hovering.y - 10, new FontOption(10));
        }

    }

    GL11.glEnable(GL11.GL_ALPHA_TEST);
}

From source file:cn.lambdalib.cgui.gui.CGuiScreenContainer.java

License:MIT License

@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    gui.resize(width, height);//from  ww w  . j a va 2 s .c o  m
    gui.draw(var2, var3);
}