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:com.builtbroken.icbm.content.fragments.RenderFragment.java

private void doRenderArrow(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_,
        float p_76986_9_) {
    GL11.glPushMatrix();/* w  w w. j a  v  a 2s .  c om*/
    GL11.glTranslatef((float) xx, (float) yy, (float) zz);
    GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_76986_9_ - 90.0F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_76986_9_,
            0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = (float) (0 + b0 * 10) / 32.0F;
    float f5 = (float) (5 + b0 * 10) / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (float) (5 + b0 * 10) / 32.0F;
    float f9 = (float) (10 + b0 * 10) / 32.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9);
    tessellator.draw();

    for (int i = 0; i < 4; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
        tessellator.draw();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:com.builtbroken.icbm.content.rail.RenderMissileCart.java

/**
 * Renders the bounding box around the cart
 *
 * @param cart//from   www  .ja  va 2 s  .  c o m
 * @param xx
 * @param yy
 * @param zz
 */
protected void drawBounds(EntityMissileCart cart, double xx, double yy, double zz) {
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);

    float halfWidth = cart.width / 2.0F;
    float halfLength = cart.length / 2.0F;
    float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw));
    if (yaw >= 45 && yaw <= 135) {
        halfWidth = cart.length / 2.0F;
        halfLength = cart.width / 2.0F;
    }

    AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(xx - halfWidth, yy, zz - halfLength,
            xx + halfWidth, yy + (double) cart.height, zz + halfLength);
    RenderGlobal.drawOutlinedBoundingBox(axisalignedbb, 16777215);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}

From source file:com.CiD.MysteryMod.TecEvolution.Buildcraft.FluidRenderer.java

License:Minecraft Mod Public

public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) {
    if (fluidStack == null) {
        return null;
    }//from  w  w  w .j  av  a  2 s. c o  m
    Fluid fluid = fluidStack.getFluid();
    if (fluid == null) {
        return null;
    }
    Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
    int[] diplayLists = cache.get(fluid);
    if (diplayLists != null) {
        return diplayLists;
    }

    diplayLists = new int[DISPLAY_STAGES];

    if (fluid.getBlock() != null) {
        liquidBlock.baseBlock = fluid.getBlock();
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    } else {
        liquidBlock.baseBlock = Blocks.water;
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    }

    cache.put(fluid, diplayLists);

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

    for (int s = 0; s < DISPLAY_STAGES; ++s) {
        diplayLists[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/);

        liquidBlock.minX = 0f;
        liquidBlock.minY = 0;
        liquidBlock.minZ = 0;

        liquidBlock.maxX = 1f;
        liquidBlock.maxY = (float) s / (float) DISPLAY_STAGES;
        liquidBlock.maxZ = 1;

        RenderEntityBlock.INSTANCE.renderBlock(liquidBlock);

        GL11.glEndList();
    }

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    return diplayLists;
}

From source file:com.colonycraft.rendering.world.ChunkMeshRenderer.java

License:Apache License

public static void renderChunkMesh(World world, Chunk chunk, int meshType) {
    /* Bind the correct texture */
    GL11.glEnable(GL11.GL_TEXTURE_2D);/*from w  w  w.jav a2s .  c  o  m*/
    TextureStorage.getTexture("terrain").bind();

    if (meshType == ChunkMesh.MESH_OPAQUE) {
        GL11.glDisable(GL11.GL_BLEND);
    } else if (meshType == ChunkMesh.MESH_TRANSLUCENT || meshType == ChunkMesh.MESH_GRASS) {
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.0f);
    }

    ChunkMesh cmesh = chunk.getMesh();
    Mesh mesh = cmesh.getMesh(meshType);
    if (mesh == null)
        return;

    /* Bind the buffer */
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, mesh.getVertexBufferHandle());

    /* Enable the different kinds of data in the buffer */
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    if (meshType == ChunkMesh.MESH_GRASS) {
        GL20.glEnableVertexAttribArray(GRASS_ATTRIBUTE_LIGHT);
    } else {
        GL20.glEnableVertexAttribArray(CHUNK_ATTRIBUTE_LIGHT);
    }

    /* Define the starting positions */
    GL11.glVertexPointer(POSITION_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, POSITION_OFFSET * FLOAT_SIZE);
    GL11.glTexCoordPointer(TEX_COORD_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, TEX_COORD_OFFSET * FLOAT_SIZE);
    GL20.glVertexAttribPointer(CHUNK_ATTRIBUTE_LIGHT, 2, GL11.GL_FLOAT, false, STRIDE * FLOAT_SIZE,
            LIGHT_OFFSET * FLOAT_SIZE);

    /* Draw the buffer */
    GL11.glDrawArrays(GL11.GL_QUADS, 0, mesh.vertices());

    /* Unbind the buffer */
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    /* Disable the different kinds of data */
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    if (meshType == ChunkMesh.MESH_GRASS) {
        GL20.glDisableVertexAttribArray(GRASS_ATTRIBUTE_LIGHT);
    } else {
        GL20.glDisableVertexAttribArray(CHUNK_ATTRIBUTE_LIGHT);
    }

    if (meshType == ChunkMesh.MESH_TRANSLUCENT || meshType == ChunkMesh.MESH_GRASS) {
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
    }
}

