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:code.elix_x.excore.utils.client.gui.elements.GuiElement.java

License:Apache License

public static void scissorsPost() {
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
}

From source file:com.a2client.corex.Render.java

License:Open Source License

static public void setBlendType(Const.BLEND_TYPE v) {
    //        GL11.glDisable(GL11.GL_BLEND);
    if (blend_type != v) {
        if (blend_type == Const.BLEND_TYPE.btNone)
            GL11.glEnable(GL11.GL_BLEND);
        blend_type = v;/*from   w  ww .  ja v a 2  s  . co  m*/
        switch (v) {
        case btNormal:
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            break;
        case btAdd:
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
            break;
        case btMult:
            GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_SRC_COLOR);
            break;
        default:
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
}

From source file:com.a2client.corex.Render.java

License:Open Source License

static public void setAlphaTest(int v) {
    if (alpha_test != v) {
        alpha_test = v;/*from www  . j  a va  2  s.  c om*/
        if (v > 0) {
            GL11.glEnable(GL11.GL_ALPHA_TEST);
            GL11.glAlphaFunc(GL11.GL_GREATER, (float) v / 255);
        } else {
            GL11.glDisable(GL11.GL_ALPHA_TEST);
        }
    }
}

From source file:com.a2client.corex.Render.java

License:Open Source License

static public void setDepthTest(boolean v) {
    if (depth_test != v) {
        depth_test = v;/*from   www.  j  a v  a 2  s.c  o  m*/
        if (v)
            GL11.glEnable(GL11.GL_DEPTH_TEST);
        else
            GL11.glDisable(GL11.GL_DEPTH_TEST);
    }
}

From source file:com.a2client.corex.Render.java

License:Open Source License

static public void setCullFace(Const.CULL_FACE v) {
    if (cull_face != v) {
        if (cull_face == Const.CULL_FACE.cfNone)
            GL11.glEnable(GL11.GL_CULL_FACE);
        cull_face = v;/*from   ww w .ja v a 2 s  . c o  m*/
        switch (v) {
        case cfFront:
            GL11.glCullFace(GL11.GL_FRONT);
            break;
        case cfBack:
            GL11.glCullFace(GL11.GL_BACK);
            break;
        default:
            GL11.glDisable(GL11.GL_CULL_FACE);
        }
    }
}

From source file:com.a2client.corex.Render.java

License:Open Source License

static public void set2D(int width, int height) {
    ResetBind();/*www . ja  v a 2  s  .  co m*/
    Clear(false, true);
    setBlendType(Const.BLEND_TYPE.btNormal);
    setDepthTest(false);
    setCullFace(Const.CULL_FACE.cfNone);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);

    setDepthTest(false);

    GL11.glViewport(0, 0, width, height);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, width, height, 0, -1, 1);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
}

From source file:com.aerialmage.magnetchem.GUI.WorldgenRegeneratorGui.java

License:Open Source License

@Override
protected void drawGuiContainerForegroundLayer(int param1, int param2) {
    //draw text and stuff here
    //the parameters for drawString are: string, x, y, color
    //fontRenderer.drawString("Magnetic worldgen liquifier", 25, -10, 4210752);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);//  w ww. java 2  s.  c o m
    this.mc.getTextureManager().bindTexture(myBG);
    this.drawTexturedModalRect(34 + 18 * selectedCol, -11 + 18 * selectedRow, 215, 0, 17, 17);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    //draws "Inventory" or your regional equivalent
    //fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
}

From source file:com.aesireanempire.eplus.gui.GuiModTable.java

License:LGPL

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);/*from ww w .  jav a2s .  com*/
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    mc.renderEngine.bindTexture(texture);
    drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);

    for (final GuiItem item : enchantmentArray) {
        if (item.yPos < guiTop + 15 || item.yPos >= guiTop + 87) {
            item.show(false);
        } else {
            item.show(true);
        }
        item.draw();
    }
}

