Java Code Examples for org.lwjgl.opengl.GL11#glBlendFunc()

The following examples show how to use org.lwjgl.opengl.GL11#glBlendFunc() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public static void startDrawingESPs(double d, double d1, double d2, double r, double g, double b2) {

        GL11.glPushMatrix();
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
        GL11.glLineWidth(1.5f);
        GL11.glDisable(2896);
        GL11.glDisable(3553);
        GL11.glEnable(2848);
        GL11.glDisable(2929);
        GL11.glDepthMask(false);
        GL11.glColor4d(r, g, b2, 0.1850000023841858);
        GLUtils.drawBoundingBox(new AltAxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0));
        GL11.glColor4d(r, g, b2, 1.0);
        GLUtils.drawOutlinedBoundingBox(new AltAxisAlignedBB(d, d1, d2, d + 1.0, d1 + 1.0, d2 + 1.0));
        GL11.glLineWidth(2.0f);
        GL11.glDisable(2848);
        GL11.glEnable(3553);
        GL11.glEnable(2896);
        GL11.glEnable(2929);
        GL11.glDepthMask(true);
        GL11.glDisable(3042);
        GL11.glPopMatrix();
    }
 
Example 2
Source File: PBufferGraphics.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Initialise the GL context
 */
protected void initGL() {
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glShadeModel(GL11.GL_SMOOTH);        
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);                    
       
	GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                
       GL11.glClearDepth(1);                                       
       
       GL11.glEnable(GL11.GL_BLEND);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
       
       GL11.glViewport(0,0,screenWidth,screenHeight);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glLoadIdentity();
	
	enterOrtho();
}
 
Example 3
Source File: GuilScrolledBox.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void render()
{
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.optionsBackground);
    x0 = -gui.screenX;
    x1 = -gui.screenX + gui.width;

    overlayBackground(y, h, 0x202020, 0xff, 0xff);

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0f, offset, 0.0f);
    super.render();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    overlayBackground(y, y + 8, 0x000000, 0xff, 0x00);
    overlayBackground(h - 8, h, 0x000000, 0x00, 0xff);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);

    Minecraft.getMinecraft().getTextureManager().bindTexture(Gui.optionsBackground);
    overlayBackground(-gui.screenY, y, 0x404040, 0xff, 0xff);
    overlayBackground(h, -gui.screenY + gui.height, 0x404040, 0xff, 0xff);
}
 
Example 4
Source File: Tracers.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onWorldRender(RenderWorldLastEvent event) {
    try {
        GL11.glBlendFunc(770, 771);
        GL11.glEnable(3042);
        GL11.glLineWidth(2.0f);
        GL11.glDisable(3553);
        GL11.glDisable(2929);
        GL11.glDepthMask(false);
        Wrapper.INSTANCE.world().loadedEntityList.stream().filter((entities) -> !(entities == Wrapper.INSTANCE.player() || !(entities instanceof EntityPlayer) || (entities instanceof EntityFakePlayer) || ((Entity) entities).isDead || ((EntityPlayer) entities).isInvisible())).map((entities) -> (EntityPlayer) entities).map((entity1) -> {
            Entity entity = (Entity) entity1;
            float distance = Wrapper.INSTANCE.mc().renderViewEntity.getDistanceToEntity(entity);
            double posX = entity.posX - RenderManager.renderPosX;
            double posY = entity.posY + (entity.height / 2.0f) - RenderManager.renderPosY;
            double posZ = entity.posZ - RenderManager.renderPosZ;
            String playerName = Wrapper.INSTANCE.player().getGameProfile().getName();
            if (distance <= 6.0f) {
                GL11.glColor3f(1.0f, 0.0f, 0.0f);
            } else if (distance <= 96.0f) {
                GL11.glColor3f(1.0f, (distance / 100.0f), 0.0f);
            } else if (distance > 96.0f) {
                GL11.glColor3f(0.1f, 0.6f, 255.0f);
            }
            GL11.glBegin(1);
            GL11.glVertex3d(0.0, 0.0, 0.0);
            GL11.glVertex3d(posX, posY, posZ);
            return entity;
        }).forEachOrdered((_item) -> {
            GL11.glEnd();
        });
        GL11.glEnable(3553);
        GL11.glEnable(2929);
        GL11.glDepthMask(true);
        GL11.glDisable(3042);
    } catch (Exception exception) {
        // empty catch block
    }
}
 
