List of usage examples for org.lwjgl.opengl GL11 glPushMatrix
public static native void glPushMatrix();
From source file:com.CiD.MysteryMod.TecEvolution.Buildcraft.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double x, double y, double z) { if (entity.isDead) { return;//from w w w. j av a 2s. com } shadowSize = entity.shadowSize; RenderInfo util = new RenderInfo(); util.texture = entity.texture; bindTexture(TextureMap.locationBlocksTexture); for (int iBase = 0; iBase < entity.iSize; ++iBase) { for (int jBase = 0; jBase < entity.jSize; ++jBase) { for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = remainX > 1.0 ? 1.0 : remainX; util.maxY = remainY > 1.0 ? 1.0 : remainY; util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); renderBlock(util); GL11.glPopMatrix(); } } } }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
/** * Renders an ESP box with the size of a normal block at the specified * BlockPos.//from w w w. j a v a 2 s . com */ public static void blockEsp(BlockPos blockPos, Color c, double length, double length2) { 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.glPushMatrix(); 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.glColor4d(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 0.15); drawColorBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length), 0F, 0F, 0F, 0F); GL11.glColor4d(0, 0, 0, 0.5); drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x + length2, y + 1.0, z + length)); GL11.glLineWidth(2.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL_BLEND); GL11.glPopMatrix(); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawSphere(double x, double y, double z, float size, int slices, int stacks) { final Sphere s = new Sphere(); GL11.glPushMatrix(); GL11.glBlendFunc(770, 771);//from ww w . ja v a2s. c o m GL11.glEnable(GL_BLEND); GL11.glLineWidth(1.2F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL_DEPTH_TEST); GL11.glDepthMask(false); s.setDrawStyle(GLU.GLU_SILHOUETTE); GL11.glTranslated(x - RenderManager.renderPosX, y - RenderManager.renderPosY, z - RenderManager.renderPosZ); s.draw(size, slices, stacks); GL11.glLineWidth(2.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDisable(GL_BLEND); GL11.glPopMatrix(); }
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(); GL11.glEnable(GL11.GL_BLEND);//from w ww . jav a 2s . co 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.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(); GL11.glEnable(GL11.GL_BLEND);//www . j av 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.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);//from www. j av 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); }
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 a2 s . co 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(); 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);/* w ww .j ava 2s . co m*/ 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 drawESP(double d, double d1, double d2, double r, double b, double g) { GL11.glPushMatrix(); GL11.glEnable(3042);/*from ww w.j a v a 2 s . c o m*/ GL11.glBlendFunc(770, 771); GL11.glLineWidth(1.5F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glLineWidth(1.0F); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(2929); GL11.glDepthMask(false); GL11.glColor4d(r, g, b, 0.1825F); drawColorBox(new AxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0), 0F, 0F, 0F, 0F); GL11.glColor4d(0, 0, 0, 0.5); drawSelectionBoundingBox(new AxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0)); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); GL11.glPopMatrix(); }
From source file:com.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawChestESP(double d, double d1, double d2, double r, double b, double g, double length, double length2) { GL11.glPushMatrix(); GL11.glEnable(3042);/* w w w . j a v a 2 s.c om*/ GL11.glBlendFunc(770, 771); GL11.glLineWidth(1.5F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glLineWidth(1.0F); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(2929); GL11.glDepthMask(false); GL11.glColor4d(r, g, b, 0.15); drawColorBox(new AxisAlignedBB(d, d1, d2, d + length2, d1 + 1.0, d2 + length), 0F, 0F, 0F, 0F); GL11.glColor4d(0, 0, 0, 0.5); drawSelectionBoundingBox(new AxisAlignedBB(d, d1, d2, d + length2, d1 + 1.0, d2 + length)); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(2929); GL11.glDepthMask(true); GL11.glDisable(3042); GL11.glPopMatrix(); }