From source file:com.aesireanempire.eplus.gui.GuiModTable.java

License:LGPL

@SuppressWarnings("unchecked")
@Override/*from   w  w  w . ja v a2s  .  c  o  m*/
public void drawScreen(int par1, int par2, float par3) {
    super.drawScreen(par1, par2, par3);

    final int adjustedMouseX = par1 - guiLeft;
    final int adjustedMouseY = par2 - guiTop;

    mc.renderEngine.bindTexture(texture);

    int tempY = adjustedMouseY - 16;
    if (tempY <= 0) {
        tempY = 0;
    }
    if (tempY >= 57) {
        tempY = 57;
    }
    sliderIndex = sliding ? MathHelper.round(tempY / 57D * enchantingPages, .25) : sliderIndex;

    if (sliderIndex >= enchantingPages) {
        sliderIndex = enchantingPages;
    }

    double sliderY = sliding ? tempY : 57 * (sliderIndex / enchantingPages);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    drawTexturedModalRect(guiLeft + guiOffset + 180, guiTop + 16 + (int) sliderY, 0, 182, 12, 15);

    if (!clicked && Mouse.isButtonDown(0)) {
        for (final GuiItem item : enchantmentArray) {
            if (getItemFromPos(par1, par2) == item && !item.disabled && !item.locked) {
                item.dragging = true;
            }
        }
        if (adjustedMouseX <= 191 + guiOffset && adjustedMouseX >= 180 + guiOffset) {
            if (enchantingPages != 0) {
                sliding = true;
            }
        }
    }

    for (final GuiItem item : enchantmentArray) {
        if (item.dragging && getItemFromPos(par1, par2) != item) {
            item.dragging = false;
        }
    }

    if (!Mouse.isButtonDown(0)) {
        for (final GuiItem item : enchantmentArray) {
            if (getItemFromPos(par1, par2) == item) {
                item.dragging = false;
            }
        }
        if (adjustedMouseX <= 191 + guiOffset && adjustedMouseX >= 180 + guiOffset) {
            sliding = false;
        }
    }

    clicked = Mouse.isButtonDown(0);

    for (final GuiItem item : enchantmentArray) {
        if (item.dragging) {
            item.scroll(adjustedMouseX - 36);
        }
    }
    if (EnchantingPlus.Debug) {
        fontRendererObj.drawString(String.format("%s: %s", "Error", error), 5, 5, 0xffaabbaa);
    }
    final int maxWidth = guiLeft - 20;
    final List<List<String>> information = new ArrayList<List<String>>();
    information.add(fontRendererObj.listFormattedStringToWidth(
            String.format("%s: %s", Strings.playerLevel, player.experienceLevel), maxWidth));

    if (container.tableInventory.getStackInSlot(0) == null || levelChanged()
            || !levelChanged() && !container.tableInventory.getStackInSlot(0).isItemDamaged()) {
        information.add(fontRendererObj.listFormattedStringToWidth(
                String.format("%s: %s", Strings.enchantingCost, totalCost), maxWidth));
    } else if (ConfigurationSettings.AllowRepair && !levelChanged()
            && container.tableInventory.getStackInSlot(0).isItemDamaged()) {
        information.add(fontRendererObj
                .listFormattedStringToWidth(String.format("%s: %s", Strings.repairCost, totalCost), maxWidth));
    }
    information.add(fontRendererObj.listFormattedStringToWidth(
            String.format("%s: %s", Strings.maxEnchantLevel, container.bookCases()), maxWidth));

    for (final List<String> display : information) {
        int height = information.indexOf(display) == 0 ? guiTop + fontRendererObj.FONT_HEIGHT + 8
                : guiTop + (fontRendererObj.FONT_HEIGHT + 8) * (information.indexOf(display) + 1);
        if (information.indexOf(display) > 0) {
            for (int i = information.indexOf(display) - 1; i >= 0; i--) {
                height += (fontRendererObj.FONT_HEIGHT + 3) * (information.get(i).size() - 1);
            }
        }

        try {
            drawHoveringText(display, guiLeft - 20 - maxWidth, height, fontRendererObj);
        } catch (NoSuchMethodError e) {
            final StringBuilder sb = new StringBuilder();

            for (final String text : display) {
                sb.append(text);
                sb.append(" ");
            }
            drawCreativeTabHoveringText(sb.toString(), guiLeft - 20 - maxWidth, height);
            if (!TMInagged) {
                EnchantingPlus.log.error("Please update or remove NEI / TMI. It is causing issues.");
                TMInagged = true;
            }
        }
    }

    if (isShiftKeyDown() && getItemFromPos(par1, par2) != null) {
        final String name = FontFormat.BOLD + getItemFromPos(par1, par2).getTranslatedName();
        String info = EnchantmentHelp.getToolTip(getItemFromPos(par1, par2).enchantment);

        if (info.isEmpty()) {
            info = FontFormat.DARKRED + String.format("%s ", Strings.errorToolTip)
                    + getItemFromPos(par1, par2).enchantment.getName();
        }

        info = FontFormat.PURPLE + info;

        final List<String> display = new ArrayList<String>();

        display.add(name);
        display.addAll(fontRendererObj.listFormattedStringToWidth(info, 150));
        try {
            drawHoveringText(display, par1, par2, fontRendererObj);
        } catch (NoSuchMethodError e) {
            final StringBuilder sb = new StringBuilder();

            for (final String text : display) {
                sb.append(text);
                sb.append(" ");
            }
            drawCreativeTabHoveringText(sb.toString(), guiLeft - 20 - maxWidth, height);
            if (!TMInagged) {
                EnchantingPlus.log.error("Please update or remove NEI / TMI. It is causing issues.");
                TMInagged = true;
            }
        }
    }

    if (!error.isEmpty()) {
        drawCreativeTabHoveringText(error, (xSize + guiLeft) / 2 - fontRendererObj.getStringWidth(error) / 4,
                guiTop - fontRendererObj.FONT_HEIGHT);
    }
}

