Example usage for org.lwjgl.opengl GL11 glEnd

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

Introduction

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

Prototype

public static native void glEnd();

Source Link

Document

Ends the definition of vertex attributes of a sequence of primitives to be transferred to the GL.

Usage

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

License:Open Source License

/**
 * Border of a quad/*w ww.  j a va 2s.  c o m*/
 * 
 * @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//  ww w .  ja va  2  s . c o 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 .ja  v  a 2  s.co 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//w ww  . j a v a2 s  .  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?/*w w  w  .  java  2  s . 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

/**
 * Border of a circle/*from ww  w. ja v  a  2 s . co  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/* ww  w. j a  v  a  2  s .  c om*/
 * 
 * @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//from   w  ww .j  a v  a  2  s .  com
 * 
 * @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.j  a va2s  .  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/*from  www .j a v  a 2  s.  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 */);
}