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.farincorporated.frameutils.client.rendering.FrameTranslaterRenderer.java

@Override
public void renderTileEntityAt(TileEntity ti, double x, double y, double z, float timesincelasttick) {
    TileFrameTranslater tile = (TileFrameTranslater) ti;
    ResourceLocation framemap = super.getFrame(tile.getMaterialType());
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glColor3d(1.0, 1.0, 1.0);/*from   w  w w  .  ja  v  a 2 s. c o m*/
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(scale, scale, scale);
    double[] dir = this.directionRotate(tile.getFace());
    GL11.glRotated(dir[0], dir[1], dir[2], dir[3]);
    this.renderTranslater(framemap);
    GL11.glPopMatrix();
}

From source file:com.farincorporated.frameutils.client.rendering.FrameTranslaterRenderer.java

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glPushMatrix();/*w w w . j  a v  a2  s  . co  m*/
    GL11.glScaled(scale, scale, scale);
    this.renderTranslater(
            super.getFrame(item.hasTagCompound() ? item.getTagCompound().getString("frame_material") : "wood"));
    GL11.glPopMatrix();
}

From source file:com.fireball1725.firelib.guimaker.GuiMakerGuiContainer.java

License:Open Source License

@SideOnly(Side.CLIENT)
public void scissorsEnd() {
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
}

From source file:com.fireball1725.firelib.renderer.layers.LayerSword.java

License:Open Source License

@SideOnly(Side.CLIENT)
@Override/* w w w  . j a  v  a 2s . c o m*/
public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount,
        float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    UUID playerUUID = entitylivingbaseIn.getGameProfile().getId();

    if (!Benihime.hasUser(playerUUID) || entitylivingbaseIn.isInvisible())
        return;

    if (entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE))
        return;

    if (entitylivingbaseIn.isSneaking()) {
        GlStateManager.translate(0.0f, 0.2f, 0.0f);
        GlStateManager.rotate(28.6479f, 1.0f, 0.0f, 0.0f);
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(swordTex);

    GlStateManager.rotate(90.0f, 1.0f, 0.0f, 0.0f);
    GlStateManager.translate(-0.25f, 0.14f, -0.05f);
    GlStateManager.rotate(-38.0f, 0.0f, 1.0f, 0.0f);
    swordModel.renderAllExcept("Benihime_Tassle");

    if (entitylivingbaseIn.isSneaking()) {
        GlStateManager.translate(0.25f, -0.14f, 0.05f);
        GlStateManager.rotate(38.0f, 0.0f, 1.0f, 0.0f);
        GlStateManager.rotate(-28.6479f, 1.0f, 0.0f, 0.0f);
        GlStateManager.translate(-0.25f, 0.14f, -0.05f);
        GlStateManager.rotate(-38.0f, 0.0f, 1.0f, 0.0f);
        GlStateManager.translate(0.026f, -0.021f, -0.101f);
    }

    GL11.glDisable(GL11.GL_LIGHTING);
    double d0 = entitylivingbaseIn.prevChasingPosX
            + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * partialTicks
            - (entitylivingbaseIn.prevPosX
                    + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * partialTicks);
    double d1 = entitylivingbaseIn.prevChasingPosY
            + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * partialTicks
            - (entitylivingbaseIn.prevPosY
                    + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * partialTicks);
    double d2 = entitylivingbaseIn.prevChasingPosZ
            + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * partialTicks
            - (entitylivingbaseIn.prevPosZ
                    + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * partialTicks);
    float f = entitylivingbaseIn.prevRenderYawOffset
            + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks;
    double d3 = MathHelper.sin(f * 0.017453292f);
    double d4 = -MathHelper.cos(f * 0.017453292f);
    float f1 = MathHelper.clamp((float) d1 * 50.0f, -6.0f, 180.0f);
    float f2 = Math.max(0, (float) (d0 * d3 + d2 * d4) * 100.0f);
    float f3 = (float) (d0 * d4 - d2 * d3) * 100.0f;
    float f4 = entitylivingbaseIn.prevCameraYaw
            + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks;
    f1 += MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified
            + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified)
                    * partialTicks)
            * 6.0f) * 32.0f * f4;
    GlStateManager.rotate(-51f, 0f, 1f, 0f);
    GlStateManager.translate(0.2017f, 0.0242f, 0.235f);
    GlStateManager.rotate(Math.max(-f2 / 2.0f - f1, -180), 0.0f, 0.0f, 1.0f);
    GlStateManager.rotate(f3 / 2.0f, 0.0f, 1.0f, 0.0f);
    GlStateManager.rotate(-f3 / 2.0f, 1.0f, 0.0f, 0.0f);
    GlStateManager.translate(0.0585f, -0.026f, -0.3f);
    swordModel.renderOnly("Benihime_Tassle");
    GL11.glEnable(GL11.GL_LIGHTING);
}

