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:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Bordered quad/*from ww w.java2s. c  om*/
 * 
 * @param x
 * @param y
 * @param x2
 * @param y2
 * @param l1
 * @param col1
 * @param col2
 */
public static void drawBorderedRect(int x, int y, int x2, int y2, float l1, int col1, int col2) {
    drawRect(x, y, x2, y2, col2);

    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

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

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Border of a quad// w w w .j  a  v  a  2 s .c om
 * 
 * @param x
 * @param y
 * @param x2
 * @param y2
 * @param l1
 * @param col1
 */
public static void drawHollowBorderedRect(int x, int y, int x2, int y2, float l1, int col1) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

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

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Gradient rect with a border/*from ww w.j  a va 2 s  . co  m*/
 * 
 * @param x
 * @param y
 * @param x2
 * @param y2
 * @param l1
 * @param col1
 * @param col2
 * @param col3
 */
public static void drawGradientBorderedRect(int x, int y, int x2, int y2, float l1, int col1, int col2,
        int col3) {
    drawGradientRect(x, y, x2, y2, col2, col3);

    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

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

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Vertical line/*from ww w. j  ava  2 s. c o  m*/
 * 
 * @param x
 * @param y
 * @param y2
 * @param l1
 * @param col1
 */
public static void drawVerticalLine(int x, int y, int y2, float l1, int col1) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

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

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Horizontal line/*from   w  w  w  . j  a  v  a  2s.  co  m*/
 * 
 * @param x
 * @param x2
 * @param y
 * @param l1
 * @param col1
 */
public static void drawHorizontalLine(int x, int x2, int y, float l1, int col1) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glEnd();
    GL11.glPopMatrix();

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

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

/**
 * Diagonal line?// ww  w.  ja  v  a2  s .  com
 * 
 * @param x
 * @param x2
 * @param y
 * @param l1
 * @param col1
 */
public static void drawDiagonalLine(int x, int x2, int y, float l1, int col1) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(y, x2);
    GL11.glEnd();
    GL11.glPopMatrix();

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

From source file:com.kodehawa.gui.api.render.ModGuiUtils.java

License:Open Source License

public static void drawGBRect(double x, double y, double x2, double y2, float l1, int col1, int col2,
        int col3) {
    float f = ((col1 >> 24) & 0xFF) / 255F;
    float f1 = ((col1 >> 16) & 0xFF) / 255F;
    float f2 = ((col1 >> 8) & 0xFF) / 255F;
    float f3 = (col1 & 0xFF) / 255F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);/*from www  .j  a  v a  2  s . c o m*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPushMatrix();
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glLineWidth(1F);
    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y2);
    GL11.glVertex2d(x2, y2);
    GL11.glEnd();
    GL11.glPopMatrix();

    drawGradientRect(x, y, x2, y2, col2, col3);

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

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

License:LGPL

public void drawBoundingBox(EntityPlayer par1EntityPlayer, AxisAlignedBB bb, float par4) {
    GL11.glEnable(GL11.GL_BLEND);//w  w w  . j a v a 2s  . c  om
    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);
    float var5 = 0.002F;
    double var7 = par1EntityPlayer.lastTickPosX
            + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4;
    double var9 = par1EntityPlayer.lastTickPosY
            + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4;
    double var11 = par1EntityPlayer.lastTickPosZ
            + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4;
    drawOutlinedBoundingBox(
            bb.expand((double) var5, (double) var5, (double) var5).getOffsetBoundingBox(-var7, -var9, -var11));

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

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

License:LGPL

public void drawLine(EntityPlayer par1EntityPlayer, Vec3 start, Vec3 end, float par4) {
    GL11.glEnable(GL11.GL_BLEND);//  www. jav a  2s  .  c  om
    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);
    float var5 = 0.002F;
    double var7 = par1EntityPlayer.lastTickPosX
            + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4;
    double var9 = par1EntityPlayer.lastTickPosY
            + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4;
    double var11 = par1EntityPlayer.lastTickPosZ
            + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4;

    Tessellator var2 = Tessellator.instance;
    var2.startDrawing(GL11.GL_LINE_STRIP);
    var2.addVertex(start.xCoord, start.yCoord, start.zCoord);
    var2.addVertex(end.xCoord, end.yCoord, end.zCoord);
    var2.draw();

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

From source file:com.opengrave.og.engine.Node.java

License:Open Source License

public void renderSemiTransparent(Matrix4f matrix) {
    Util.checkErr();/*from w w  w . j ava  2 s . c om*/
    doRenderSemiTransparent(matrix);
    if (MainThread.main.input.getLastHovered() != null) {
        Pickable lr = MainThread.main.input.getLastHovered().getRenderable();
        if (this instanceof BaseObject && lr instanceof BaseObject) {
            if (lr == this) {
                BaseObject notThis = (BaseObject) this;
                if (notThis.drawOutline) {
                    // Setup for outline draw
                    GL11.glDepthFunc(GL11.GL_LESS);
                    GL11.glEnable(GL11.GL_DEPTH_TEST);
                    GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_LINE);
                    GL11.glLineWidth(10f);
                    GL11.glCullFace(GL11.GL_FRONT);
                    GL11.glEnable(GL11.GL_CULL_FACE);

                    GL11.glEnable(GL11.GL_BLEND);
                    GL11.glEnable(GL11.GL_LINE_SMOOTH);
                    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

                    // Draw

                    RenderStyle rs = notThis.getRenderStyle();
                    notThis.setRenderStyle(RenderStyle.HALO);

                    doRender(matrix);

                    notThis.setRenderStyle(rs);

                    // Return to correct state
                    GL11.glPolygonMode(GL11.GL_BACK, GL11.GL_FILL);
                    GL11.glLineWidth(1f);
                    GL11.glCullFace(GL11.GL_BACK);
                    GL11.glDisable(GL11.GL_CULL_FACE);
                    GL11.glEnable(GL11.GL_BLEND);
                }
            }
        }
    }
    Util.checkErr();
    for (Node node : children) {
        Matrix4f childMatrix = matrix.mult(node.getMatrix(), null);
        node.renderSemiTransparent(childMatrix);
        Util.checkErr();
    }
}