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:com.mrcrayfish.furniture.gui.RecipePage.java

License:Open Source License

private void drawOven(Minecraft mc, GuiRecipeBook gui, RecipeData data, int x, int y) {
    GL11.glEnable(GL11.GL_LIGHTING);
    gui.getItemRenderer().zLevel = 100.0F;
    gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getInput(), x, y);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getInput(), x, y);
    gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getOutput(), x + 60, y);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getOutput(), x + 60, y);
    gui.getItemRenderer().zLevel = 0.0F;
    GL11.glDisable(GL11.GL_LIGHTING);/* ww w . j a  v  a2s .com*/
}

From source file:com.mrcrayfish.furniture.gui.RecipePage.java

License:Open Source License

private void drawMineBay(Minecraft mc, GuiRecipeBook gui, RecipeData data, int x, int y) {
    GL11.glDisable(GL11.GL_LIGHTING);//  w w  w  .j av  a2  s  . com
    gui.drawTag(x + 42, y - 1);
    GL11.glEnable(GL11.GL_LIGHTING);
    gui.getItemRenderer().zLevel = 100.0F;
    gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getInput(), x + 20, y);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getInput(), x + 20, y);
    gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getCurrency(), x + 51, y);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getCurrency(), x + 51, y);
    gui.getFontRenderer().drawString("x" + Integer.toString(data.getPrice()), x + 68, y + 4, 0);
    gui.getItemRenderer().zLevel = 0.0F;
    GL11.glDisable(GL11.GL_LIGHTING);
}

From source file:com.mrcrayfish.furniture.gui.RecipePage.java

License:Open Source License

private void drawPrinter(Minecraft mc, GuiRecipeBook gui, RecipeData data, int x, int y) {
    GL11.glEnable(GL11.GL_LIGHTING);
    gui.getItemRenderer().zLevel = 100.0F;
    gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getInput(), x, y);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getInput(), x, y);
    gui.getItemRenderer().zLevel = 0.0F;
    GL11.glDisable(GL11.GL_LIGHTING);//from w w w . java 2s.  co m
}

From source file:com.mrcrayfish.furniture.gui.RecipePage.java

License:Open Source License

private void drawChoppingBoard(Minecraft mc, GuiRecipeBook gui, RecipeData data, int x, int y) {
    GL11.glEnable(GL11.GL_LIGHTING);
    gui.getItemRenderer().zLevel = 100.0F;
    gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getInput(), x, y);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getInput(), x, y);
    gui.drawKnife(x + 4, y - 6);//w w  w .  ja  v a2 s.  c  o  m
    gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getOutput(), x + 60, y);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getOutput(), x + 60, y);
    gui.getItemRenderer().zLevel = 0.0F;
    GL11.glDisable(GL11.GL_LIGHTING);
}

From source file:com.mrcrayfish.furniture.gui.RecipePage.java

License:Open Source License

private void drawBlender(Minecraft mc, GuiRecipeBook gui, RecipeData data, int x, int y) {
    gui.getFontRenderer().drawString(fixName(data.getDrinkName()), x, y, 0);
    GL11.glEnable(GL11.GL_LIGHTING);
    for (int i = 0; i < data.getIngredients().size(); i++) {
        if (data.getIngredients().get(i) != null) {
            gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getIngredients().get(i), x + ((i % 2) * 18),
                    y + ((i / 2) * 18) + 10);
            gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getIngredients().get(i),
                    x + ((i % 2) * 18), y + ((i / 2) * 18) + 10);
        }/* w w  w.  j a va  2 s  .co m*/
    }
    gui.drawProgressArrow(x + 45, y + 20);
    GL11.glDisable(GL11.GL_LIGHTING);
    gui.getItemRenderer().renderItemAndEffectIntoGUI(
            getDrink(data.getDrinkName(), data.getRed(), data.getGreen(), data.getBlue()), x + 80, y + 20);
    gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(),
            getDrink(data.getDrinkName(), data.getRed(), data.getGreen(), data.getBlue()), x + 80, y + 20);
}

