List of usage examples for org.lwjgl.opengl GL11 glVertex3d
public static native void glVertex3d(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:org.terasology.model.structures.AABB.java
License:Apache License
private void generateDisplayListSolid() { _displayListSolid = glGenLists(1);/*from www . java 2s . c o m*/ glNewList(_displayListSolid, GL11.GL_COMPILE); glBegin(GL_QUADS); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glVertex3d(-_dimensions.x, _dimensions.y, _dimensions.z); GL11.glVertex3d(_dimensions.x, _dimensions.y, _dimensions.z); GL11.glVertex3d(_dimensions.x, _dimensions.y, -_dimensions.z); GL11.glVertex3d(-_dimensions.x, _dimensions.y, -_dimensions.z); GL11.glVertex3d(-_dimensions.x, -_dimensions.y, -_dimensions.z); GL11.glVertex3d(-_dimensions.x, -_dimensions.y, _dimensions.z); GL11.glVertex3d(-_dimensions.x, _dimensions.y, _dimensions.z); GL11.glVertex3d(-_dimensions.x, _dimensions.y, -_dimensions.z); GL11.glVertex3d(-_dimensions.x, -_dimensions.y, _dimensions.z); GL11.glVertex3d(_dimensions.x, -_dimensions.y, _dimensions.z); GL11.glVertex3d(_dimensions.x, _dimensions.y, _dimensions.z); GL11.glVertex3d(-_dimensions.x, _dimensions.y, _dimensions.z); GL11.glVertex3d(_dimensions.x, _dimensions.y, -_dimensions.z); GL11.glVertex3d(_dimensions.x, _dimensions.y, _dimensions.z); GL11.glVertex3d(_dimensions.x, -_dimensions.y, _dimensions.z); GL11.glVertex3d(_dimensions.x, -_dimensions.y, -_dimensions.z); GL11.glVertex3d(-_dimensions.x, _dimensions.y, -_dimensions.z); GL11.glVertex3d(_dimensions.x, _dimensions.y, -_dimensions.z); GL11.glVertex3d(_dimensions.x, -_dimensions.y, -_dimensions.z); GL11.glVertex3d(-_dimensions.x, -_dimensions.y, -_dimensions.z); GL11.glVertex3d(-_dimensions.x, -_dimensions.y, -_dimensions.z); GL11.glVertex3d(_dimensions.x, -_dimensions.y, -_dimensions.z); GL11.glVertex3d(_dimensions.x, -_dimensions.y, _dimensions.z); GL11.glVertex3d(-_dimensions.x, -_dimensions.y, _dimensions.z); glEnd(); glEndList(); }
From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java
License:Open Source License
public static void renderTorpedoPath(VehicleBase vehicle, EntityPlayer player, float partialTick) { GL11.glPushMatrix();/*from w w w. java 2 s .c om*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4d(1, 1, 1, 0.6d); double x1 = vehicle.posX - player.posX; double y1 = vehicle.posY - player.posY; double z1 = vehicle.posZ - player.posZ; /** * vectors for a straight line */ double x2 = x1 - 20 * Trig.sinDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed()); double y2 = y1; double z2 = z1 - 20 * Trig.cosDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed()); GL11.glLineWidth(3f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(x1, y1 + 0.12d, z1); GL11.glVertex3d(x2, y2 + 0.12d, z2); GL11.glEnd(); GL11.glLineWidth(4f); GL11.glColor4f(1.f, 0.4f, 0.4f, 0.4f); GL11.glBegin(GL11.GL_LINES); Pos3f offset = vehicle.getMissileOffset(); x2 = x1 + offset.x; y2 = y1 + offset.y; z2 = z1 + offset.z; double gravity = 9.81d * 0.05d * 0.05d; double speed = vehicle.localLaunchPower * 0.05d; double angle = 90 - vehicle.localTurretPitch - vehicle.rotationPitch; double yaw = vehicle.localTurretRotation + partialTick * vehicle.moveHelper.getRotationSpeed(); double vH = -Trig.sinDegrees((float) angle) * speed; double vY = Trig.cosDegrees((float) angle) * speed; double vX = Trig.sinDegrees((float) yaw) * vH; double vZ = Trig.cosDegrees((float) yaw) * vH; int rocketBurnTime = (int) (speed * 20.f * AmmoHwachaRocket.burnTimeFactor); float xAcc = (float) (vX / speed) * AmmoHwachaRocket.accelerationFactor; ; float yAcc = (float) (vY / speed) * AmmoHwachaRocket.accelerationFactor; ; float zAcc = (float) (vZ / speed) * AmmoHwachaRocket.accelerationFactor; ; vX = xAcc; vY = yAcc; vZ = zAcc; float dist = 0; while (dist < 100 * 100) { GL11.glVertex3d(x2, y2, z2); x2 += vX; z2 += vZ; y2 += vY; dist += x2 * x2 + z2 * z2 + y2 * y2; GL11.glVertex3d(x2, y2, z2); } GL11.glEnd(); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java
License:Open Source License
public static void renderRocketFlightPath(VehicleBase vehicle, EntityPlayer player, float partialTick) { GL11.glPushMatrix();//from w w w.j av a 2 s . co m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4d(1, 1, 1, 0.6d); double x1 = vehicle.posX - player.posX; double y1 = vehicle.posY - player.posY; double z1 = vehicle.posZ - player.posZ; /** * vectors for a straight line */ double x2 = x1 - 20 * Trig.sinDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed()); double y2 = y1; double z2 = z1 - 20 * Trig.cosDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed()); GL11.glLineWidth(3f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(x1, y1 + 0.12d, z1); GL11.glVertex3d(x2, y2 + 0.12d, z2); GL11.glEnd(); GL11.glLineWidth(4f); GL11.glColor4f(1.f, 0.4f, 0.4f, 0.4f); GL11.glBegin(GL11.GL_LINES); Pos3f offset = vehicle.getMissileOffset(); x2 = x1 + offset.x; y2 = y1 + offset.y; z2 = z1 + offset.z; double gravity = 9.81d * 0.05d * 0.05d; double speed = vehicle.localLaunchPower * 0.05d; double angle = 90 - vehicle.localTurretPitch - vehicle.rotationPitch; double yaw = vehicle.localTurretRotation + partialTick * vehicle.moveHelper.getRotationSpeed(); double vH = -Trig.sinDegrees((float) angle) * speed; double vY = Trig.cosDegrees((float) angle) * speed; double vX = Trig.sinDegrees((float) yaw) * vH; double vZ = Trig.cosDegrees((float) yaw) * vH; int rocketBurnTime = (int) (speed * 20.f * AmmoHwachaRocket.burnTimeFactor); if (vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR1 || vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR2) { vY += vehicle.motionY; vX += vehicle.motionX; vZ += vehicle.motionZ; y1 = -player.posY; } float xAcc = (float) (vX / speed) * AmmoHwachaRocket.accelerationFactor; ; float yAcc = (float) (vY / speed) * AmmoHwachaRocket.accelerationFactor; ; float zAcc = (float) (vZ / speed) * AmmoHwachaRocket.accelerationFactor; ; vX = xAcc; vY = yAcc; vZ = zAcc; while (y2 >= y1) { GL11.glVertex3d(x2, y2, z2); x2 += vX; z2 += vZ; y2 += vY; if (rocketBurnTime > 0) { rocketBurnTime--; vX += xAcc; vY += yAcc; vZ += zAcc; } else { vY -= gravity; } GL11.glVertex3d(x2, y2, z2); } GL11.glEnd(); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java
License:Open Source License
public static void renderBatteringRamOverlay(VehicleBase vehicle, EntityPlayer player, float partialTick) { GL11.glPushMatrix();// ww w . j a va 2 s. c om GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glDisable(GL11.GL_DEPTH_TEST); //GL11.glDepthMask(false); GL11.glColor4d(1, 1, 1, 0.6d); double x1 = vehicle.posX - player.posX; double y1 = vehicle.posY - player.posY; double z1 = vehicle.posZ - player.posZ; /** * vectors for a straight line */ double x2 = x1 - 20 * Trig.sinDegrees(vehicle.rotationYaw); double y2 = y1; double z2 = z1 - 20 * Trig.cosDegrees(vehicle.rotationYaw); GL11.glLineWidth(3f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(x1, y1 + 0.12d, z1); GL11.glVertex3d(x2, y2 + 0.12d, z2); GL11.glEnd(); Pos3f offset = vehicle.getMissileOffset(); x2 = x1 + offset.x; y2 = y1 + offset.y; z2 = z1 + offset.z; float bx = (float) (vehicle.posX + offset.x); float by = (float) (vehicle.posY + offset.y); float bz = (float) (vehicle.posZ + offset.z); BlockPosition blockHit = new BlockPosition(bx, by, bz); AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(blockHit.x - 1, blockHit.y, blockHit.z, blockHit.x + 2, blockHit.y + 1, blockHit.z + 1); bb = AWRenderHelper.instance().adjustBBForPlayerPos(bb, player, partialTick); BoundingBoxRender.drawOutlinedBoundingBox(bb, 1.f, 0.2f, 0.2f); bb = resetBoundingBox(bb, blockHit.x, blockHit.y, blockHit.z - 1, blockHit.x + 1, blockHit.y + 1, blockHit.z + 2); bb = AWRenderHelper.instance().adjustBBForPlayerPos(bb, player, partialTick); BoundingBoxRender.drawOutlinedBoundingBox(bb, 1.f, 0.2f, 0.2f); bb = resetBoundingBox(bb, blockHit.x, blockHit.y - 1, blockHit.z, blockHit.x + 1, blockHit.y + 2, blockHit.z + 1); bb = AWRenderHelper.instance().adjustBBForPlayerPos(bb, player, partialTick); BoundingBoxRender.drawOutlinedBoundingBox(bb, 1.f, 0.2f, 0.2f); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:shadowmage.ancient_warfare.client.render.RenderOverlayAdvanced.java
License:Open Source License
public static void renderNormalVehicleOverlay(VehicleBase vehicle, EntityPlayer player, float partialTick) { GL11.glPushMatrix();//ww w . j a va2 s .c o m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); // GL11.glDisable(GL11.GL_LIGHTING); // GL11.glDisable(GL11.GL_DEPTH_TEST); //GL11.glDepthMask(false); GL11.glColor4d(1, 1, 1, 0.6d); double x1 = vehicle.posX - player.posX; double y1 = vehicle.posY - player.posY; double z1 = vehicle.posZ - player.posZ; /** * vectors for a straight line */ double x2 = x1 - 20 * Trig.sinDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed()); double y2 = y1; double z2 = z1 - 20 * Trig.cosDegrees(vehicle.rotationYaw + partialTick * vehicle.moveHelper.getRotationSpeed()); GL11.glLineWidth(3f); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(x1, y1 + 0.12d, z1); GL11.glVertex3d(x2, y2 + 0.12d, z2); GL11.glEnd(); GL11.glLineWidth(4f); GL11.glColor4f(1.f, 0.4f, 0.4f, 0.4f); GL11.glBegin(GL11.GL_LINES); Pos3f offset = vehicle.getMissileOffset(); x2 = x1 + offset.x; y2 = y1 + offset.y; z2 = z1 + offset.z; double gravity = 9.81d * 0.05d * 0.05d; double speed = vehicle.localLaunchPower * 0.05d; double angle = 90 - vehicle.localTurretPitch - vehicle.rotationPitch; ; double yaw = vehicle.localTurretRotation + partialTick * vehicle.moveHelper.getRotationSpeed(); double vH = -Trig.sinDegrees((float) angle) * speed; double vY = Trig.cosDegrees((float) angle) * speed; double vX = Trig.sinDegrees((float) yaw) * vH; double vZ = Trig.cosDegrees((float) yaw) * vH; if (vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR1 || vehicle.vehicleType.getMovementType() == VehicleMovementType.AIR2) { vY += vehicle.motionY; vX += vehicle.motionX; vZ += vehicle.motionZ; y1 = -player.posY; } while (y2 >= y1) { GL11.glVertex3d(x2, y2, z2); x2 += vX; z2 += vZ; y2 += vY; vY -= gravity; GL11.glVertex3d(x2, y2, z2); } GL11.glEnd(); GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:taiga.mcmods.buildguide.BlockMarker.java
private void createDisplayList() { //if neded create the list if (displaylist == -1) displaylist = GL11.glGenLists(1); GL11.glNewList(displaylist, GL11.GL_COMPILE_AND_EXECUTE); GL11.glDisable(GL11.GL_FOG);/*from www . ja va2 s .co m*/ GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_POINT_SMOOTH); GL11.glBegin(GL11.GL_POINTS); if (color != null) GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); for (Point3D pt : points) GL11.glVertex3d(pt.getX(), pt.getY(), pt.getZ()); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEndList(); regendisplist = false; }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glVertex3d(double a, double b, double c) { GL11.glVertex3d(a, b, c); }
From source file:tk.wurst_client.features.mods.TrajectoriesMod.java
License:Open Source License
@Override public void onRender() { EntityPlayerSP player = mc.player;/*from w ww . j a va2s .c o m*/ // check if player is holding item ItemStack stack = player.inventory.getCurrentItem(); if (stack == null) return; // check if item is throwable Item item = stack.getItem(); if (!(item instanceof ItemBow || item instanceof ItemSnowball || item instanceof ItemEgg || item instanceof ItemEnderPearl || item instanceof ItemSplashPotion || item instanceof ItemLingeringPotion || item instanceof ItemFishingRod)) return; boolean usingBow = player.inventory.getCurrentItem().getItem() instanceof ItemBow; // calculate starting position double arrowPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * mc.timer.renderPartialTicks - MathHelper.cos((float) Math.toRadians(player.rotationYaw)) * 0.16F; double arrowPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * Minecraft.getMinecraft().timer.renderPartialTicks + player.getEyeHeight() - 0.1; double arrowPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * Minecraft.getMinecraft().timer.renderPartialTicks - MathHelper.sin((float) Math.toRadians(player.rotationYaw)) * 0.16F; // calculate starting motion float arrowMotionFactor = usingBow ? 1F : 0.4F; float yaw = (float) Math.toRadians(player.rotationYaw); float pitch = (float) Math.toRadians(player.rotationPitch); float arrowMotionX = -MathHelper.sin(yaw) * MathHelper.cos(pitch) * arrowMotionFactor; float arrowMotionY = -MathHelper.sin(pitch) * arrowMotionFactor; float arrowMotionZ = MathHelper.cos(yaw) * MathHelper.cos(pitch) * arrowMotionFactor; double arrowMotion = Math .sqrt(arrowMotionX * arrowMotionX + arrowMotionY * arrowMotionY + arrowMotionZ * arrowMotionZ); arrowMotionX /= arrowMotion; arrowMotionY /= arrowMotion; arrowMotionZ /= arrowMotion; if (usingBow) { float bowPower = (72000 - player.getItemInUseCount()) / 20F; bowPower = (bowPower * bowPower + bowPower * 2F) / 3F; if (bowPower > 1F) bowPower = 1F; if (bowPower <= 0.1F) bowPower = 1F; bowPower *= 3F; arrowMotionX *= bowPower; arrowMotionY *= bowPower; arrowMotionZ *= bowPower; } else { arrowMotionX *= 1.5D; arrowMotionY *= 1.5D; arrowMotionZ *= 1.5D; } // GL settings GL11.glPushMatrix(); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glDisable(3553); GL11.glDisable(2929); GL11.glEnable(GL13.GL_MULTISAMPLE); GL11.glDepthMask(false); GL11.glLineWidth(1.8F); RenderManager renderManager = mc.getRenderManager(); // draw trajectory line double gravity = usingBow ? 0.05D : item instanceof ItemPotion ? 0.4D : item instanceof ItemFishingRod ? 0.15D : 0.03D; Vec3d playerVector = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ); GL11.glColor3d(0, 1, 0); GL11.glBegin(GL11.GL_LINE_STRIP); for (int i = 0; i < 1000; i++) { GL11.glVertex3d(arrowPosX - renderManager.renderPosX, arrowPosY - renderManager.renderPosY, arrowPosZ - renderManager.renderPosZ); arrowPosX += arrowMotionX * 0.1; arrowPosY += arrowMotionY * 0.1; arrowPosZ += arrowMotionZ * 0.1; arrowMotionX *= 0.999D; arrowMotionY *= 0.999D; arrowMotionZ *= 0.999D; arrowMotionY -= gravity * 0.1; if (mc.world.rayTraceBlocks(playerVector, new Vec3d(arrowPosX, arrowPosY, arrowPosZ)) != null) break; } GL11.glEnd(); // draw end of trajectory line double renderX = arrowPosX - renderManager.renderPosX; double renderY = arrowPosY - renderManager.renderPosY; double renderZ = arrowPosZ - renderManager.renderPosZ; AxisAlignedBB bb = new AxisAlignedBB(renderX - 0.5, renderY - 0.5, renderZ - 0.5, renderX + 0.5, renderY + 0.5, renderZ + 0.5); GL11.glColor4f(0F, 1F, 0F, 0.15F); RenderUtils.drawColorBox(bb, 0F, 1F, 0F, 0.15F); GL11.glColor4d(0, 0, 0, 0.5F); RenderUtils.drawSelectionBoundingBox(bb); // GL resets GL11.glDisable(3042); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDisable(GL13.GL_MULTISAMPLE); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glPopMatrix(); }
From source file:transcend.spare.TessCallback.java
public void vertex(Object vertexData) { VertexData vertex = (VertexData) vertexData; if (!textured) { if (vertex.data.length == 6) new Color((float) vertex.data[3], (float) vertex.data[4], (float) vertex.data[5]).bind(); if (vertex.data.length == 7) new Color((float) vertex.data[3], (float) vertex.data[4], (float) vertex.data[5], (float) vertex.data[6]).bind(); } else {//from w w w . j av a 2 s .com if (vertex.data.length == 6) GL11.glTexCoord3d((float) vertex.data[3], (float) vertex.data[4], (float) vertex.data[5]); else GL11.glTexCoord2d((float) vertex.data[3], (float) vertex.data[4]); } GL11.glVertex3d(vertex.data[0], vertex.data[1], vertex.data[2]); }
From source file:vengine.VGraphics.java
public void fillPolygon(VPoint... points) { GL11.glBegin(GL11.GL_POLYGON);/*from w w w .j a v a2s . c om*/ float angle = -2.35619449f; float mangle = (float) ((2 * Math.PI) / points.length); float tx[] = new float[] { 0, 0, 1, 1 }; float ty[] = new float[] { 0, 1, 1, 0 }; int i = 0; for (VPoint vp : points) { if (points.length == 4) { GL11.glTexCoord2d(tx[i], ty[i]); i++; } else { GL11.glTexCoord2d(0.5 + Math.cos(angle) * 0.6, 0.5 + Math.sin(angle) * 0.6); } angle -= mangle; GL11.glVertex3d(vp.x, vp.y, vp.z); } GL11.glEnd(); }