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

License:Open Source License

/**
 * Vertical line/* w  w  w .j a v  a2 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  ww w. j  av  a2s  .  c  o 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?/*from  ww  w.j  a v  a 2s . c  om*/
 * 
 * @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

/**
 * Quad drawn with Tessellator.java/*from  w  w  w .  j  a v  a  2s . c om*/
 * 
 * @param i
 * @param j
 * @param k
 * @param l
 * @param i1
 */
public static void dr(double i, double j, double k, double l, int i1) {
    if (i < k) {
        double j1 = i;
        i = k;
        k = j1;
    }
    if (j < l) {
        double k1 = j;
        j = l;
        l = k1;
    }
    float f = ((i1 >> 24) & 0xff) / 255F;
    float f1 = ((i1 >> 16) & 0xff) / 255F;
    float f2 = ((i1 >> 8) & 0xff) / 255F;
    float f3 = (i1 & 0xff) / 255F;
    Tessellator tessellator = Tessellator.instance;
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(f1, f2, f3, f);
    tessellator.startDrawingQuads();
    tessellator.addVertex(i, l, 0.0D);
    tessellator.addVertex(k, l, 0.0D);
    tessellator.addVertex(k, j, 0.0D);
    tessellator.addVertex(i, j, 0.0D);
    tessellator.draw();
    GL11.glEnable(3553);
    GL11.glDisable(3042);
}

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

License:Open Source License

/**
 * Border of a circle/*from  w  w w.j  a v  a  2  s  .  c o m*/
 * 
 * @param x
 * @param y
 * @param r
 * @param c
 */
public static void drawCircle(int x, int y, double r, int c) {
    float f = ((c >> 24) & 0xff) / 255F;
    float f1 = ((c >> 16) & 0xff) / 255F;
    float f2 = ((c >> 8) & 0xff) / 255F;
    float f3 = (c & 0xff) / 255F;
    GL11.glEnable(3042 /* GL_BLEND */);
    GL11.glDisable(3553 /* GL_TEXTURE_2D */);
    GL11.glEnable(2848 /* GL_LINE_SMOOTH */);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glBegin(2 /* GL_LINE_LOOP */);
    for (int i = 0; i <= 360; i++) {
        double x2 = Math.sin(((i * 3.141526D) / 180)) * r;
        double y2 = Math.cos(((i * 3.141526D) / 180)) * r;
        GL11.glVertex2d(x + x2, y + y2);
    }
    GL11.glEnd();
    GL11.glDisable(2848 /* GL_LINE_SMOOTH */);
    GL11.glEnable(3553 /* GL_TEXTURE_2D */);
    GL11.glDisable(3042 /* GL_BLEND */);
}

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

License:Open Source License

/**
 * Circle/*  w  w w .  j a v a  2 s  .c o m*/
 * 
 * @param x
 * @param y
 * @param r
 * @param c
 */
public static void drawFilledCircle(int x, int y, double r, int c) {
    float f = ((c >> 24) & 0xff) / 255F;
    float f1 = ((c >> 16) & 0xff) / 255F;
    float f2 = ((c >> 8) & 0xff) / 255F;
    float f3 = (c & 0xff) / 255F;
    GL11.glEnable(3042 /* GL_BLEND */);
    GL11.glDisable(3553 /* GL_TEXTURE_2D */);
    GL11.glEnable(2848 /* GL_LINE_SMOOTH */);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glBegin(6 /* GL_TRIANGLE_FAN */);
    for (int i = 0; i <= 360; i++) {
        double x2 = Math.sin(((i * 3.141526D) / 180)) * r;
        double y2 = Math.cos(((i * 3.141526D) / 180)) * r;
        GL11.glVertex2d(x + x2, y + y2);
    }
    GL11.glEnd();
    GL11.glDisable(2848 /* GL_LINE_SMOOTH */);
    GL11.glEnable(3553 /* GL_TEXTURE_2D */);
    GL11.glDisable(3042 /* GL_BLEND */);
}

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

License:Open Source License

/**
 * Triangle//w w w .j  av a  2  s . c o  m
 * 
 * @param cx
 * @param cy
 * @param c
 */
