List of usage examples for org.lwjgl.opengl GL11 glBegin
public static native void glBegin(@NativeType("GLenum") int mode);
From source file:com.bluepowermod.part.lamp.PartFixture.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)//from ww w.j a va2 s.c o m public void renderGlow(int pass) { Vec3dCube vector = new Vec3dCube(3 / 16D, 2 / 16D, 3 / 16D, 1.0 - (3 / 16D), 8 / 16D, 13 / 16D) .rotate(getFace(), Vec3d.center); double r = ((color.getHex() & 0xFF0000) >> 16) / 256D; double g = ((color.getHex() & 0x00FF00) >> 8) / 256D; double b = (color.getHex() & 0x0000FF) / 256D; if (pass == 1) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBegin(GL11.GL_QUADS); com.bluepowermod.client.render.RenderHelper.drawColoredCube(vector.clone().expand(0.5 / 16D), r, g, b, ((inverted ? 255 - (power & 0xFF) : (power & 0xFF)) / 255D) * 0.625); GL11.glEnd(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_BLEND); } }
From source file:com.bluepowermod.part.tube.TubeStack.java
License:Open Source License
@SideOnly(Side.CLIENT) public void render(float partialTick) { if (renderMode == RenderMode.AUTO) { renderMode = Minecraft.getMinecraft().gameSettings.fancyGraphics ? RenderMode.NORMAL : RenderMode.REDUCED;/* w w w.j a v a2 s .c o m*/ } final RenderMode finalRenderMode = renderMode; if (customRenderItem == null) { customRenderItem = new RenderItem() { @Override public boolean shouldBob() { return false; }; @Override public byte getMiniBlockCount(ItemStack stack, byte original) { return finalRenderMode == RenderMode.REDUCED ? (byte) 1 : original; } }; customRenderItem.setRenderManager(RenderManager.instance); renderedItem = new EntityItem(FMLClientHandler.instance().getWorldClient()); renderedItem.hoverStart = 0.0F; } renderedItem.setEntityItemStack(stack); double renderProgress = (oldProgress + (progress - oldProgress) * partialTick) * 2 - 1; GL11.glPushMatrix(); GL11.glTranslated(heading.offsetX * renderProgress * 0.5, heading.offsetY * renderProgress * 0.5, heading.offsetZ * renderProgress * 0.5); if (finalRenderMode != RenderMode.NONE) { GL11.glPushMatrix(); if (stack.stackSize > 5) { GL11.glScaled(0.8, 0.8, 0.8); } if (!(stack.getItem() instanceof ItemBlock)) { GL11.glScaled(0.8, 0.8, 0.8); GL11.glTranslated(0, -0.15, 0); } customRenderItem.doRender(renderedItem, 0, 0, 0, 0, 0); GL11.glPopMatrix(); } else { float size = 0.02F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBegin(GL11.GL_QUADS); RenderHelper.drawColoredCube(new Vec3dCube(-size, -size, -size, size, size, size), 1, 1, 1, 1); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } if (color != TubeColor.NONE) { float size = 0.2F; int colorInt = ItemDye.field_150922_c[color.ordinal()]; float red = (colorInt >> 16) / 256F; float green = (colorInt >> 8 & 255) / 256F; float blue = (colorInt & 255) / 256F; GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor3f(red, green, blue); Minecraft.getMinecraft().renderEngine .bindTexture(new ResourceLocation(Refs.MODID, "textures/blocks/tubes/inside_color_border.png")); RenderHelper.drawTesselatedTexturedCube(new Vec3dCube(-size, -size, -size, size, size, size)); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); } GL11.glPopMatrix(); }
From source file:com.breckinloggins.DrawUtils.java
License:Open Source License
public static void drawQuad(float x, float y, int size, float rotation) { int halfSize = size / 2; GL11.glPushMatrix();/* w w w.j a va2 s . c o m*/ { GL11.glTranslatef(x, y, 0); GL11.glRotatef(rotation, 0f, 0f, 1f); GL11.glTranslatef(-x, -y, 0); GL11.glBegin(GL11.GL_QUADS); { GL11.glVertex2f(x - halfSize, y - halfSize); GL11.glVertex2f(x + halfSize, y - halfSize); GL11.glVertex2f(x + halfSize, y + halfSize); GL11.glVertex2f(x - halfSize, y + halfSize); } GL11.glEnd(); } GL11.glPopMatrix(); }
From source file:com.breckinloggins.DrawUtils.java
License:Open Source License
public static void drawCircle(int x, int y, int radius) { GL11.glBegin(GL11.GL_LINE_LOOP); for (int angle = 0; angle <= 360; angle += 5) { double rad = Math.toRadians(angle); GL11.glVertex2d(x + Math.sin(rad) * radius, y + Math.cos(rad) * radius); }/*from ww w . j a v a2 s . c o m*/ GL11.glEnd(); }
From source file:com.damagedearth.Utilities.Components.TrueTypeFont.java
License:Open Source License
public void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX, float scaleY, int format) { IntObject intObject = null;//from www . ja v a2 s . co m int charCurrent; int totalwidth = 0; int i = startIndex, d, c; float startY = 0; switch (format) { case ALIGN_RIGHT: { d = -1; c = correctR; while (i < endIndex) { if (whatchars.charAt(i) == '\n') startY -= fontHeight; i++; } break; } case ALIGN_CENTER: { for (int l = startIndex; l <= endIndex; l++) { charCurrent = whatchars.charAt(l); if (charCurrent == '\n') break; if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { intObject = (IntObject) customChars.get(new Character((char) charCurrent)); } totalwidth += intObject.width - correctL; } totalwidth /= -2; } case ALIGN_LEFT: default: { d = 1; c = correctL; break; } } GL11.glEnable(GL11.GL_BLEND); // Enabled blending GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // selects blending method GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBegin(GL11.GL_QUADS); while (i >= startIndex && i <= endIndex) { charCurrent = whatchars.charAt(i); if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { intObject = (IntObject) customChars.get(new Character((char) charCurrent)); } if (intObject != null) { if (d < 0) totalwidth += (intObject.width - c) * d; if (charCurrent == '\n') { startY -= fontHeight * d; totalwidth = 0; if (format == ALIGN_CENTER) { for (int l = i + 1; l <= endIndex; l++) { charCurrent = whatchars.charAt(l); if (charCurrent == '\n') break; if (charCurrent < 256) { intObject = charArray[charCurrent]; } else { intObject = (IntObject) customChars.get(new Character((char) charCurrent)); } totalwidth += intObject.width - correctL; } totalwidth /= -2; } //if center get next lines total width/2; } else { drawQuad((totalwidth + intObject.width) * scaleX + x, startY * scaleY + y, totalwidth * scaleX + x, (startY + intObject.height) * scaleY + y, intObject.storedX + intObject.width, intObject.storedY + intObject.height, intObject.storedX, intObject.storedY); if (d > 0) totalwidth += (intObject.width - c) * d; } i += d; } } GL11.glEnd(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.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();/*www . j av a2 s . c o 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();/*from w w w .j a v a 2 s .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);/* ww w . j a 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);/*from w w w . j av a 2 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();// ww w . ja v a 2 s.co 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(); }