Example 5
Source File: RenderRangeLines.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public void render(){
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderUtils.glColorHex(color);
    GL11.glLineWidth(1.0F);
    for(RenderProgressingLine line : rangeLines) {
        line.render();
    }
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
Example 6
Source File: MoCModelFly.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
    super.render(entity, f, f1, f2, f3, f4, f5);
    MoCEntityFly fly = (MoCEntityFly) entity;
    boolean isFlying = (fly.getIsFlying() || fly.isOnAir());
    //boolean onGround = fly.onGround;
    setRotationAngles(f, f1, f2, f3, f4, f5, !isFlying);

    FrontLegs.render(f5);
    RearLegs.render(f5);
    MidLegs.render(f5);
    Head.render(f5);
    Tail.render(f5);
    Abdomen.render(f5);
    Thorax.render(f5);

    if (!isFlying)
    {
        FoldedWings.render(f5);
    }
    else
    {
        GL11.glPushMatrix();
        GL11.glEnable(3042 /*GL_BLEND*/);
        float transparency = 0.6F;
        GL11.glBlendFunc(770, 771);
        GL11.glColor4f(0.8F, 0.8F, 0.8F, transparency);
        LeftWing.render(f5);
        RightWing.render(f5);
        GL11.glDisable(3042/*GL_BLEND*/);
        GL11.glPopMatrix();
    }
}
 
Example 7
Source File: ModuleRegulatorTube.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void renderModule(){
    super.renderModule();
    if(isFake()) {
        if(!hasTicked) {
            TileEntityPneumaticBase tile = (TileEntityPneumaticBase)getTube();
            NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(tile.xCoord, tile.yCoord, tile.zCoord));
            TileEntity neighbor = tile.getWorldObj().getTileEntity(tile.xCoord + dir.offsetX, tile.yCoord + dir.offsetY, tile.zCoord + dir.offsetZ);
            inLine = neighbor instanceof IPneumaticMachine;
            if(inLine) {
                inverted = ((IPneumaticMachine)neighbor).getAirHandler().getPressure(dir) > tile.getPressure(ForgeDirection.UNKNOWN);
                NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(neighbor.xCoord, neighbor.yCoord, neighbor.zCoord));
            }
            hasTicked = true;
        }

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if(inLine && !inverted) {
            GL11.glColor4d(0, 1, 0, 0.3);
        } else {
            GL11.glColor4d(1, 0, 0, 0.3);
        }
        GL11.glPushMatrix();
        GL11.glTranslated(0, 1, 0.2 + ClientTickHandler.TICKS % 20 * 0.015);
        GL11.glRotated(90, 1, 0, 0);

        RenderUtils.render3DArrow();
        GL11.glColor4d(1, 1, 1, 1);
        GL11.glPopMatrix();
        GL11.glDisable(GL11.GL_BLEND);
    }
}
 
Example 8
Source File: RenderLaser.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public void doRender(Particle entity, double x, double y, double z,
		float f, float f1) {

	GL11.glPushMatrix();
	GL11.glTranslated(x, y, z);
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glDisable(GL11.GL_FOG);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDepthMask(false);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

	Minecraft.getMinecraft().renderEngine.bindTexture(flare);
	//bindTexture(flare);

	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

	GlStateManager.color(flareColor[0],flareColor[1],flareColor[2],flareColor[3]);

	for(int i = 0; i < 4; i++) {
		RenderHelper.renderBottomFaceWithUV(buffer, -y + 200, -(i*6) - x, -(i*6) - z, (i*6) - x, (i*6) - z, 0, 1, 0, 1);
	}

	Tessellator.getInstance().draw();

	GL11.glDisable(GL11.GL_TEXTURE_2D);
	OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, 0, 0);
	//GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);

	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
	GlStateManager.color(color[0], color[1], color[2], color[3]);//0.9F, 0.2F, 0.3F, 0.5F);

	for(float radius = 0.25F; radius < size; radius += .25F) {

		for(double i = 0; i < 2*Math.PI; i += Math.PI) {
			buffer.pos(- x , -y + 200,  - z).endVertex();
			buffer.pos(- x, -y + 200, - z).endVertex();
			buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,- (radius* Math.sin(i)) + 0.5F).endVertex();
			buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, (radius* Math.cos(i)) + 0.5F).endVertex();
		}

		for(double i = 0; i < 2*Math.PI; i += Math.PI) {
			buffer.pos(- x, -y + 200,- z).endVertex();
			buffer.pos(- x, -y + 200, - z).endVertex();
			buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, -(radius* Math.cos(i)) + 0.5F).endVertex();
			buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,(radius* Math.sin(i)) + 0.5F).endVertex();
		}
	}

	Tessellator.getInstance().draw();

	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_FOG);
	GL11.glDepthMask(true);
	GL11.glPopMatrix();
	
	GlStateManager.color(1f, 1f, 1f,1f);
	//Clean up and make player not transparent
	OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0);

}
 