From source file:com.flowpowered.caustic.lwjgl.gl20.GL20Context.java

License:MIT License

@Override
public void disableCapability(Capability capability) {
    checkCreated();/* w  w w . j a  v  a2  s.  c  om*/
    GL11.glDisable(capability.getGLConstant());
    // Check for errors
    LWJGLUtil.checkForGLError();
}

From source file:com.freyja.FES.client.renderers.ItemRenderInjector.java

License:LGPL

private void renderInjector(float x, float y, float z, float scale) {
    GL11.glPushMatrix();/*  w  ww  .j  a va  2s .c om*/

    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glTranslatef(x, y, z);
    GL11.glScalef(scale, scale, scale);
    GL11.glRotatef(180f, 0f, 1f, 0f);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/FES/textures/injector.png");
    modelInjector.render();

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

From source file:com.gameminers.ethereal.architect.ModelCanvas.java

License:Open Source License

@Override
protected void paintGL() {
    try {/*from   ww w  .j  a  v  a 2 s  .c o  m*/
        if (getWidth() != current_width || getHeight() != current_height) {
            current_width = getWidth();
            current_height = getHeight();
            GL11.glViewport(0, 0, current_width, current_height);
        }
        GL11.glClearColor(0.0f, 0.6f, 0.5f, 1.0f);
        GL11.glClearDepth(1.0);
        GL11.glColor3f(1, 1, 1);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glLoadIdentity();
        GLU.gluPerspective(45.0f, (float) getWidth() / (float) getHeight(), 0.1f, 1000.0f);
        GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glTranslatef(0, 0, zoom);
        GL11.glRotatef(angle, 0f, 1f, 0f);
        GL11.glRotatef(tilt, 1f, 0f, 0f);
        GL11.glTranslatef(-16, -16, -16);
        if (lit) {
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL11.GL_LIGHT0);
            GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPosition);
            GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, lightAmbient);
        } else {
            GL11.glDisable(GL11.GL_LIGHTING);
        }
        if (textured) {
            GL11.glEnable(GL11.GL_TEXTURE_2D);
        } else {
            GL11.glDisable(GL11.GL_TEXTURE_2D);
        }
        if (model != null) {
            if (model.isAmbientOcclusionEnabled()) {
                GL11.glShadeModel(GL11.GL_SMOOTH);
            } else {
                GL11.glShadeModel(GL11.GL_FLAT);
            }
            for (ModelElement ele : model.getElements()) {
                GL11.glPushMatrix();
                if (ele.isShade()) {
                    GL11.glEnable(GL11.GL_LIGHTING);
                } else {
                    GL11.glDisable(GL11.GL_LIGHTING);
                }
                float fromX = ele.getFrom()[0];
                float fromY = ele.getFrom()[1];
                float fromZ = ele.getFrom()[2];
                float toX = ele.getTo()[0];
                float toY = ele.getTo()[1];
                float toZ = ele.getTo()[2];

                float fX = (fromX > toX ? fromX : toX);
                float fY = (fromY > toY ? fromY : toY);
                float fZ = (fromZ > toZ ? fromZ : toZ);
                float tX = (fromX > toX ? toX : fromX);
                float tY = (fromY > toY ? toY : fromY);
                float tZ = (fromZ > toZ ? toZ : fromZ);

                GL11.glTranslatef(fX, fY, fZ);
                float scaleX = tX - fX;
                float scaleY = tY - fY;
                float scaleZ = tZ - fZ;
                GL11.glBegin(GL11.GL_QUADS);
                GL11.glNormal3f(0, 0, -1f);
                for (int i = 0; i < vertices.length / 3; i++) {
                    int faceIdx = i / 4;
                    ModelFace face;
                    switch (faceIdx) {
                    case 0:
                        face = ele.getFaces().getNorth();
                        break;
                    case 1:
                        face = ele.getFaces().getSouth();
                        break;
                    case 2:
                        face = ele.getFaces().getUp();
                        break;
                    case 3:
                        face = ele.getFaces().getDown();
                        break;
                    case 4:
                        face = ele.getFaces().getWest();
                        break;
                    case 5:
                        face = ele.getFaces().getEast();
                        break;
                    default:
                        face = null;
                        break;
                    }
                    int idx = i * 3;
                    float vX = vertices[idx] * scaleX;
                    float vY = vertices[idx + 1] * scaleY;
                    float vZ = vertices[idx + 2] * scaleZ;
                    /*float u;
                    float v;
                    GL11.glTexCoord2f(u, v);*/
                    GL11.glVertex3f(vX, vY, vZ);
                }
                GL11.glEnd();
                GL11.glPopMatrix();
            }
        }
        GL11.glPopMatrix();
        swapBuffers();
        repaint();
    } catch (LWJGLException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.gameminers.mav.component.TextField.java

License:Open Source License

@Override
public void doRender() {
    if (viewPos > str.length()) {
        viewPos = str.length();//from  w  w w  .j a  v  a2s  .co m
    } else if (viewPos < 0) {
        viewPos = 0;
    }
    frames++;
    float[] fg = RenderState.getColor(0.8f);
    float[] bg = RenderState.getColor(0.3f);
    Rendering.drawRectangle(0, 0, 16, 16, 1, 0, 0, 0, 0);
    Rendering.drawRectangle(0, 0, width, height, fg[0], fg[1], fg[2], 1.0f, 0f);
    Rendering.drawRectangle(2, 2, width - 4, height - 4, bg[0], bg[1], bg[2], 1.0f, 0f);

    // roughly ported from Glass Pane
    if (cursorPos < 0) {
        cursorPos = 0;
    } else if (cursorPos > content.length()) {
        cursorPos = content.length();
    }
    String trimmedText = Fonts.trimStringToWidth(str.substring(viewPos), Fonts.base[1], width - 24);
    int trimmedLength = trimmedText.length();
    if (cursorPos > viewPos + trimmedLength) {
        viewPos = cursorPos - trimmedLength;
    } else if (cursorPos < viewPos) {
        viewPos = cursorPos;
    }
    int len = Fonts.base[1].getWidth(trimmedText);
    int mod = (int) (len >= width - 16 ? len - (width - 16) : 0);
    if (viewPos == 0) {
        mod = 0;
    }
    if (focused) {
        Rendering.drawRectangle(
                (8 - mod) + Fonts.base[1].getWidth(
                        trimmedText.substring(0, Math.min(trimmedLength, Math.max(0, cursorPos - viewPos)))),
                6, 2, height - 12, 1, 1, 1, (1.0f - ((frames % 25) / 40f)) / (Display.isActive() ? 1f : 4f),
                0.2f);
    }
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glScissor((int) x + 8, Display.getHeight() - (int) (y + height), (int) width - 16, (int) height);
    Fonts.base[1].drawString(8 - mod, 1, trimmedText);
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
}

From source file:com.gameminers.mav.render.Rendering.java

License:Open Source License

public static void drawPolygon(float x, float y, float radius, float r, float g, float b, float a, int count,
        float z) {
    GL11.glPushMatrix();//from www .j  a va2s.c  om
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glTranslatef(x, y, z);
    GL11.glColor4f(r, g, b, a);
    GL11.glBegin(GL11.GL_POLYGON);
    for (int i = 0; i < count; ++i) {
        GL11.glVertex2d(Math.sin(i / ((double) count) * 2 * Math.PI) * (radius),
                Math.cos(i / ((double) count) * 2 * Math.PI) * (radius));
    }
    GL11.glEnd();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glPopMatrix();
}

From source file:com.gameminers.mav.render.Rendering.java

License:Open Source License

public static void drawTriangle(float x, float y, float radius, float r, float g, float b, float a, float z) {
    GL11.glPushMatrix();/*from  ww w.j av  a  2  s .  c om*/
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glTranslatef(x, y, z);
    GL11.glColor4f(r, g, b, a);
    GL11.glBegin(GL11.GL_TRIANGLES);
    for (int i = 0; i < 3; ++i) {
        GL11.glVertex2d(Math.sin(i / ((double) 3) * 2 * Math.PI) * (radius),
                Math.cos(i / 3D * 2 * Math.PI) * (radius));
    }
    GL11.glEnd();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glPopMatrix();
}