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

The following examples show how to use org.lwjgl.opengl.GL11#glDisable() . 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: BlockTexturedOreRenderer.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void renderInventoryBlock(Block blck, int meta, int modelID, RenderBlocks renderer) {
	if (blck == null || !(blck instanceof BlockTexturedOre))
		return;

	BlockTexturedOre block = (BlockTexturedOre) blck;

	if (block.icon != null) {
		renderer.overrideBlockTexture = block.icon;
		renderer.renderBlockAsItem(Blocks.stone, meta, 1.0f);
		renderer.overrideBlockTexture = null;
	} else if (block.base != null) {
		renderer.renderBlockAsItem(block.base, meta, 1.0f);
	}

	GL11.glEnable(3042);
	GL11.glBlendFunc(770, 771);
	renderer.setRenderBounds(bot, bot, bot, top, top, top);
	GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
	Drawing.drawBlock(block, meta, renderer);
	GL11.glDisable(3042);
}
 
Example 2
Source File: FeatureButton.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void drawName(MatrixStack matrixStack, int x1, int x3, int y1)
{
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	
	TextRenderer tr = MC.textRenderer;
	String name = feature.getName();
	int nameWidth = tr.getWidth(name);
	int tx = x1 + (x3 - x1 - nameWidth) / 2;
	int ty = y1 + 2;
	
	tr.draw(matrixStack, name, tx, ty, 0xF0F0F0);
	
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
}
 
Example 3
Source File: ItemEspHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderTracers(double partialTicks)
{
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glColor4f(1, 1, 0, 0.5F);
	
	Vec3d start =
		RotationUtils.getClientLookVec().add(RenderUtils.getCameraPos());
	
	GL11.glBegin(GL11.GL_LINES);
	for(ItemEntity e : items)
	{
		Vec3d end = e.getBoundingBox().getCenter()
			.subtract(new Vec3d(e.getX(), e.getY(), e.getZ())
				.subtract(e.prevX, e.prevY, e.prevZ)
				.multiply(1 - partialTicks));
		
		GL11.glVertex3d(start.x, start.y, start.z);
		GL11.glVertex3d(end.x, end.y, end.z);
	}
	GL11.glEnd();
}
 
Example 4
Source File: ArcanePackagerGui.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
protected void drawGuiContainerBackgroundLayer(float mouseX, int mouseZ, int par3) {
    this.mc.renderEngine.bindTexture(TEXTURE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_BLEND);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);

    drawString(100, 98, "gadomancy.info.ArcanePackager.useEssentia", tile.useEssentia ? Color.WHITE : Color.GRAY);

    drawString(100, 111, "gadomancy.info.ArcanePackager.autoStart", tile.autoStart ? Color.WHITE : Color.GRAY);

    drawString(100, 124, "gadomancy.info.ArcanePackager.disguisePackage", tile.disguise ? Color.WHITE : Color.GRAY);

    GL11.glDisable(GL11.GL_BLEND);
}
 