Example 9
Source File: MoCRenderGolem.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
/**
 * A method used to render a creeper's powered form as a pass model.
 */
protected int renderGPassModel(MoCEntityGolem par1Entity, int par2, float par3)
{
    boolean depth = true;

    String effectTexture = par1Entity.getEffectTexture();
    if (effectTexture != null)//(!effectTexture.isEmpty())//(par1Entity.getPowered())
    {
        if (depth)
        {
            GL11.glDepthMask(false);
        }
        else
        {
            GL11.glDepthMask(true);
        }

        if (par2 == 1)
        {
            float var4 = (float) par1Entity.ticksExisted + par3;
            //this.loadTexture("/armor/golemeffect.png");
            this.loadTexture(effectTexture);
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            float var5 = var4 * 0.01F;
            float var6 = var4 * 0.01F;
            GL11.glTranslatef(var5, var6, 0.0F);
            this.setRenderPassModel(this.MoCModelG);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_BLEND);
            float var7 = 0.5F;
            GL11.glColor4f(var7, var7, var7, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            return 1;
        }

        if (par2 == 2)
        {
            GL11.glMatrixMode(GL11.GL_TEXTURE);
            GL11.glLoadIdentity();
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }

    return -1;
}
 
Example 10
Source File: RendererCrystallizer.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public void render(TileEntity tile, double x,
		double y, double z, float f,  int destroyStage, float a) {
	TileMultiblockMachine multiBlockTile = (TileMultiblockMachine)tile;

	if(!multiBlockTile.canRender())
		return;

	GL11.glPushMatrix();

	//Rotate and move the model into position
	GL11.glTranslated(x+.5f, y, z + 0.5f);
	EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); //tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord));
	GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0);
	GL11.glTranslated(-.5f, 0, -1.5f);

	if(multiBlockTile.isRunning()) {

		float progress = multiBlockTile.getProgress(0)/(float)multiBlockTile.getTotalProgress(0);

		bindTexture(texture);
		model.renderPart("Hull");

		List<ItemStack> outputList = multiBlockTile.getOutputs();
		if(outputList != null && !outputList.isEmpty()) {
			ItemStack stack = outputList.get(0);
			EntityItem entity = new EntityItem(tile.getWorld());

			entity.setItem(stack);
			entity.hoverStart = 0;

			int rotation = (int)(tile.getWorld().getTotalWorldTime() % 360);
			GL11.glPushMatrix();
			GL11.glTranslatef(0, 1, 0);

			GL11.glPushMatrix();
			GL11.glTranslated(1, 0.2, 0.7);
			GL11.glRotatef(rotation, 0, 1, 0);
			GL11.glScalef(progress, progress, progress);
			zmaster587.libVulpes.render.RenderHelper.renderItem(multiBlockTile, stack, Minecraft.getMinecraft().getRenderItem());
			GL11.glPopMatrix();

			GL11.glPushMatrix();
			GL11.glTranslated(1, 0.2, 1.5);
			GL11.glRotatef(rotation, 0, 1, 0);
			GL11.glScalef(progress, progress, progress);
			zmaster587.libVulpes.render.RenderHelper.renderItem(multiBlockTile, stack, Minecraft.getMinecraft().getRenderItem());
			GL11.glPopMatrix();

			GL11.glPushMatrix();
			GL11.glTranslated(1, 0.2, 2.3);
			GL11.glRotatef(rotation, 0, 1, 0);
			GL11.glScalef(progress, progress, progress);
			zmaster587.libVulpes.render.RenderHelper.renderItem(multiBlockTile, stack, Minecraft.getMinecraft().getRenderItem());
			GL11.glPopMatrix();

			GL11.glPopMatrix();



			GL11.glPushMatrix();
			GL11.glEnable(GL11.GL_BLEND);
			GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );

			int color = Minecraft.getMinecraft().getItemColors().getColorFromItemstack(stack, 0);

			float divisor = 1/255f;

			GL11.glColor4f((color & 0xFF)*divisor*.5f, ((color & 0xFF00) >>> 8)*divisor*.5f,  ((color & 0xFF0000) >>> 16)*divisor*.5f, 0xE4*divisor);
			GL11.glDisable(GL11.GL_TEXTURE_2D);
			GL11.glTranslatef(0, 1.1f, 0);

			//Fill before emptying
			if(progress < 0.05)
				GL11.glScaled(1, 20*progress, 1);
			else
				GL11.glScaled(1, (1.1-(progress*1.111)), 1);

			GL11.glTranslatef(0, -1.1f, 0);
			model.renderPart("Liquid");
		}
		
		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glDisable(GL11.GL_BLEND);
		GL11.glPopMatrix();

	}
	else {
		bindTexture(texture);
		model.renderPart("Hull");
	}
	GL11.glPopMatrix();
}
 
