Example usage for org.lwjgl.opengl GL11 glLineWidth

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

Introduction

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

Prototype

public static void glLineWidth(@NativeType("GLfloat") float width) 

Source Link

Document

Sets the width of rasterized line segments.

Usage

From source file:minesweeperMod.client.MinesweeperDrawBlockHighlightHandler.java

License:LGPL

public static void drawQuad(float x, float y, float width, float height, double zLevel, int tile) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from   w  w  w . j  a va  2s . c o  m*/
    GL11.glLineWidth(5.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(renderColors.get(tile)[0], renderColors.get(tile)[1], renderColors.get(tile)[2],
            pulseTransparency);

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertex(x + 0F, y + height, zLevel);
    tessellator.addVertex(x + width, y + height, zLevel);
    tessellator.addVertex(x + width, y + 0F, zLevel);
    tessellator.addVertex(x + 0F, y + 0F, zLevel);
    tessellator.draw();

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

From source file:mods.railcraft.client.render.RenderTESRSignals.java

License:Open Source License

private void renderPairs(TileEntity tile, double x, double y, double z, float f, AbstractPair pair,
        ColorProfile colorProfile) {//from  ww  w .j av a 2 s  .  c  o  m
    if (pair.getPairs().isEmpty()) {
        return;
    }
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glLineWidth(5F);

    GL11.glBegin(GL11.GL_LINES);
    for (WorldCoordinate target : pair.getPairs()) {
        int color = colorProfile.getColor(tile, pair.getCoords(), target);
        float c1 = (float) (color >> 16 & 255) / 255.0F;
        float c2 = (float) (color >> 8 & 255) / 255.0F;
        float c3 = (float) (color & 255) / 255.0F;
        GL11.glColor3f(c1, c2, c3);

        GL11.glVertex3f((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
        float tx = (float) x + target.x - tile.xCoord;
        float ty = (float) y + target.y - tile.yCoord;
        float tz = (float) z + target.z - tile.zCoord;
        GL11.glVertex3f(tx + 0.5f, ty + 0.5f, tz + 0.5f);
    }
    GL11.glEnd();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:myfirstgame.grass.java

public void outline() {
    GL11.glLineWidth((float) 2.5);
    GL11.glColor3f(255, 0, 0);//from w w w  .  j  a  v  a  2  s.c  o m
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx, gy);
    GL11.glVertex2f(gx, gy + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx, gy + sizeY);
    GL11.glVertex2f(gx + sizeX, gy + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx + sizeX, gy + sizeY);
    GL11.glVertex2f(gx + sizeX, gy);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(gx + sizeX, gy);
    GL11.glVertex2f(gx, gy);
    GL11.glEnd();

    GL11.glColor3f(255, 255, 255);

}

From source file:myfirstgame.Tree.java

public void outline() {
    GL11.glLineWidth((float) 2.5);
    GL11.glColor3f(255, 0, 0);//from   ww w  . ja va2s. c om
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex, treey);
    GL11.glVertex2f(treex, treey + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex, treey + sizeY);
    GL11.glVertex2f(treex + sizeX, treey + sizeY);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex + sizeX, treey + sizeY);
    GL11.glVertex2f(treex + sizeX, treey);
    GL11.glEnd();

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(treex + sizeX, treey);
    GL11.glVertex2f(treex, treey);
    GL11.glEnd();

    GL11.glColor3f(255, 255, 255);

}

From source file:name.martingeisse.stackd.client.gui.element.ThickBorder.java

License:Open Source License

@Override
public void handleEvent(GuiEvent event) {
    requireWrappedElement();//w  w  w  .j av a 2 s  .  c  om
    getWrappedElement().handleEvent(event);
    if (event == GuiEvent.DRAW) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        color.glColor();
        int sizeDelta = getGui().pixelsToUnitsInt(thickness);
        int borderOffset = sizeDelta / 2;
        int x = getAbsoluteX() + borderOffset;
        int y = getAbsoluteY() + borderOffset;
        int w = getWidth() - sizeDelta;
        int h = getHeight() - sizeDelta;
        GL11.glLineWidth(thickness);
        GL11.glBegin(GL11.GL_LINE_STRIP);
        GL11.glVertex2i(x, y);
        GL11.glVertex2i(x + w, y);
        GL11.glVertex2i(x + w, y + h);
        GL11.glVertex2i(x, y + h);
        GL11.glVertex2i(x, y);
        GL11.glEnd();
    }
}

From source file:name.martingeisse.stackd.client.gui.element.ThinBorder.java

License:Open Source License

@Override
public void handleEvent(GuiEvent event) {
    requireWrappedElement();/*from www . j a v  a2  s.c o  m*/
    getWrappedElement().handleEvent(event);
    if (event == GuiEvent.DRAW) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        color.glColor();
        int x = getAbsoluteX(), y = getAbsoluteY(), w = getWidth(), h = getHeight();
        GL11.glLineWidth(thickness);
        GL11.glBegin(GL11.GL_LINE_STRIP);
        GL11.glVertex2i(x, y);
        GL11.glVertex2i(x + w, y);
        GL11.glVertex2i(x + w, y + h);
        GL11.glVertex2i(x, y + h);
        GL11.glVertex2i(x, y);
        GL11.glEnd();
    }
}

