Example usage for org.lwjgl.opengl GL11 GL_CLIP_PLANE0

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

Introduction

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

Prototype

int GL_CLIP_PLANE0

To view the source code for org.lwjgl.opengl GL11 GL_CLIP_PLANE0.

Click Source Link

Document

ClipPlaneName

Usage

From source file:com.ardor3d.scene.state.lwjgl.LwjglClipStateUtil.java

License:Open Source License

private static void enableClipPlane(final int planeIndex, final boolean enable, final ClipState state,
        final ClipStateRecord record) {
    if (enable) {
        if (!record.isValid() || !record.planeEnabled[planeIndex]) {
            GL11.glEnable(GL11.GL_CLIP_PLANE0 + planeIndex);
            record.planeEnabled[planeIndex] = true;
        }/*from w w  w . ja  va  2 s .c o m*/

        record.buf.rewind();
        ((DoubleBuffer) record.buf).put(state.getPlaneEquations(planeIndex));
        record.buf.flip();
        GL11.glClipPlane(GL11.GL_CLIP_PLANE0 + planeIndex, (DoubleBuffer) record.buf);

    } else {
        if (!record.isValid() || record.planeEnabled[planeIndex]) {
            GL11.glDisable(GL11.GL_CLIP_PLANE0 + planeIndex);
            record.planeEnabled[planeIndex] = false;
        }
    }
}

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

public static void renderRedstoneTorch(double x, double y, double z, double height, boolean state,
        boolean digital) {

    GL11.glPushMatrix();/*w w w . ja  v a2  s . c  o  m*/
    {
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

        if (digital) {
            rb.overrideBlockTexture = state ? IconSupplier.bluestoneTorchOn : IconSupplier.bluestoneTorchOff;
        } else {
            rb.overrideBlockTexture = state ? Blocks.redstone_torch.getIcon(0, 0)
                    : Blocks.unlit_redstone_torch.getIcon(0, 0);
        }

        GL11.glEnable(GL11.GL_CLIP_PLANE0);
        GL11.glClipPlane(GL11.GL_CLIP_PLANE0,
                uk.co.qmunity.lib.client.render.RenderUtils.planeEquation(0, 1, 0));

        GL11.glTranslated(x, y + height - 1, z);

        Tessellator t = Tessellator.instance;

        t.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        t.startDrawingQuads();
        {
            rb.setRenderBounds(7 / 16D, 0, 0, 9 / 16D, 1, 1);
            t.setNormal(-1, 1, 0);
            rb.renderFaceXNeg(Blocks.stone, 0, 0, 0, null);
            t.setNormal(1, 1, 0);
            rb.renderFaceXPos(Blocks.stone, 0, 0, 0, null);

            rb.setRenderBounds(0, 0, 7 / 16D, 1, 1, 9 / 16D);
            t.setNormal(0, 1, -1);
            rb.renderFaceZNeg(Blocks.stone, 0, 0, 0, null);
            t.setNormal(0, 1, 1);
            rb.renderFaceZPos(Blocks.stone, 0, 0, 0, null);

            rb.setRenderBounds(7 / 16D, 0, 6 / 16D, 9 / 16D, 10 / 16D, 8 / 16D);
            t.setNormal(0, 1, 0);
            rb.renderFaceYPos(Blocks.stone, 0, 0, 1 / 16D, null);
        }
        t.draw();

        GL11.glDisable(GL11.GL_CLIP_PLANE0);

        rb.overrideBlockTexture = null;
    }
    GL11.glPopMatrix();
}