Example 11
Source File: RenderEntityVortex.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private void renderGust(){
    byte b0 = 0;
    //float f2 = 0.0F;
    //float f3 = 0.5F;
    //float f4 = (0 + b0 * 10) / 16.0F;
    // float f5 = (5 + b0 * 10) / 16.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (5 + b0 * 10) / 16.0F;
    float f9 = (10 + b0 * 10) / 16.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);

    double start = 0d;
    double end = 1 / 16d;
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, start, start);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, start, end);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, end, end);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, end, start);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9);
    tessellator.draw();

}
 
Example 12
Source File: RenderMovementBlocking.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderTick(RenderWorldLastEvent event) {

    World world = Minecraft.getMinecraft().theWorld;
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;
    MovingObjectPosition mop = world.rayTraceBlocks(RayTracer.instance().getStartVector(player).toVec3(), RayTracer.instance()
            .getEndVector(player).toVec3());
    ItemStack item = player.getCurrentEquippedItem();
    if (item == null)
        return;
    if (!(item.getItem() instanceof IFramezWrench))
        return;
    if (Minecraft.getMinecraft().gameSettings.hideGUI && Minecraft.getMinecraft().currentScreen == null)
        return;

    double thickness = 1 / 32D;

    GL11.glPushMatrix();
    {
        GL11.glDisable(GL11.GL_TEXTURE_2D);

        Vec3 playerPos = player.getPosition(event.partialTicks);

        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glColor4d(1, 1, 1, 1);

        List<TileMotor> l = null;

        if (mop != null && mop.typeOfHit == MovingObjectType.BLOCK) {
            TileEntity te = world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ);
            if (te != null && te instanceof TileMotor) {
                l = new ArrayList<TileMotor>();
                l.add((TileMotor) te);
            }
        }

        if (l == null)
            l = MotorCache.getLoadedMotors();

        for (TileMotor m : l) {
            if (m.getWorldObj() == world) {
                List<Vec3i> blocking = m.getBlocking();
                if (blocking == null || blocking.size() == 0)
                    continue;

                for (Vec3i b : blocking) {
                    double x = b.getX() - playerPos.xCoord;
                    double y = b.getY() - playerPos.yCoord;
                    double z = b.getZ() - playerPos.zCoord;

                    GL11.glPushMatrix();
                    {
                        GL11.glTranslated(x - thickness, y - thickness, z - thickness);
                        GL11.glScaled(1 + (thickness * 2), 1 + (thickness * 2), 1 + (thickness * 2));

                        GL11.glColor4d(1, 0, 0, .25);

                        GL11.glBegin(GL11.GL_QUADS);
                        RenderUtils.drawColoredCube();
                        GL11.glEnd();
                    }
                    GL11.glPopMatrix();

                    GL11.glPushMatrix();
                    {
                        GL11.glDisable(GL11.GL_DEPTH_TEST);
                        GL11.glColor4d(.75, 0, 0, .5);

                        GL11.glLineWidth(2);

                        GL11.glBegin(GL11.GL_LINES);
                        GL11.glVertex3d(m.xCoord - playerPos.xCoord + 0.5, m.yCoord - playerPos.yCoord + 0.5, m.zCoord
                                - playerPos.zCoord + 0.5);
                        GL11.glVertex3d(x + 0.5, y + 0.5, z + 0.5);
                        GL11.glEnd();
                        GL11.glEnable(GL11.GL_DEPTH_TEST);
                    }
                    GL11.glPopMatrix();
                }
            }
        }

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
    GL11.glPopMatrix();
}
 