From source file:com.company.Core.GuiRenderer.java

@Override
public void PreRender() {
    GL11.glDisable(GL11.GL_DEPTH_TEST);
}

From source file:com.damagedearth.Utilities.Components.TrueTypeFont.java

License:Open Source License

public void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX,
        float scaleY, int format) {

    IntObject intObject = null;//from w  ww  .  j av a  2  s .co  m
    int charCurrent;

    int totalwidth = 0;
    int i = startIndex, d, c;
    float startY = 0;

    switch (format) {
    case ALIGN_RIGHT: {
        d = -1;
        c = correctR;

        while (i < endIndex) {
            if (whatchars.charAt(i) == '\n')
                startY -= fontHeight;
            i++;
        }
        break;
    }
    case ALIGN_CENTER: {
        for (int l = startIndex; l <= endIndex; l++) {
            charCurrent = whatchars.charAt(l);
            if (charCurrent == '\n')
                break;
            if (charCurrent < 256) {
                intObject = charArray[charCurrent];
            } else {
                intObject = (IntObject) customChars.get(new Character((char) charCurrent));
            }
            totalwidth += intObject.width - correctL;
        }
        totalwidth /= -2;
    }
    case ALIGN_LEFT:
    default: {
        d = 1;
        c = correctL;
        break;
    }

    }

    GL11.glEnable(GL11.GL_BLEND); // Enabled blending
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // selects blending method
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBegin(GL11.GL_QUADS);

    while (i >= startIndex && i <= endIndex) {

        charCurrent = whatchars.charAt(i);
        if (charCurrent < 256) {
            intObject = charArray[charCurrent];
        } else {
            intObject = (IntObject) customChars.get(new Character((char) charCurrent));
        }

        if (intObject != null) {
            if (d < 0)
                totalwidth += (intObject.width - c) * d;
            if (charCurrent == '\n') {
                startY -= fontHeight * d;
                totalwidth = 0;
                if (format == ALIGN_CENTER) {
                    for (int l = i + 1; l <= endIndex; l++) {
                        charCurrent = whatchars.charAt(l);
                        if (charCurrent == '\n')
                            break;
                        if (charCurrent < 256) {
                            intObject = charArray[charCurrent];
                        } else {
                            intObject = (IntObject) customChars.get(new Character((char) charCurrent));
                        }
                        totalwidth += intObject.width - correctL;
                    }
                    totalwidth /= -2;
                }
                //if center get next lines total width/2;
            } else {
                drawQuad((totalwidth + intObject.width) * scaleX + x, startY * scaleY + y,
                        totalwidth * scaleX + x, (startY + intObject.height) * scaleY + y,
                        intObject.storedX + intObject.width, intObject.storedY + intObject.height,
                        intObject.storedX, intObject.storedY);
                if (d > 0)
                    totalwidth += (intObject.width - c) * d;
            }
            i += d;

        }
    }
    GL11.glEnd();

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

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

/**
 * Renders a box with any size and any color.
 *
 * @param x/*from ww  w . ja v  a  2s .co  m*/
 * @param y
 * @param z
 * @param x2
 * @param y2
 * @param z2
 * @param color
 */
public static void box(double x, double y, double z, double x2, double y2, double z2, float red, float green,
        float blue, float alpha) {
    x = x - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y = y - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z = z - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    x2 = x2 - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y2 = y2 - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z2 = z2 - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glDepthMask(false);
    GL11.glColor4f(red, green, blue, alpha);
    drawColorBox(new AxisAlignedBB(x, y, z, x2, y2, z2), red, green, blue, alpha);
    GL11.glColor4d(0, 0, 0, 0.5F);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

/**
 * Renders a frame with any size and any color.
 *
 * @param x/*from  w w  w .j a  v a  2 s  .  com*/
 * @param y
 * @param z
 * @param x2
 * @param y2
 * @param z2
 * @param color
 */
public static void frame(double x, double y, double z, double x2, double y2, double z2, Color color) {
    x = x - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y = y - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z = z - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    x2 = x2 - Minecraft.getMinecraft().getRenderManager().renderPosX;
    y2 = y2 - Minecraft.getMinecraft().getRenderManager().renderPosY;
    z2 = z2 - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    setColor(color);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

/**
 * Renders an ESP box with the size of a normal block at the specified
 * BlockPos./*w  ww  .  jav  a  2 s  . c  o m*/
 */
public static void blockEsp(BlockPos blockPos, Color c, double length, double length2) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glPushMatrix();
    GL11.glBlendFunc(770, 771);
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 0.15);
    drawColorBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length), 0F, 0F, 0F, 0F);
    GL11.glColor4d(0, 0, 0, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length));
    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
    GL11.glPopMatrix();
}

From source file:com.darkcart.xdolf.util.RenderUtils.java

License:Open Source License

public static void blockEspFrame(BlockPos blockPos, double red, double green, double blue) {
    double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX;
    double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY;
    double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ;
    GL11.glBlendFunc(770, 771);/* w  w  w. ja v a  2s  . c  o  m*/
    GL11.glEnable(GL_BLEND);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL_DEPTH_TEST);
    GL11.glDepthMask(false);
    GL11.glColor4d(red, green, blue, 0.5);
    drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0));
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL_BLEND);
}