From source file:net.cortexmodders.lyoko.client.render.RenderUtil.java

License:MIT License

public static void renderWireframe(AxisAlignedBB box) {
    // render wireframe
    GL11.glPushMatrix();/*from   w  ww. java 2  s .  c  om*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(false);

    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawing(3);
    tessellator.addVertex(box.minX, box.minY, box.minZ);
    tessellator.addVertex(box.maxX, box.minY, box.minZ);
    tessellator.addVertex(box.maxX, box.minY, box.maxZ);
    tessellator.addVertex(box.minX, box.minY, box.maxZ);
    tessellator.addVertex(box.minX, box.minY, box.minZ);
    tessellator.draw();
    tessellator.startDrawing(3);
    tessellator.addVertex(box.minX, box.maxY, box.minZ);
    tessellator.addVertex(box.maxX, box.maxY, box.minZ);
    tessellator.addVertex(box.maxX, box.maxY, box.maxZ);
    tessellator.addVertex(box.minX, box.maxY, box.maxZ);
    tessellator.addVertex(box.minX, box.maxY, box.minZ);
    tessellator.draw();
    tessellator.startDrawing(1);
    tessellator.addVertex(box.minX, box.minY, box.minZ);
    tessellator.addVertex(box.minX, box.maxY, box.minZ);
    tessellator.addVertex(box.maxX, box.minY, box.minZ);
    tessellator.addVertex(box.maxX, box.maxY, box.minZ);
    tessellator.addVertex(box.maxX, box.minY, box.maxZ);
    tessellator.addVertex(box.maxX, box.maxY, box.maxZ);
    tessellator.addVertex(box.minX, box.minY, box.maxZ);
    tessellator.addVertex(box.minX, box.maxY, box.maxZ);
    tessellator.draw();

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:net.kubin.world.World.java

License:Apache License

private void renderOverlay() {
    Configuration conf = Kubin.getConfiguration();

    Game.getInstance().initOverlayRendering();

    GL11.glColor3f(1, 1, 1);/*from  w  w  w .  j  a  v  a 2s  .co m*/

    if (Game.RENDER_INFORMATION_OVERLAY) {
        GLFont infoFont = FontStorage.getFont("Monospaced_20");

        /* Down Left Info */
        infoFont.print(4, 30, _player.coordinatesToString());
        infoFont.print(4, 45, "Visible Chunks:      " + _visibleChunks.size());
        infoFont.print(4, 60, "Updading Blocks:     " + _updatingBlocks);
        infoFont.print(4, 75, "Total Chunks in RAM: " + _chunkManager.getTotalChunkCount());
        infoFont.print(4, 90, "Local Chunks:        " + _localChunks.size());
        infoFont.print(4, 105, "Total Local Blocks:  " + _localBlockCount);
        infoFont.print(4, 120, "Time:  " + _time);
        infoFont.print(4, 135, "Sunlight:  " + _sunlight);

    }

    /** RENDER **/
    if (_activatedInventory != null) {
        Game.getInstance().renderTransculentOverlayLayer();
        _activatedInventory.renderInventory();
    } else {
        int width = conf.getWidth();
        int height = conf.getHeight();
        // Center Cross
        GL11.glDisable(GL11.GL_TEXTURE_2D);

        if (CENTER_CROSS_CALL_LIST == 0) {
            CENTER_CROSS_CALL_LIST = GL11.glGenLists(1);
            GL11.glNewList(CENTER_CROSS_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE);

            int crossSize = 7;
            int crossHole = 4;

            GL11.glLineWidth(2.5f);

            GL11.glColor3f(255, 255, 255);
            GL11.glBegin(GL11.GL_LINES);
            GL11.glVertex3f(width / 2f - crossSize - crossHole, height / 2f, 0);
            GL11.glVertex3f(width / 2f - crossHole, height / 2f, 0);

            GL11.glVertex3f(width / 2f + crossSize + crossHole, height / 2f, 0);
            GL11.glVertex3f(width / 2f + crossHole, height / 2f, 0);

            GL11.glVertex3f(width / 2f, height / 2f - crossSize - crossHole, 0);
            GL11.glVertex3f(width / 2f, height / 2f - crossHole, 0);

            GL11.glVertex3f(width / 2f, height / 2f + crossSize + crossHole, 0);
            GL11.glVertex3f(width / 2f, height / 2f + crossHole, 0);

            GL11.glEnd();
            GL11.glEndList();
        } else {
            GL11.glCallList(CENTER_CROSS_CALL_LIST);
        }

        GL11.glEnable(GL11.GL_TEXTURE_2D);

        // Inventory bar
        GL11.glPushMatrix();
        Texture texGui = TextureStorage.getTexture("gui.gui");
        texGui.bind();
        float tileSize = 20.0f / texGui.getImageWidth();

        if (INVENTORY_BAR_CALL_LIST == 0) {
            INVENTORY_BAR_CALL_LIST = GL11.glGenLists(2);

            /* Bar */
            GL11.glNewList(INVENTORY_BAR_CALL_LIST, GL11.GL_COMPILE_AND_EXECUTE);

            GL11.glTranslatef(width / 2.0f - 9 * 20, 0, 0);
            GL11.glColor3f(1.0f, 1.0f, 1.0f);
            GL11.glBegin(GL11.GL_QUADS);

            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(0, 40);

            GL11.glTexCoord2f(tileSize * 9, 0);
            GL11.glVertex2f(9 * 40, 40);

            GL11.glTexCoord2f(tileSize * 9, tileSize);
            GL11.glVertex2f(9 * 40, 0);

            GL11.glTexCoord2f(0, tileSize);
            GL11.glVertex2f(0, 0);

            GL11.glEnd();
            GL11.glEndList();

            /* Little frame around selected item */
            float frameTileSize = 24.0f / texGui.getImageWidth();
            float frameTileY = 22.0f / texGui.getImageHeight();

            GL11.glNewList(INVENTORY_BAR_CALL_LIST + 1, GL11.GL_COMPILE);
            GL11.glBegin(GL11.GL_QUADS);

            GL11.glTexCoord2f(0, frameTileY);
            GL11.glVertex2f(0, 48);

            GL11.glTexCoord2f(frameTileSize, frameTileY);
            GL11.glVertex2f(48, 48);

            GL11.glTexCoord2f(frameTileSize, frameTileY + frameTileSize);
            GL11.glVertex2f(48, 0);

            GL11.glTexCoord2f(0, frameTileY + frameTileSize);
            GL11.glVertex2f(0, 0);

            GL11.glEnd();
            GL11.glEndList();
        } else {
            GL11.glCallList(INVENTORY_BAR_CALL_LIST);
        }

        /* Content */
        GL11.glPushMatrix();
        GL11.glTranslatef(20, 20, 0);

        for (int i = 0; i < 9; ++i) {
            InventoryPlace place = getActivePlayer().getInventory().getInventoryPlace(i);

            if (place != null) {
                place.render();
            }

            GL11.glTranslatef(40, 0, 0);
        }

        texGui.bind();
        GL11.glPopMatrix();
        GL11.glTranslatef(getActivePlayer().getSelectedInventoryItemIndex() * 40.0f - 4, -4, 0);
        GL11.glCallList(INVENTORY_BAR_CALL_LIST + 1);

        GL11.glPopMatrix();
    }
}