Example 13
Source File: PathFinder.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
public void renderPath(boolean debugMode, boolean depthTest)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	if(!depthTest)
		GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glDepthMask(false);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	GL11.glTranslated(0.5, 0.5, 0.5);
	
	if(debugMode)
	{
		int renderedThings = 0;
		
		// queue (yellow)
		GL11.glLineWidth(2);
		GL11.glColor4f(1, 1, 0, 0.75F);
		for(PathPos element : queue.toArray())
		{
			if(renderedThings >= 5000)
				break;
			
			PathRenderer.renderNode(element);
			renderedThings++;
		}
		
		// processed (red)
		GL11.glLineWidth(2);
		for(Entry<PathPos, PathPos> entry : prevPosMap.entrySet())
		{
			if(renderedThings >= 5000)
				break;
			
			if(entry.getKey().isJumping())
				GL11.glColor4f(1, 0, 1, 0.75F);
			else
				GL11.glColor4f(1, 0, 0, 0.75F);
			
			PathRenderer.renderArrow(entry.getValue(), entry.getKey());
			renderedThings++;
		}
	}
	
	// path (blue)
	if(debugMode)
	{
		GL11.glLineWidth(4);
		GL11.glColor4f(0, 0, 1, 0.75F);
	}else
	{
		GL11.glLineWidth(2);
		GL11.glColor4f(0, 1, 0, 0.75F);
	}
	for(int i = 0; i < path.size() - 1; i++)
		PathRenderer.renderArrow(path.get(i), path.get(i + 1));
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glDepthMask(true);
}
 
