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.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
/** * Renders a box with any size and any color. * * @param x/* w w w. ja va 2 s . c o m*/ * @param y * @param z * @param x2 * @param y2 * @param z2 * @param color */ public static void box(double x, double y, double z, double x2, double y2, double z2, float red, float green, float blue, float alpha) { x = x - Minecraft.getMinecraft().getRenderManager().renderPosX; y = y - Minecraft.getMinecraft().getRenderManager().renderPosY; z = z - Minecraft.getMinecraft().getRenderManager().renderPosZ; x2 = x2 - Minecraft.getMinecraft().getRenderManager().renderPosX; y2 = y2 - Minecraft.getMinecraft().getRenderManager().renderPosY; z2 = z2 - Minecraft.getMinecraft().getRenderManager().renderPosZ; GL11.glBlendFunc(770, 771); GL11.glEnable(GL_BLEND); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glDepthMask(false); GL11.glColor4f(red, green, blue, alpha); drawColorBox(new AxisAlignedBB(x, y, z, x2, y2, z2), red, green, blue, alpha); GL11.glColor4d(0, 0, 0, 0.5F); drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2)); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL_BLEND); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void entityESPBox(Entity entity, Color c) { GL11.glBlendFunc(770, 771);/*from w w w .ja va 2s .c o m*/ GL11.glEnable(GL_BLEND); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glColor4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, c.getAlpha() / 255f); RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); drawSelectionBoundingBox(new AxisAlignedBB( entity.boundingBox.minX - 0.05 - entity.posX + (entity.posX - renderManager.renderPosX), entity.boundingBox.minY - entity.posY + (entity.posY - renderManager.renderPosY), entity.boundingBox.minZ - 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ), entity.boundingBox.maxX + 0.05 - entity.posX + (entity.posX - renderManager.renderPosX), entity.boundingBox.maxY + 0.1 - entity.posY + (entity.posY - renderManager.renderPosY), entity.boundingBox.maxZ + 0.05 - entity.posZ + (entity.posZ - renderManager.renderPosZ))); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL_BLEND); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void nukerBox(BlockPos blockPos, float damage) { double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX; double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY; double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ; GL11.glBlendFunc(770, 771);/*from w ww. ja v a 2 s . c o m*/ GL11.glEnable(GL_BLEND); GL11.glLineWidth(1.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glColor4f(damage, 1 - damage, 0, 0.15F); drawColorBox( new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2, z + 0.5 - damage / 2, x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2), damage, 1 - damage, 0, 0.15F); GL11.glColor4d(0, 0, 0, 0.5F); drawSelectionBoundingBox(new AxisAlignedBB(x + 0.5 - damage / 2, y + 0.5 - damage / 2, z + 0.5 - damage / 2, x + 0.5 + damage / 2, y + 0.5 + damage / 2, z + 0.5 + damage / 2)); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL_BLEND); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void searchBox(BlockPos blockPos) { double x = blockPos.getX() - Minecraft.getMinecraft().getRenderManager().renderPosX; double y = blockPos.getY() - Minecraft.getMinecraft().getRenderManager().renderPosY; double z = blockPos.getZ() - Minecraft.getMinecraft().getRenderManager().renderPosZ; GL11.glBlendFunc(770, 771);/*from ww w . j a v a2 s. c o m*/ GL11.glEnable(GL_BLEND); GL11.glLineWidth(1.0F); float sinus = 1F - MathHelper .abs(MathHelper.sin(Minecraft.getSystemTime() % 10000L / 10000.0F * (float) Math.PI * 4.0F) * 1F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glColor4f(1F - sinus, sinus, 0F, 0.15F); drawColorBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0), 1F - sinus, sinus, 0F, 0.15F); GL11.glColor4d(0, 0, 0, 0.5); drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + 1.0, y + 1.0, z + 1.0)); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL_BLEND); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2) { drawRect((float) x, (float) y, (float) x2, (float) y2, col2); float f = (float) (col1 >> 24 & 0xFF) / 255F; float f1 = (float) (col1 >> 16 & 0xFF) / 255F; float f2 = (float) (col1 >> 8 & 0xFF) / 255F; float f3 = (float) (col1 & 0xFF) / 255F; GL11.glPushMatrix();/*from w ww . j a va 2s .co m*/ 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.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.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glPopMatrix(); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, int paramColor) { float alpha = (float) (paramColor >> 24 & 0xFF) / 255F; float red = (float) (paramColor >> 16 & 0xFF) / 255F; float green = (float) (paramColor >> 8 & 0xFF) / 255F; float blue = (float) (paramColor & 0xFF) / 255F; GL11.glPushMatrix();// w w w.j a v a 2s. co m 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.glColor4f(red, green, blue, alpha); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2d(paramXEnd, paramYStart); GL11.glVertex2d(paramXStart, paramYStart); GL11.glVertex2d(paramXStart, paramYEnd); GL11.glVertex2d(paramXEnd, paramYEnd); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glPopMatrix(); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) { float f = (float) (col1 >> 24 & 0xFF) / 255F; float f1 = (float) (col1 >> 16 & 0xFF) / 255F; float f2 = (float) (col1 >> 8 & 0xFF) / 255F; float f3 = (float) (col1 & 0xFF) / 255F; float f4 = (float) (col2 >> 24 & 0xFF) / 255F; float f5 = (float) (col2 >> 16 & 0xFF) / 255F; float f6 = (float) (col2 >> 8 & 0xFF) / 255F; float f7 = (float) (col2 & 0xFF) / 255F; GL11.glEnable(GL11.GL_BLEND);/* w ww. ja v a 2 s . 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); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawGradientBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2, int col3) { float f = (float) (col1 >> 24 & 0xFF) / 255F; float f1 = (float) (col1 >> 16 & 0xFF) / 255F; float f2 = (float) (col1 >> 8 & 0xFF) / 255F; float f3 = (float) (col1 & 0xFF) / 255F; GL11.glDisable(GL11.GL_TEXTURE_2D);/* w ww . ja v a 2s . 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.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawStrip(int x, int y, float width, double angle, float points, float radius, int color) { GL11.glPushMatrix();/* w w w .j av a 2s . c o m*/ float f1 = (float) (color >> 24 & 255) / 255.0F; float f2 = (float) (color >> 16 & 255) / 255.0F; float f3 = (float) (color >> 8 & 255) / 255.0F; float f4 = (float) (color & 255) / 255.0F; GL11.glTranslatef(x, y, 0); GL11.glColor4f(f2, f3, f4, f1); GL11.glLineWidth(width); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL13.GL_MULTISAMPLE); if (angle > 0) { GL11.glBegin(GL11.GL_LINE_STRIP); for (int i = 0; i < angle; i++) { float a = (float) (i * (angle * Math.PI / points)); float xc = (float) (Math.cos(a) * radius); float yc = (float) (Math.sin(a) * radius); GL11.glVertex2f(xc, yc); } GL11.glEnd(); } if (angle < 0) { GL11.glBegin(GL11.GL_LINE_STRIP); for (int i = 0; i > angle; i--) { float a = (float) (i * (angle * Math.PI / points)); float xc = (float) (Math.cos(a) * -radius); float yc = (float) (Math.sin(a) * -radius); GL11.glVertex2f(xc, yc); } GL11.glEnd(); } GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL13.GL_MULTISAMPLE); GL11.glDisable(GL11.GL_MAP1_VERTEX_3); GL11.glPopMatrix(); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawCircle(float cx, float cy, float r, int num_segments, int c) { GL11.glScalef(0.5F, 0.5F, 0.5F);// ww w . j a v a 2 s. c o m r *= 2; cx *= 2; cy *= 2; float f = (float) (c >> 24 & 0xff) / 255F; float f1 = (float) (c >> 16 & 0xff) / 255F; float f2 = (float) (c >> 8 & 0xff) / 255F; float f3 = (float) (c & 0xff) / 255F; float theta = (float) (2 * 3.1415926 / (num_segments)); float p = (float) Math.cos(theta);//calculate the sine and cosine float s = (float) Math.sin(theta); float t; GL11.glColor4f(f1, f2, f3, f); float x = r; float y = 0;//start at angle = 0 GL11.glEnable(3042); GL11.glDisable(3553); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glBlendFunc(770, 771); GL11.glBegin(GL11.GL_LINE_LOOP); for (int ii = 0; ii < num_segments; ii++) { GL11.glVertex2f(x + cx, y + cy);//final vertex vertex //rotate the stuff t = x; x = p * x - s * y; y = s * t + p * y; } GL11.glEnd(); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glScalef(2F, 2F, 2F); }