From source file:com.mrcrayfish.furniture.render.tileentity.BlenderRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_,
        int p_180535_9_) {
    TileEntityBlender blender = (TileEntityBlender) tileEntity;
    ItemStack[] ingredients = blender.getIngredients();

    GL11.glPushMatrix();//from  ww  w . j  ava  2  s  .  c  o  m
    GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.2F, (float) posZ + 0.5F);
    GL11.glScalef(0.65F, 0.65F, 0.65F);
    entityFood.hoverStart = 0.0F;
    for (int i = 0; i < ingredients.length; i++) {
        if (ingredients[i] != null) {
            entityFood.setEntityItemStack(ingredients[i]);
            GL11.glRotatef(i * -90F, 0, 1, 0);
            GL11.glRotatef(blender.progress * 18F, 0, 1, 0);
            Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(entityFood, 0.0D, 0.2D, 0.0D,
                    0.0F, 0.0F);
        }
    }
    GL11.glPopMatrix();

    if (blender.isBlending() | blender.drinkCount > 0) {
        Tessellator tessellator = Tessellator.getInstance();
        GL11.glPushMatrix();
        GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.05F, (float) posZ + 0.5F);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);

        float alpha = blender.isBlending() ? (blender.progress / 200F) : (blender.drinkCount > 0 ? 1.0F : 0.0F);
        GL11.glColor4f(blender.currentRed / 255F, blender.currentGreen / 255F, blender.currentBlue / 255F,
                alpha);

        float height = blender.isBlending() ? 0.8F : (0.275F + (0.525F * (blender.drinkCount / 6F)));
        GL11.glBegin(GL11.GL_QUADS);

        // North Face
        GL11.glVertex3d(-0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, height, -0.2);
        GL11.glVertex3d(-0.2, height, -0.2);

        // South Face
        GL11.glVertex3d(-0.2, 0.275, 0.2);
        GL11.glVertex3d(0.2, 0.275, 0.2);
        GL11.glVertex3d(0.2, height, 0.2);
        GL11.glVertex3d(-0.2, height, 0.2);

        // West Face
        GL11.glVertex3d(-0.2, 0.275, -0.2);
        GL11.glVertex3d(-0.2, 0.275, 0.2);
        GL11.glVertex3d(-0.2, height, 0.2);
        GL11.glVertex3d(-0.2, height, -0.2);

        // East Face
        GL11.glVertex3d(0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, 0.2);
        GL11.glVertex3d(0.2, height, 0.2);
        GL11.glVertex3d(0.2, height, -0.2);

        // Top Face
        GL11.glVertex3d(-0.2, height, -0.2);
        GL11.glVertex3d(0.2, height, -0.2);
        GL11.glVertex3d(0.2, height, 0.2);
        GL11.glVertex3d(-0.2, height, 0.2);

        // Bottom Face
        GL11.glVertex3d(-0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, -0.2);
        GL11.glVertex3d(0.2, 0.275, 0.2);
        GL11.glVertex3d(-0.2, 0.275, 0.2);

        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);

        GL11.glPopMatrix();
    }
}

From source file:com.mrcrayfish.furniture.render.tileentity.CupRenderer.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_,
        int p_180535_9_) {
    TileEntityCup tileEntityCup = (TileEntityCup) tileEntity;
    if (tileEntityCup.getDrink() != null) {
        Tessellator tessellator = Tessellator.getInstance();
        GL11.glPushMatrix();/*  w w w.j  a  v  a 2  s .co m*/
        GL11.glTranslatef((float) posX + 0.5F, (float) posY, (float) posZ + 0.5F);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glEnable(GL11.GL_BLEND);

        GL11.glColor4f(tileEntityCup.red / 255F, tileEntityCup.green / 255F, tileEntityCup.blue / 255F, 1.0F);

        GL11.glBegin(GL11.GL_QUADS);

        // North Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.4, -0.125);
        GL11.glVertex3d(-0.125, 0.4, -0.125);

        // South Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(0.125, 0.4, 0.125);
        GL11.glVertex3d(-0.125, 0.4, 0.125);

        // West Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(-0.125, 0.4, 0.125);
        GL11.glVertex3d(-0.125, 0.4, -0.125);

        // East Face
        GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(0.125, 0.4, 0.125);
        GL11.glVertex3d(0.125, 0.4, -0.125);

        // Top Face
        GL11.glVertex3d(-0.125, 0.4, -0.125);
        GL11.glVertex3d(0.125, 0.4, -0.125);
        GL11.glVertex3d(0.125, 0.4, 0.125);
        GL11.glVertex3d(-0.125, 0.4, 0.125);

        // Bottom Face
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, -0.125);
        GL11.glVertex3d(0.125, 0.5 * 0.0625, 0.125);
        GL11.glVertex3d(-0.125, 0.5 * 0.0625, 0.125);

        GL11.glEnd();

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);

        GL11.glPopMatrix();
    }
}

From source file:com.mtbs3d.minecrift.FBOParams.java

License:LGPL

