List of usage examples for org.lwjgl.opengl GL11 glColor4f
public static native void glColor4f(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green, @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha);
From source file:com.kodehawa.gui.api.render.ModGuiUtils.java
License:Open Source License
/** * Gradient rect with a border//from ww w. j a va2s .c om * * @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/* w ww. j a va2 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//from w w w . j av a 2 s . 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?// www . j a va2s.co m * * @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 www . j av 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 a2 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/*from w w w . j ava2 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//from w w w . j a va2 s. c om * * @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// ww w . j a va 2s . c om * * @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/* www . jav a 2 s . com*/ * * 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 */); }