Example 14
Source File: ChestEspHack.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	// minecart interpolation
	double partialTicks = event.getPartialTicks();
	ArrayList<AxisAlignedBB> minecartBoxes =
		new ArrayList<>(minecarts.size());
	minecarts.forEach(e -> {
		double offsetX = -(e.posX - e.lastTickPosX)
			+ (e.posX - e.lastTickPosX) * partialTicks;
		double offsetY = -(e.posY - e.lastTickPosY)
			+ (e.posY - e.lastTickPosY) * partialTicks;
		double offsetZ = -(e.posZ - e.lastTickPosZ)
			+ (e.posZ - e.lastTickPosZ) * partialTicks;
		minecartBoxes.add(
			e.getRenderBoundingBox().offset(offsetX, offsetY, offsetZ));
	});
	
	if(style.getSelected().boxes)
	{
		GL11.glCallList(normalChests);
		renderBoxes(minecartBoxes, greenBox);
	}
	
	if(style.getSelected().lines)
	{
		Vec3d start = RotationUtils.getClientLookVec()
			.addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0)
			.addVector(TileEntityRendererDispatcher.staticPlayerX,
				TileEntityRendererDispatcher.staticPlayerY,
				TileEntityRendererDispatcher.staticPlayerZ);
		
		GL11.glBegin(GL11.GL_LINES);
		
		GL11.glColor4f(0, 1, 0, 0.5F);
		renderLines(start, basicChests);
		renderLines(start, minecartBoxes);
		
		GL11.glColor4f(1, 0.5F, 0, 0.5F);
		renderLines(start, trappedChests);
		
		GL11.glColor4f(0, 1, 1, 0.5F);
		renderLines(start, enderChests);
		
		GL11.glEnd();
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 15
Source File: ItemRendererCertusTank.java    From ExtraCells1 with MIT License 4 votes vote down vote up
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/blocks/texmap_tank.png"));
	GL11.glPushMatrix();
	GL11.glTranslatef(0.5F, 0.5F, 0.5F);
	GL11.glScalef(1.0F, -1F, -1F);
	model.render(0.0625f);
	GL11.glScalef(1.0F, -1F, 1.0F);
	model.render(0.0625f);

	if (item != null && item.hasTagCompound())
	{
		FluidStack storedFluid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("tileEntity"));
		int tankCapacity = 32000;

		if (storedFluid != null && storedFluid.getFluid() != null)
		{
			Icon fluidIcon = storedFluid.getFluid().getIcon();

			Tessellator tessellator = Tessellator.instance;
			RenderBlocks renderer = new RenderBlocks();

			GL11.glScalef(1.0F, 1.0F, -1.0F);
			renderer.setRenderBounds(0.08F, 0.001F, 0.08F, 0.92, (float) storedFluid.amount / (float) tankCapacity * 0.999F, 0.92F);
			Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
			GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

			GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
			GL11.glEnable(GL11.GL_CULL_FACE);
			GL11.glDisable(GL11.GL_LIGHTING);
			GL11.glEnable(GL11.GL_BLEND);
			GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

			tessellator.startDrawingQuads();
			tessellator.setNormal(0.0F, -1F, 0.0F);
			renderer.renderFaceYNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon);
			tessellator.draw();
			tessellator.startDrawingQuads();
			tessellator.setNormal(0.0F, 1.0F, 0.0F);
			renderer.renderFaceYPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon);
			tessellator.draw();
			tessellator.startDrawingQuads();
			tessellator.setNormal(0.0F, 0.0F, -1F);
			renderer.renderFaceZNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon);
			tessellator.draw();
			tessellator.startDrawingQuads();
			tessellator.setNormal(0.0F, 0.0F, 1.0F);
			renderer.renderFaceZPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon);
			tessellator.draw();
			tessellator.startDrawingQuads();
			tessellator.setNormal(-1F, 0.0F, 0.0F);
			renderer.renderFaceXNeg(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon);
			tessellator.draw();
			tessellator.startDrawingQuads();
			tessellator.setNormal(1.0F, 0.0F, 0.0F);
			renderer.renderFaceXPos(Block.blocksList[FluidRegistry.WATER.getBlockID()], 0.0D, 0.0D, 0.0D, fluidIcon);
			tessellator.draw();

			GL11.glPopAttrib();
		}
	}

	GL11.glPopMatrix();
}
 
Example 16
Source File: MoCRenderDolphin.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
public void doRenderLiving2(EntityLiving entityliving, double d, double d1, double d2, float f, float f1)
{
    MoCEntityDolphin entitydolphin = (MoCEntityDolphin) entityliving;
    super.doRenderLiving(entitydolphin, d, d1, d2, f, f1);
    if (entitydolphin.renderName())
    {
        float f2 = 1.6F;
        float f3 = 0.01666667F * f2;
        float f4 = entityliving.getDistanceToEntity(renderManager.livingPlayer);
        String s = "";
        s = (new StringBuilder()).append(s).append(entitydolphin.getName()).toString();
        if ((f4 < 12F) && (s.length() > 0))
        {
            FontRenderer fontrenderer = getFontRendererFromRenderManager();
            GL11.glPushMatrix();
            GL11.glTranslatef((float) d + 0.0F, (float) d1 + 0.3F, (float) d2);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-f3, -f3, f3);
            GL11.glDisable(2896 /* GL_LIGHTING */);
            GL11.glDepthMask(false);
            GL11.glDisable(2929 /* GL_DEPTH_TEST */);
            GL11.glEnable(3042 /* GL_BLEND */);
            GL11.glBlendFunc(770, 771);
            Tessellator tessellator = Tessellator.instance;
            byte byte0 = -50;
            GL11.glDisable(3553 /* GL_TEXTURE_2D */);
            tessellator.startDrawingQuads();
            int i = fontrenderer.getStringWidth(s) / 2;
            tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
            tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
            tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
            tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
            tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
            if (MoCreatures.proxy.getDisplayPetHealth())
            {
                float f5 = entitydolphin.getHealth();
                float f6 = entitydolphin.getMaxHealth();
                float f7 = f5 / f6;
                float f8 = 40F * f7;
                tessellator.setColorRGBA_F(0.7F, 0.0F, 0.0F, 1.0F);
                tessellator.addVertex(-20F + f8, -10 + byte0, 0.0D);
                tessellator.addVertex(-20F + f8, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -6 + byte0, 0.0D);
                tessellator.addVertex(20D, -10 + byte0, 0.0D);
                tessellator.setColorRGBA_F(0.0F, 0.7F, 0.0F, 1.0F);
                tessellator.addVertex(-20D, -10 + byte0, 0.0D);
                tessellator.addVertex(-20D, -6 + byte0, 0.0D);
                tessellator.addVertex(f8 - 20F, -6 + byte0, 0.0D);
                tessellator.addVertex(f8 - 20F, -10 + byte0, 0.0D);
            }
            tessellator.draw();
            GL11.glEnable(3553 /* GL_TEXTURE_2D */);
            fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, 0x20ffffff);
            GL11.glEnable(2929 /* GL_DEPTH_TEST */);
            GL11.glDepthMask(true);
            fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, byte0, -1);
            GL11.glEnable(2896 /* GL_LIGHTING */);
            GL11.glDisable(3042 /* GL_BLEND */);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glPopMatrix();
        }
    }
}
 