From source file:com.ardor3d.framework.lwjgl.LwjglHeadlessCanvas.java

License:Open Source License

public void draw() {
    // bind correct fbo
    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
            _useMSAA ? _msfboID : _fboID);

    // Make sure this OpenGL context is current.
    ContextManager.switchContext(this);
    try {//from   w w w . j av a 2  s . c om
        _buff.makeCurrent();
    } catch (final LWJGLException ex) {
        ex.printStackTrace();
    }

    // make sure camera is set
    if (Camera.getCurrentCamera() != _camera) {
        _camera.update();
    }
    _camera.apply(_renderer);

    // clear buffers
    GL11.glDisable(GL11.GL_SCISSOR_TEST);
    _renderer.clearBuffers(Renderer.BUFFER_COLOR | Renderer.BUFFER_DEPTH);

    // draw our scene
    _scene.renderUnto(_renderer);
    _renderer.flushFrame(false);

    // if we're multisampled, we need to blit to a non-multisampled fbo first
    if (_useMSAA) {
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_DRAW_FRAMEBUFFER_EXT, _fboID);
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferBlit.GL_READ_FRAMEBUFFER_EXT, _msfboID);
        EXTFramebufferBlit.glBlitFramebufferEXT(0, 0, _settings.getWidth(), _settings.getHeight(), 0, 0,
                _settings.getWidth(), _settings.getHeight(),
                GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT,
                GL11.GL_NEAREST);

        // get ready to read non-msaa fbo
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, _fboID);
    }

    // read data from our color buffer
    _data.rewind();
    GL11.glReadBuffer(EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT);
    GL11.glReadPixels(0, 0, _settings.getWidth(), _settings.getHeight(), GL12.GL_BGRA, GL11.GL_UNSIGNED_BYTE,
            _data);

    // release our FBO.
    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);
}