Example 5
Source File: RenderUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawBorderedRect(float x, float y, float x2, float y2, float l1, int col1, int col2) {
    drawRect(x, y, x2, y2, col2);
    float f = (col1 >> 24 & 0xFF) / 255.0F;
    float f2 = (col1 >> 16 & 0xFF) / 255.0F;
    float f3 = (col1 >> 8 & 0xFF) / 255.0F;
    float f4 = (col1 & 0xFF) / 255.0F;
    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.glPushMatrix();
    GlStateManager.color(f2, f3, f4, f);
    GL11.glLineWidth(l1);
    GL11.glBegin(1);
    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();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 6
Source File: SearchHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	// 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.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// generate rainbow color
	float x = System.currentTimeMillis() % 2000 / 1000F;
	float red = 0.5F + 0.5F * MathHelper.sin(x * (float)Math.PI);
	float green =
		0.5F + 0.5F * MathHelper.sin((x + 4F / 3F) * (float)Math.PI);
	float blue =
		0.5F + 0.5F * MathHelper.sin((x + 8F / 3F) * (float)Math.PI);
	
	GL11.glColor4f(red, green, blue, 0.5F);
	GL11.glBegin(GL11.GL_QUADS);
	GL11.glCallList(displayList);
	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 7
Source File: UnitGrid.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public final void debugRenderRegions(float landscape_x, float landscape_y) {
	int RADIUS = 30;
	int center_x = toGridCoordinate(landscape_x);
	int center_y = toGridCoordinate(landscape_y);
	int start_x = StrictMath.max(0, center_x - RADIUS);
	int end_x = StrictMath.min(occupants.length - 0, center_x + RADIUS);
	int start_y = StrictMath.max(0, center_y - RADIUS);
	int end_y = StrictMath.min(occupants.length - 0, center_y + RADIUS);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glPointSize(3f);
	GL11.glBegin(GL11.GL_POINTS);
	Region last_region = null;
	for (int y = start_y; y < end_y; y++)
		for (int x = start_x; x < end_x; x++) {
			float xf = coordinateFromGrid(x);
			float yf = coordinateFromGrid(y);
			Region region = getRegion(x, y);
			if (region == null) {
				GL11.glColor3f(1f, 0f, 0f);
			} else {
				last_region = region;
				DebugRender.setColor(region.hashCode());
			}
			GL11.glVertex3f(xf, yf, heightmap.getNearestHeight(xf, yf) + 2f);
		}
	GL11.glEnd();
	GL11.glBegin(GL11.GL_LINES);
	GL11.glColor3f(1f, 0f, 0f);
	if (last_region != null) {
		last_region.debugRenderConnections(heightmap);
		last_region.debugRenderConnectionsReset();
	}
	GL11.glEnd();
	GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
Example 8
Source File: Sprite.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
private final void resetBasic() {
	if (!culled) {
		GL11.glEnable(GL11.GL_CULL_FACE);
	}
	if (alpha) {
		GL11.glDisable(GL11.GL_ALPHA_TEST);
	}
}
 
Example 9
Source File: CurveRenderState.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Backup the current state of the relevant OpenGL state and change it to
 * what's needed to draw the curve.
 */
private RenderState saveRenderState() {
	RenderState state = new RenderState();
	state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH);
	state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND);
	state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
	state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
	state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
	state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE);
	state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
	state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
	GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glDepthMask(true);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_TEXTURE_1D);
	GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);

	GL20.glUseProgram(0);

	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
	GL11.glPushMatrix();
	GL11.glLoadIdentity();

	return state;
}
 
Example 10
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 11
Source File: RenderPressureTube.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void renderModelAt(TileEntityPressureTube tile, double d, double d1, double d2, float f){
    GL11.glPushMatrix(); // start
    // GL11.glDisable(GL11.GL_TEXTURE_2D);
    // GL11.glEnable(GL11.GL_BLEND);
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(tile.CRITICAL_PRESSURE == PneumaticValues.MAX_PRESSURE_PRESSURE_TUBE ? Textures.MODEL_PRESSURE_TUBE : Textures.MODEL_ADVANCED_PRESSURE_TUBE);

    // GL11.glColor4f(0.82F, 0.56F, 0.09F, 1.0F);
    GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); // size
    GL11.glRotatef(0, 0.0F, 1.0F, 0.0F);

    GL11.glScalef(1.0F, -1F, -1F);
    attachFakeModule(tile);
    boolean[] renderSides = Arrays.copyOf(tile.sidesConnected, tile.sidesConnected.length);
    for(int i = 0; i < 6; i++) {
        if(tile.modules[i] != null && tile.modules[i].isInline()) {
            renderSides[i] = true;
        }
    }
    model.renderModel(0.0625F, renderSides);
    // GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glPopMatrix(); // end

    for(int i = 0; i < tile.modules.length; i++) {
        TubeModule module = tile.modules[i];
        if(module != null) {
            if(module.isFake()) {
                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
                GL11.glColor4d(1, 1, 1, 0.3);
            }

            module.renderDynamic(d, d1, d2, f, 0, false);
            if(module.isFake()) {
                tile.modules[i] = null;
                GL11.glDisable(GL11.GL_BLEND);
                GL11.glColor4d(1, 1, 1, 1);
            }
        }
    }
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 12
Source File: ExcavatorHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRenderGUI(MatrixStack matrixStack, float partialTicks)
{
	// GL settings
	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_CULL_FACE);
	
	GL11.glPushMatrix();
	
	String message;
	if(step.selectPos && step.pos != null)
		message = "Press enter to confirm, or select a different position.";
	else
		message = step.message;
	
	TextRenderer tr = MC.textRenderer;
	
	// translate to center
	Window sr = MC.getWindow();
	int msgWidth = tr.getWidth(message);
	GL11.glTranslated(sr.getScaledWidth() / 2 - msgWidth / 2,
		sr.getScaledHeight() / 2 + 1, 0);
	
	// background
	GL11.glColor4f(0, 0, 0, 0.5F);
	GL11.glBegin(GL11.GL_QUADS);
	{
		GL11.glVertex2d(0, 0);
		GL11.glVertex2d(msgWidth + 2, 0);
		GL11.glVertex2d(msgWidth + 2, 10);
		GL11.glVertex2d(0, 10);
	}
	GL11.glEnd();
	
	// text
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	tr.draw(matrixStack, message, 2, 1, 0xffffffff);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_BLEND);
}
 