Example 17
Source File: ImmediateModeOGLRenderer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @see org.newdawn.slick.opengl.renderer.SGL#glBlendFunc(int, int)
 */
public void glBlendFunc(int src, int dest) {
	GL11.glBlendFunc(src, dest);
}
 
Example 18
Source File: KillauraHack.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	if(target == null)
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	AxisAlignedBB box = new AxisAlignedBB(BlockPos.ORIGIN);
	float p = (target.getMaxHealth() - target.getHealth())
		/ target.getMaxHealth();
	float red = p * 2F;
	float green = 2 - red;
	
	GL11.glTranslated(target.posX, target.posY, target.posZ);
	GL11.glTranslated(0, 0.05, 0);
	GL11.glScaled(target.width, target.height, target.width);
	GL11.glTranslated(-0.5, 0, -0.5);
	
	if(p < 1)
	{
		GL11.glTranslated(0.5, 0.5, 0.5);
		GL11.glScaled(p, p, p);
		GL11.glTranslated(-0.5, -0.5, -0.5);
	}
	
	GL11.glColor4f(red, green, 0, 0.25F);
	GL11.glBegin(GL11.GL_QUADS);
	RenderUtils.drawSolidBox(box);
	GL11.glEnd();
	
	GL11.glColor4f(red, green, 0, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawOutlinedBox(box);
	GL11.glEnd();
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 19
Source File: ClientProxy.java    From NBTEdit with GNU General Public License v3.0 4 votes vote down vote up
private void drawBoundingBox(RenderGlobal r, float f, AxisAlignedBB aabb) {
	if (aabb == null)
		return;

	EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;

	double var8 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)f;
	double var10 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)f;
	double var12 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)f;

	aabb = aabb.getOffsetBoundingBox(-var8, -var10, -var12);

	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glColor4f(1.0F, 0.0F, 0.0F, .5F);
	GL11.glLineWidth(3.5F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDepthMask(false);

	Tessellator var2 = Tessellator.instance;

	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.draw();
	var2.startDrawing(3);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.draw();
	var2.startDrawing(1);
	var2.addVertex(aabb.minX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.minZ);
	var2.addVertex(aabb.maxX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.maxX, aabb.maxY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.minY, aabb.maxZ);
	var2.addVertex(aabb.minX, aabb.maxY, aabb.maxZ);
	var2.draw();

	GL11.glDepthMask(true);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);

}
 
Example 20
Source File: BowAimbotHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(target == null)
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// set position
	GL11.glTranslated(target.getX(), target.getY(), target.getZ());
	
	// set size
	double boxWidth = target.getWidth() + 0.1;
	double boxHeight = target.getHeight() + 0.1;
	GL11.glScaled(boxWidth, boxHeight, boxWidth);
	
	// move to center
	GL11.glTranslated(0, 0.5, 0);
	
	double v = 1 / velocity;
	GL11.glScaled(v, v, v);
	
	// draw outline
	GL11.glColor4d(1, 0, 0, 0.5F * velocity);
	RenderUtils.drawOutlinedBox(TARGET_BOX);
	
	// draw box
	GL11.glColor4d(1, 0, 0, 0.25F * velocity);
	RenderUtils.drawSolidBox(TARGET_BOX);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}