From source file:net.malisis.advert.gui.advertselection.AdvertSelectionComponent.java

License:Open Source License

@Override
public void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick) {
    if (!isSelected())
        return;/*from w w w  .  j a  v a2s.c  o  m*/

    renderer.drawRectangle(0, 0, 0, getWidth(), getHeight(), 0xBBBBEE, 255);
    renderer.next(GL11.GL_LINE_LOOP);
    GL11.glLineWidth(2);
    renderer.drawRectangle(0, 0, 0, getWidth(), getHeight(), 0x000000, 255);
    renderer.next(GL11.GL_QUADS);
}

From source file:net.malisis.advert.gui.AdvertView.java

License:Open Source License

@Override
public void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick) {
    if (advert == null || StringUtils.isEmpty(advert.getUrl()))
        return;/*from  w  w  w .j  av a 2 s.  co  m*/

    GuiTexture texture = advert.getTexture();
    if (texture == null) {
        String text = advert.getError();
        if (text != null) {
            int y = 0;
            List<String> err = font.wrapText(text, getWidth());
            for (String e : err)
                renderer.drawText(null, e, 0, 11 * y++, 0, fro);
        } else
            renderer.drawText("Downloading...");
        return;
    }

    shape.resetState();
    shape.setSize((int) (texture.getWidth() * getFactor()), (int) (texture.getHeight() * getFactor()));
    renderer.bindTexture(texture);
    renderer.drawShape(shape, rp);

    if (editable/* && (u != 0 || v != 0 || U != 1 || V != 1)*/) {
        renderer.next(GL11.GL_LINE_LOOP);
        renderer.disableTextures();
        GL11.glLineWidth(1);

        float u = advertSelection.U - advertSelection.u;
        float v = advertSelection.V - advertSelection.v;
        float w = texture.getWidth() * getFactor();
        float h = texture.getHeight() * getFactor();

        shape.resetState();
        shape.setSize((int) (u * w), (int) (v * h));
        shape.translate(Math.round(advertSelection.u * w), Math.round(advertSelection.v * h));
        rp.colorMultiplier.set(0xFF0000);
        renderer.drawShape(shape, rp);

        renderer.next(GL11.GL_QUADS);
        renderer.enableTextures();
    }
}