Example 13
Source File: TileChunkLoaderRenderer.java    From ChickenChunks with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f)
{
    CCRenderState.reset();
    CCRenderState.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
    
    double rot = ClientUtils.getRenderTime()*2;
    double height;
    double size;
    double updown = (ClientUtils.getRenderTime()%50) / 25F;
    
    updown = (float) Math.sin(updown*3.141593);
    updown *= 0.2;
    
    TileChunkLoaderBase chunkLoader = (TileChunkLoaderBase)tile;
    if(chunkLoader instanceof TileChunkLoader)
    {
        TileChunkLoader ctile = (TileChunkLoader)chunkLoader;
        rot /= Math.pow(ctile.radius, 0.2);
        height = 0.9;
        size = 0.08;
    }
    else if(chunkLoader instanceof TileSpotLoader)
    {
        height = 0.5;
        size = 0.05;
    }
    else
        return;
    
    RenderInfo renderInfo = chunkLoader.renderInfo;
    double active = (renderInfo.activationCounter)/20D;
    if(chunkLoader.active && renderInfo.activationCounter < 20)
        active += f/20D;
    else if(!chunkLoader.active && renderInfo.activationCounter > 0)
        active -= f/20D;
    
    if(renderInfo.showLasers)
    {            
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_FOG);
        drawRays(d, d1, d2, rot, updown, tile.xCoord, tile.yCoord, tile.zCoord, chunkLoader.getChunks());
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_FOG);
    }
    rot = ClientUtils.getRenderTime()*active / 3F;

    Matrix4 pearlMat = CCModelLibrary.getRenderMatrix(
        new Vector3(d+0.5, d1+height+(updown + 0.3)*active, d2+0.5),
        new Rotation(rot, new Vector3(0, 1, 0)),
        size);
    
    GL11.glDisable(GL11.GL_LIGHTING);
    CCRenderState.changeTexture("chickenchunks:textures/hedronmap.png");
    CCRenderState.startDrawing(4);
    CCModelLibrary.icosahedron4.render(pearlMat);
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example 14
Source File: ChestEspHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	// 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.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	ArrayList<Box> minecartBoxes = calculateMinecartBoxes(partialTicks);
	
	if(style.getSelected().boxes)
	{
		GL11.glCallList(normalChests);
		renderBoxes(minecartBoxes, greenBox);
	}
	
	if(style.getSelected().lines)
	{
		Vec3d start = RotationUtils.getClientLookVec()
			.add(RenderUtils.getCameraPos());
		
		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.glColor4f(1, 0, 1, 0.5F);
		renderLines(start, shulkerBoxes);
		
		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: RenderCoordWireframe.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(float partialTicks){
    /*
    Block block = Block.blocksList[world.getBlockId(x, y, z)];
    block.setBlockBoundsBasedOnState(world, x, y, z);
    double minX = block.getBlockBoundsMinX();
    double minY = block.getBlockBoundsMinY();
    double minZ = block.getBlockBoundsMinZ();
    double maxX = minX + (block.getBlockBoundsMaxX() - minX) * progress;
    double maxY = minY + (block.getBlockBoundsMaxY() - minY) * progress;
    double maxZ = minZ + (block.getBlockBoundsMaxX() - minZ) * progress;
    */
    double minX = 0;
    double minY = 0;
    double minZ = 0;
    double maxX = 1;
    double maxY = 1;
    double maxZ = 1;
    float progress = (ticksExisted % 20 + partialTicks) / 20;
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glLineWidth(1.0F);
    // GL11.glColor4d(0, 1, 1, progress < 0.5F ? progress + 0.5F : 1.5 - progress);
    GL11.glColor4d(0, progress < 0.5F ? progress + 0.5F : 1.5 - progress, 1, 1);
    GL11.glPushMatrix();
    // GL11.glTranslated(-0.5D, -0.5D, -0.5D);
    GL11.glTranslated(x, y, z);
    Tessellator tess = Tessellator.instance;

    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(minX, minY, minZ);
    tess.addVertex(minX, maxY, minZ);
    tess.addVertex(minX, minY, maxZ);
    tess.addVertex(minX, maxY, maxZ);

    tess.addVertex(maxX, minY, minZ);
    tess.addVertex(maxX, maxY, minZ);
    tess.addVertex(maxX, minY, maxZ);
    tess.addVertex(maxX, maxY, maxZ);

    tess.addVertex(minX, minY, minZ);
    tess.addVertex(maxX, minY, minZ);
    tess.addVertex(minX, minY, maxZ);
    tess.addVertex(maxX, minY, maxZ);

    tess.addVertex(minX, maxY, minZ);
    tess.addVertex(maxX, maxY, minZ);
    tess.addVertex(minX, maxY, maxZ);
    tess.addVertex(maxX, maxY, maxZ);

    tess.addVertex(minX, minY, minZ);
    tess.addVertex(minX, minY, maxZ);
    tess.addVertex(maxX, minY, minZ);
    tess.addVertex(maxX, minY, maxZ);

    tess.addVertex(minX, maxY, minZ);
    tess.addVertex(minX, maxY, maxZ);
    tess.addVertex(maxX, maxY, minZ);
    tess.addVertex(maxX, maxY, maxZ);

    tess.draw();

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
 
Example 16
Source File: EssentialsMissingHandler.java    From Cyberware with MIT License 4 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void overlayPre(RenderGameOverlayEvent.Pre event)
{

	if (event.getType() == ElementType.ALL)
	{
		EntityPlayer e = Minecraft.getMinecraft().thePlayer;
		
		HashMultimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
		multimap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(speedId, "Missing leg speed", -100F, 0));
		//e.getAttributeMap().removeAttributeModifiers(multimap);
		
		
		if (CyberwareAPI.hasCapability(e))
		{
			ICyberwareUserData cyberware = CyberwareAPI.getCapability(e);
			
			if (!cyberware.hasEssential(EnumSlot.EYES) && !e.isCreative())
			{
				GlStateManager.pushMatrix();
				GlStateManager.enableBlend();
				GlStateManager.color(1F, 1F, 1F, .9F);
				Minecraft.getMinecraft().getTextureManager().bindTexture(BLACK_PX);
				ClientUtils.drawTexturedModalRect(0, 0, 0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
				GlStateManager.popMatrix();
			}
		}
		
		if (TileEntitySurgery.workingOnPlayer)
		{
			float trans = 1.0F;
			float ticks = TileEntitySurgery.playerProgressTicks + event.getPartialTicks();
			if (ticks < 20F)
			{
				trans = ticks / 20F;
			}
			else if (ticks > 60F)
			{
				trans = (80F - ticks) / 20F;
			}
			GL11.glEnable(GL11.GL_BLEND);
			GL11.glColor4f(1.0F, 1.0F, 1.0F, trans);
			Minecraft.getMinecraft().getTextureManager().bindTexture(BLACK_PX);
			ClientUtils.drawTexturedModalRect(0, 0, 0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
			GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
			GL11.glDisable(GL11.GL_BLEND);
		}
	}
}
 
Example 17
Source File: RendererWarpCore.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 damage, float a) {
	TileMultiBlock multiBlockTile = (TileMultiBlock)tile;

	if(!multiBlockTile.canRender())
		return;

	GL11.glPushMatrix();

	//Rotate and move the model into position
	GL11.glTranslated(x + 0.5, y, z + 0.5);
	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(1f, 0, 0f);

	bindTexture(texture);
	model.renderOnly("Base");

	GL11.glDisable(GL11.GL_TEXTURE_2D);
	
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
	
	GL11.glDisable(GL11.GL_LIGHTING);
	GlStateManager.color(1f, 0.4f, 0.4f, 0.8f);
	GL11.glPushMatrix();
	
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	RenderHelper.renderCubeWithUV(buffer, -0.1f, 1, -0.1f, 0.1f, 2, 0.1f, 0, 1, 0, 1);
	Tessellator.getInstance().draw();
	GL11.glPopMatrix();
	GL11.glEnable(GL11.GL_LIGHTING);
	GlStateManager.color(1f, 1f,1f, 1f);
	
	if(tile.getWorld().provider instanceof WorldProviderSpace) {
		
		ISpaceObject obj = SpaceObjectManager.getSpaceManager().getSpaceStationFromBlockCoords(tile.getPos());
		if(obj instanceof SpaceObject && ((SpaceObject)obj).getFuelAmount() > 50) {

			double speedMult = 1.5;//((DimensionProperties)obj.getProperties()).getParentPlanet() == SpaceObjectManager.WARPDIMID ? 1.5d : 0.1d;
			
			double speedRotate = speedMult*0.25d;
			
			
			GlStateManager.color(0.4f, 0.4f, 1f, 0.6f);
			GL11.glPushMatrix();
			GL11.glRotated(speedRotate*System.currentTimeMillis() % 360, 0f, 1f, 0f);
			model.renderOnly("Rotate1");
			GL11.glPopMatrix();

			GL11.glPushMatrix();
			GL11.glRotated(180 + speedRotate*System.currentTimeMillis() % 360, 0f, 1f, 0f);
			model.renderOnly("Rotate1");
			GL11.glPopMatrix();

			GL11.glPushMatrix();
			GL11.glRotated(-speedRotate*System.currentTimeMillis() % 360, 0f, 1f, 0f);
			model.renderOnly("Rotate2");
			GL11.glPopMatrix();

			GL11.glPushMatrix();
			GL11.glRotated(180 -speedRotate*System.currentTimeMillis() % 360, 0f, 1f, 0f);
			model.renderOnly("Rotate2");
			GL11.glPopMatrix();

			speedRotate = 0.03d*speedMult;
			
			GlStateManager.color(0.4f, 1f, 0.4f, 0.8f);
			int amt = 3;
			float offset = 360/(float)amt;
			for(int j = 0; j < 5; j++) {
				for(int i = 0; i < amt; i++) {
					GL11.glPushMatrix();
					GL11.glRotated(((j+1)*speedRotate*System.currentTimeMillis() % 360) + (i + j/5f)*offset, 0f, 1f, 0f);
					GL11.glTranslatef(0, 0.1f*j-.2f + (5-j)*0.02f*(float)Math.sin(0.001d*System.currentTimeMillis()), 0.2f);
					//GL11.glTranslatef(0f, 0.1f*(0.5f - MathHelper.sin((float)(0.001*System.currentTimeMillis() % 100))), 0f);
					model.renderOnly("Ball");
					GL11.glPopMatrix();
				}
			}
		}
	}
	
	GlStateManager.color(1f, 1f, 1f, 1f);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glPopMatrix();
}
 
Example 18
Source File: KillauraLegitHack.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.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	Box box = new Box(BlockPos.ORIGIN);
	float p = (target.getMaxHealth() - target.getHealth())
		/ target.getMaxHealth();
	float red = p * 2F;
	float green = 2 - red;
	
	GL11.glTranslated(
		target.prevX + (target.getX() - target.prevX) * partialTicks,
		target.prevY + (target.getY() - target.prevY) * partialTicks,
		target.prevZ + (target.getZ() - target.prevZ) * partialTicks);
	GL11.glTranslated(0, 0.05, 0);
	GL11.glScaled(target.getWidth(), target.getHeight(), target.getWidth());
	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);
	RenderUtils.drawSolidBox(box);
	
	GL11.glColor4f(red, green, 0, 0.5F);
	RenderUtils.drawOutlinedBox(box);
	
	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: RenderCarvableBeacon.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) {
    float f1 = beacon.func_146002_i();
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    if(f1 > 0.1F){
        Color color = new Color(ItemDye.field_150922_c[beacon.getWorldObj().getBlockMetadata(beacon.xCoord, beacon.yCoord, beacon.zCoord)]);
        Tessellator tessellator = Tessellator.instance;
        this.bindTexture(texture);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        OpenGlHelper.glBlendFunc(770, 1, 1, 0);
        float f2 = (float) beacon.getWorldObj().getTotalWorldTime() + partialTicks;
        float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
        byte b0 = 1;
        double d3 = (double) f2 * 0.025D * (1.0D - (double) (b0 & 1) * 2.5D);
        tessellator.startDrawingQuads();
        tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
        double d5 = (double) b0 * 0.2D;
        double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5;
        double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5;
        double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5;
        double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5;
        double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5;
        double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5;
        double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5;
        double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5;
        double d23 = (double) (256.0F * f1);
        double d25 = 0.0D;
        double d27 = 1.0D;
        double d28 = (double) (-1.0F + f3);
        double d29 = (double) (256.0F * f1) * (0.5D / d5) + d28;
        tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29);
        tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28);
        tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28);
        tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29);
        tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29);
        tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28);
        tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28);
        tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29);
        tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29);
        tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28);
        tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28);
        tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29);
        tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29);
        tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28);
        tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28);
        tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29);
        tessellator.draw();
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glDepthMask(false);
        tessellator.startDrawingQuads();
        tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
        double d30 = 0.2D;
        double d4 = 0.2D;
        double d6 = 0.8D;
        double d8 = 0.2D;
        double d10 = 0.2D;
        double d12 = 0.8D;
        double d14 = 0.8D;
        double d16 = 0.8D;
        double d18 = (double) (256.0F * f1);
        double d20 = 0.0D;
        double d22 = 1.0D;
        double d24 = (double) (-1.0F + f3);
        double d26 = (double) (256.0F * f1) + d24;
        tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
        tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24);
        tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24);
        tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
        tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
        tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24);
        tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24);
        tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
        tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
        tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24);
        tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24);
        tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
        tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
        tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24);
        tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24);
        tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
        tessellator.draw();
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(true);
    }
}
 
Example 20
Source File: RenderEngine.java    From LowPolyWater with The Unlicense 3 votes vote down vote up
/**
 * Carries out all the rendering for a frame. First the scene is rendered to
 * the reflection texture and the refraction texture using the FBOs. This
 * creates two images of the scene which can then be used to texture the
 * water. The main render pass then takes place, rendering the scene
 * (including the water) to the screen.
 * 
 * @param terrain
 *            - The terrain in the scene.
 * @param water
 *            - The water in the scene.
 * @param camera
 *            - The scene's camera.
 * @param light
 *            - The light being used to illuminate the scene.
 */
public void render(Terrain terrain, WaterTile water, ICamera camera, Light light) {
	GL11.glEnable(GL30.GL_CLIP_DISTANCE0);
	doReflectionPass(terrain, camera, light, water.getHeight());
	doRefractionPass(terrain, camera, light, water.getHeight());
	GL11.glDisable(GL30.GL_CLIP_DISTANCE0);
	doMainRenderPass(terrain, water, camera, light);
}