List of usage examples for org.lwjgl.opengl GL11 glLineWidth
public static void glLineWidth(@NativeType("GLfloat") float width)
From source file:a1.Render2D.java
License:Open Source License
static public void Line(Coord c1, Coord c2, float w) { GL11.glLineWidth(w); GL11.glBegin(GL11.GL_LINES);//from w ww .j av a2 s. c o m GLColor(); Vertex(c1); Vertex(c2); GL11.glEnd(); CheckError(); }
From source file:adrianton.gloptat.plotter.Box.java
License:Open Source License
static void assemble() { handle = GL11.glGenLists(1);//from w ww .ja v a 2s. c om GL11.glNewList(handle, GL11.GL_COMPILE); GL11.glLineWidth(3); GL11.glColor3f(1f, 1f, 1f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(-1, -1, 1); GL11.glVertex3d(1, -1, 1); GL11.glVertex3d(1, -1, 1); GL11.glVertex3d(1, 1, 1); GL11.glVertex3d(1, 1, 1); GL11.glVertex3d(-1, 1, 1); GL11.glVertex3d(-1, 1, 1); GL11.glVertex3d(-1, -1, 1); GL11.glVertex3d(-1, -1, -1); GL11.glVertex3d(1, -1, -1); GL11.glVertex3d(1, -1, -1); GL11.glVertex3d(1, 1, -1); GL11.glVertex3d(1, 1, -1); GL11.glVertex3d(-1, 1, -1); GL11.glVertex3d(-1, 1, -1); GL11.glVertex3d(-1, -1, -1); GL11.glVertex3d(-1, -1, -1); GL11.glVertex3d(-1, -1, 1); GL11.glVertex3d(1, -1, -1); GL11.glVertex3d(1, -1, 1); GL11.glVertex3d(1, 1, -1); GL11.glVertex3d(1, 1, 1); GL11.glVertex3d(-1, 1, -1); GL11.glVertex3d(-1, 1, 1); GL11.glEnd(); GL11.glEndList(); }
From source file:allout58.mods.techtree.util.RenderingHelper.java
License:Open Source License
public static void draw2DLine(int x1, int y1, int x2, int y2, float width, int colorRGB) { float red = (float) (colorRGB >> 16 & 255) / 255.0F; float blue = (float) (colorRGB >> 8 & 255) / 255.0F; float green = (float) (colorRGB & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D);//from ww w . ja va2s .com GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(width); GL11.glPushMatrix(); GL11.glColor3f(red, green, blue); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3d(x1, y1, 0.0D); GL11.glVertex3d(x2, y2, 0.0D); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:arg.RenderRecipe.java
License:Open Source License
public void draw() { File dir = new File(Minecraft.getMinecraft().mcDataDir, "recipes"); if (!dir.exists() && !dir.mkdirs()) { throw new RuntimeException("The recipes directory could not be created: " + dir); }/*from w w w . j a v a 2 s. co m*/ name = name.replace(" ", ""); File file = new File(Minecraft.getMinecraft().mcDataDir, "recipes/" + name + ".png"); if (file.exists()) return; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushClientAttrib(GL11.GL_ALL_CLIENT_ATTRIB_BITS); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glViewport(0, 0, width, height); GL11.glOrtho(0.0D, xSize, ySize, 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); GL11.glLineWidth(1.0F); GL11.glEnable(GL11.GL_COLOR_MATERIAL); try { drawScreen(0, 0, 0); } catch (Exception e) { e.printStackTrace(); } int[] pixels = new int[width * height]; int bindex; ByteBuffer fb = ByteBuffer.allocateDirect(width * height * 3); GL11.glReadPixels(0, 0, width, height, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, fb); GL11.glPopMatrix(); GL11.glPopAttrib(); GL11.glPopClientAttrib(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); try { Display.swapBuffers(); } catch (LWJGLException e1) { e1.printStackTrace(); } BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int i = (x + (width * y)) * 3; int r = fb.get(i) & 0xFF; int g = fb.get(i + 1) & 0xFF; int b = fb.get(i + 2) & 0xFF; image.setRGB(x, height - (y + 1), (0xFF << 24) | (r << 16) | (g << 8) | b); } } try { ImageIO.write(image, "png", file); } catch (Exception e) { e.printStackTrace(); } }
From source file:blusunrize.immersiveengineering.client.render.TileRenderTeslaCoil.java
@Override public void render(TileEntityTeslaCoil tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if (tile.isDummy() || !tile.getWorld().isBlockLoaded(tile.getPos(), false)) return;/* w w w. j a v a 2s .com*/ Iterator<LightningAnimation> animationIt = TileEntityTeslaCoil.effectMap.get(tile.getPos()).iterator(); setLightmapDisabled(true); boolean wasLightingEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING); GlStateManager.disableLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); while (animationIt.hasNext()) { LightningAnimation animation = animationIt.next(); if (animation.shoudlRecalculateLightning()) animation.createLightning(Utils.RAND); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); double tx = tile.getPos().getX(); double ty = tile.getPos().getY(); double tz = tile.getPos().getZ(); float curWidth = GL11.glGetFloat(GL11.GL_LINE_WIDTH); drawAnimation(animation, tx, ty, tz, new float[] { 77 / 255f, 74 / 255f, 152 / 255f, .75f }, 4f); drawAnimation(animation, tx, ty, tz, new float[] { 1, 1, 1, 1 }, 1f); GL11.glLineWidth(curWidth); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } if (wasLightingEnabled) GlStateManager.enableLighting(); else GlStateManager.disableLighting(); setLightmapDisabled(false); }
From source file:blusunrize.immersiveengineering.client.render.TileRenderTeslaCoil.java
public static void drawAnimation(LightningAnimation animation, double tileX, double tileY, double tileZ, float[] rgba, float lineWidth) { GlStateManager.color(rgba[0], rgba[1], rgba[2], rgba[3]); GL11.glLineWidth(lineWidth); Tessellator tes = ClientUtils.tes(); BufferBuilder worldrenderer = tes.getBuffer(); worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); List<Vec3d> subs = animation.subPoints; worldrenderer.pos(animation.startPos.x - tileX, animation.startPos.y - tileY, animation.startPos.z - tileZ) .endVertex();//from w w w. j a v a 2s . c om for (int i = 0; i < subs.size(); i++) worldrenderer.pos(subs.get(i).x - tileX, subs.get(i).y - tileY, subs.get(i).z - tileZ).endVertex(); Vec3d end = (animation.targetEntity != null ? animation.targetEntity.getPositionVector() : animation.targetPos).add(-tileX, -tileY, -tileZ); worldrenderer.pos(end.x, end.y, end.z).endVertex(); tes.draw(); }
From source file:br.org.archimedes.gui.opengl.OpenGLWrapper.java
License:Open Source License
/** * @param width * The width for the line */ public void setLineWidth(double width) { GL11.glLineWidth((float) width); }
From source file:buildcraft.core.render.BlockHighlightHandler.java
License:Minecraft Mod Public
@SideOnly(Side.CLIENT) @SubscribeEvent/*from w w w.j av a2 s .c om*/ public void handleBlockHighlight(DrawBlockHighlightEvent e) { if (e.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { int x = e.target.blockX; int y = e.target.blockY; int z = e.target.blockZ; Block block = e.player.worldObj.getBlock(x, y, z); if (block instanceof ICustomHighlight) { AxisAlignedBB[] aabbs = ((ICustomHighlight) block).getBoxes(e.player.worldObj, x, y, z, e.player); Vec3 pos = e.player.getPosition(e.partialTicks); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); double exp = ((ICustomHighlight) block).getExpansion(); for (AxisAlignedBB aabb : aabbs) { RenderGlobal.drawOutlinedBoundingBox(aabb.copy().expand(exp, exp, exp).offset(x, y, z) .offset(-pos.xCoord, -pos.yCoord, -pos.zCoord), -1); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); e.setCanceled(true); } } }
From source file:chessMod.client.ChessModDrawBlockHighlightHandler.java
License:LGPL
public static void drawQuad(float x, float y, float width, float height, double zLevel) { GL11.glDisable(GL11.GL_LIGHTING);// w ww . ja va 2s . co m GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glLineWidth(5.0F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0F, 1F, 0F, pulseTransparency); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertex(x + 0F, y + height, zLevel); tessellator.addVertex(x + width, y + height, zLevel); tessellator.addVertex(x + width, y + 0F, zLevel); tessellator.addVertex(x + 0F, y + 0F, zLevel); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); }
From source file:cn.academy.misc.client.render.RenderMarker.java
License:Open Source License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { EntityMarker marker = (EntityMarker) ent; Entity targ = marker.target;/*from w w w . j a v a2 s . c om*/ double width = targ.width, height = targ.height; Tessellator t = Tessellator.instance; if (targ != null) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glPushMatrix(); GL11.glTranslated(x - width / 2, y, z - width / 2); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); for (int i = 0; i < 8; ++i) { GL11.glPushMatrix(); boolean rev = i < 4; double sx = width * mulArray[i][0], sy = height * mulArray[i][1], sz = width * mulArray[i][2]; final double len = 0.2 * width; GL11.glTranslated(sx, sy, sz); GL11.glRotated(rotArray[i], 0, 1, 0); GL11.glColor4d(marker.r, marker.g, marker.b, marker.a); GL11.glLineWidth(3f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawing(GL11.GL_LINES); t.setBrightness(15728880); t.addVertex(0, 0, 0); t.addVertex(0, rev ? len : -len, 0); t.addVertex(0, 0, 0); t.addVertex(len, 0, 0); t.addVertex(0, 0, 0); t.addVertex(0, 0, len); t.draw(); GL11.glPushMatrix(); GL11.glScaled(0.1, 0.1, 0.1); //ACModels.MDL_SOLAR.renderAll(); GL11.glPopMatrix(); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); } }