public static void drawTri(int cx, int cy, int c) {
    GL11.glRotatef(180, 0F, 0F, 1.0F);
    float f = ((c >> 24) & 0xff) / 255F;
    float f1 = ((c >> 16) & 0xff) / 255F;
    float f2 = ((c >> 8) & 0xff) / 255F;
    float f3 = (c & 0xff) / 255F;
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glBegin(GL11.GL_TRIANGLES);
    GL11.glRotatef(180, 0F, 0F, 1.0F);
    GL11.glVertex2d(cx, cy + 2);
    GL11.glVertex2d(cx + 2, cy - 2);
    GL11.glVertex2d(cx - 2, cy - 2);

    GL11.glEnd();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(3553);
    GL11.glDisable(3042);
    GL11.glRotatef(-180, 0F, 0F, 1.0F);
}

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

License:Open Source License

/**
 * Triangle. Used for radars//from   w  w  w.  ja  va 2 s  . co  m
 * 
 * @param e
 * @param cx
 * @param cy
 * @param c
 */
public static void drawTriangle(Entity e, double cx, double cy, int c) {
    GL11.glPushMatrix();
    GL11.glScaled(0.5, 0.5, 0.5);
    GL11.glTranslated(cx, cy, 0);
    if (e instanceof EntityClientPlayerMP) {
        GL11.glRotatef(e.rotationYaw, 0F, 0F, 1.0F);
    } else {
        GL11.glRotatef(-e.rotationYaw, 0F, 0F, 1.0F);
    }
    float f = ((c >> 24) & 0xff) / 255F;
    float f1 = ((c >> 16) & 0xff) / 255F;
    float f2 = ((c >> 8) & 0xff) / 255F;
    float f3 = (c & 0xff) / 255F;
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glBegin(GL11.GL_TRIANGLES);

    GL11.glVertex2d(0, 0 + 6);
    GL11.glVertex2d(0 + 3, 0 - 2);
    GL11.glVertex2d(0 - 3, 0 - 2);

    GL11.glEnd();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(3553);
    GL11.glDisable(3042);
    GL11.glRotatef(e.rotationYaw, 0F, 0F, 1.0F);

    GL11.glPopMatrix();
}

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

License:Open Source License

/**
 * Half Circle//  ww  w  . ja v a2s .c  om
 * 
 * Modes: 0 Left to right, bottom to top 1 Top to bottom, left to right 2
 * Right to left, top to bottom 3 Bottom to top, right to left
 * 
 * @param x
 * @param y
 * @param r
 * @param c
 */
public static void drawFilledHalfCircle(int x, int y, double r, int c, int mode) {
    float f = ((c >> 24) & 0xff) / 255F;
    float f1 = ((c >> 16) & 0xff) / 255F;
    float f2 = ((c >> 8) & 0xff) / 255F;
    float f3 = (c & 0xff) / 255F;
    GL11.glDisable(3553 /* GL_TEXTURE_2D */);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(770, 771);

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    GL11.glEnable(GL11.GL_POINT_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);

    GL11.glColor4f(f1, f2, f3, f);
    GL11.glBegin(6 /* GL_TRIANGLE_FAN */);

    int startang = 0;
    int endang = 0;

    if (mode == 0) {
        startang = 90;
        endang = 270;
    }
    if (mode == 1) {
        startang = 360;
        endang = 540;
    }
    if (mode == 2) {
        startang = 270;
        endang = 450;
    }
    if (mode == 3) {
        startang = 180;
        endang = 360;
    }

    for (int i = startang; i <= endang; i++) {
        double x2 = Math.sin(((i * 3.141526D) / 180)) * r;
        double y2 = Math.cos(((i * 3.141526D) / 180)) * r;
        GL11.glVertex2d(x + x2, y + y2);
    }
    GL11.glEnd();
    GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
    GL11.glDisable(GL11.GL_POINT_SMOOTH);
    GL11.glDisable(2848 /* GL_LINE_SMOOTH */);
    GL11.glEnable(3553 /* GL_TEXTURE_2D */);
    GL11.glDisable(3042 /* GL_BLEND */);
}

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

License:Open Source License

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

    float f4 = ((col2 >> 24) & 0xFF) / 255F;
    float f5 = ((col2 >> 16) & 0xFF) / 255F;
    float f6 = ((col2 >> 8) & 0xFF) / 255F;
    float f7 = (col2 & 0xFF) / 255F;

    GL11.glEnable(GL11.GL_BLEND);/*from  w ww  . ja v a  2s  .c o m*/
    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.glShadeModel(GL11.GL_SMOOTH);

    GL11.glPushMatrix();
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glVertex2d(x2, y);
    GL11.glVertex2d(x, y);

    GL11.glColor4f(f5, f6, f7, f4);
    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);
    GL11.glShadeModel(GL11.GL_FLAT);
}