public FBOParams(String fboName, int textureType, int internalFormat, int baseFormat, int bufferType,
        int fboWidth, int fboHeight) throws Exception {
    Minecraft mc = Minecraft.getMinecraft();
    _textureType = textureType;//from   w  w w . j av  a 2 s  .c o  m

    if (fboSupport == FBO_SUPPORT.USE_EXT_UNKNOWN) {
        // The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer.
        try {
            _frameBufferId = GL30.glGenFramebuffers();
            fboSupport = FBO_SUPPORT.USE_GL30;
        } catch (IllegalStateException ex) {
            System.out.println(
                    "[Minecrift] FBO creation: GL30.glGenFramebuffers not supported. Attempting to use EXTFramebufferObject.glGenFramebuffersEXT");
            fboSupport = FBO_SUPPORT.USE_EXT;

            try {
                _frameBufferId = EXTFramebufferObject.glGenFramebuffersEXT();
            } catch (IllegalStateException ex1) {
                System.out.println(
                        "[Minecrift] FBO creation: EXTFramebufferObject.glGenFramebuffersEXT not supported, FBO creation failed.");
                throw ex1;
            }
        }
    } else if (fboSupport == FBO_SUPPORT.USE_GL30) {
        _frameBufferId = GL30.glGenFramebuffers();
    } else {
        _frameBufferId = EXTFramebufferObject.glGenFramebuffersEXT();
    }

    if (fboSupport == FBO_SUPPORT.USE_GL30) {
        _colorTextureId = GL11.glGenTextures();
        _depthRenderBufferId = GL30.glGenRenderbuffers();

        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, _frameBufferId);
        checkGLError("FBO bind framebuffer");

        GL11.glBindTexture(textureType, _colorTextureId);
        checkGLError("FBO bind texture");

        GL11.glEnable(textureType);
        GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexImage2D(textureType, 0, internalFormat, fboWidth, fboHeight, 0, baseFormat, bufferType,
                (java.nio.ByteBuffer) null);

        System.out.println("[Minecrift] FBO '" + fboName + "': w: " + fboWidth + ", h: " + fboHeight);

        GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, textureType,
                _colorTextureId, 0);

        checkGLError("FBO bind texture framebuffer");

        GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, _depthRenderBufferId); // bind the depth renderbuffer
        GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL14.GL_DEPTH_COMPONENT24, fboWidth, fboHeight); // get the data space for it
        GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER,
                _depthRenderBufferId);
        checkGLError("FBO bind depth framebuffer");
    } else {
        _colorTextureId = GL11.glGenTextures();
        _depthRenderBufferId = EXTFramebufferObject.glGenRenderbuffersEXT();

        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _frameBufferId);
        checkGLError("FBO bind framebuffer");

        GL11.glBindTexture(textureType, _colorTextureId);
        checkGLError("FBO bind texture");

        GL11.glEnable(textureType);
        GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(textureType, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexImage2D(textureType, 0, internalFormat, fboWidth, fboHeight, 0, baseFormat, bufferType,
                (java.nio.ByteBuffer) null);
        System.out.println("[Minecrift] FBO '" + fboName + "': w: " + fboWidth + ", h: " + fboHeight);

        EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, textureType, _colorTextureId, 0);

        checkGLError("FBO bind texture framebuffer");

        EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                _depthRenderBufferId); // bind the depth renderbuffer
        EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                GL14.GL_DEPTH_COMPONENT24, fboWidth, fboHeight); // get the data space for it
        EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT,
                _depthRenderBufferId);
        checkGLError("FBO bind depth framebuffer");
    }

    if (!checkFramebufferStatus()) {
        // OK, if we have an error here - then throw an exception
        System.out.println("[Minecrift] FAILED to create framebuffer!!");
        throw new Exception("Failed to create framebuffer");
    }
}

From source file:com.mtbs3d.minecrift.MCOculus.java

License:LGPL

public void endFrame() {
    GL11.glDisable(GL11.GL_CULL_FACE); // Oculus wants CW orientations, avoid the problem by turning off culling...
    GL11.glDisable(GL11.GL_DEPTH_TEST); // Nothing is drawn with depth test on...

    // End the frame
    super.endFrame();

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); // Unbind GL_ARRAY_BUFFER for my own vertex arrays to work...
    GL11.glEnable(GL11.GL_CULL_FACE); // Turn back on...
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Turn back on...
    GL11.glClearDepth(1); // Oculus set this to 0 (the near plane), return to normal...
    ARBShaderObjects.glUseProgramObjectARB(0); // Oculus shader is still active, turn it off...

    Display.processMessages();//  w  w  w .j  a v  a2s .c om
}

From source file:com.mtbs3d.minecrift.provider.MCOculus.java

License:LGPL

public void endFrame() {
    GL11.glDisable(GL11.GL_CULL_FACE); // Oculus wants CW orientations, avoid the problem by turning off culling...
    GL11.glDisable(GL11.GL_DEPTH_TEST); // Nothing is drawn with depth test on...
    //GL30.glBindVertexArray(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); // Unbind GL_ARRAY_BUFFER for my own vertex arrays to work...
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);

    // End the frame
    super.endFrame();

    GL11.glFrontFace(GL11.GL_CCW); // Needed for OVR SDK 0.4.0
    GL11.glEnable(GL11.GL_CULL_FACE); // Turn back on...
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Turn back on...
    GL11.glClearDepth(1); // Oculus set this to 0 (the near plane), return to normal...
    ARBShaderObjects.glUseProgramObjectARB(0); // Oculus shader is still active, turn it off...

    Display.processMessages();//w  w w  . j a  va  2 s .  c  o m
}