Java Code Examples for org.lwjgl.opengl.GL11

The following examples show how to use org.lwjgl.opengl.GL11. These examples are extracted from open source projects. 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 Project: The-5zig-Mod   Source File: GuiIngame.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void renderTextAboveHotbar() {
	int scaledWidth = The5zigMod.getVars().getScaledWidth();
	int scaledHeight = The5zigMod.getVars().getScaledHeight();
	if (this.hoverTextTime > 0) {
		int l3 = (int) (this.hoverTextTime * 256.0F / 10.0F);
		if (l3 > 255) {
			l3 = 255;
		}
		GLUtil.pushMatrix();
		GLUtil.translate((float) (scaledWidth / 2), (float) (scaledHeight - 78), 0.0F);
		GLUtil.enableBlend();
		GLUtil.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_FALSE, GL11.GL_TRUE);

		The5zigMod.getVars().drawString(this.hoverText, -The5zigMod.getVars().getStringWidth(this.hoverText) / 2, -4, 0xD33D3A + (l3 << 24));
		GLUtil.disableBlend();
		GLUtil.popMatrix();
	}
}
 
Example 2
private static void render(RenderQueues render_queues, Lightning lightning) {
	if (Globals.isBoundsEnabled(Globals.BOUNDING_PLAYERS)) {
		RenderTools.draw(lightning, 1f, 1f, 1f);
	}

	GL11.glBindTexture(GL11.GL_TEXTURE_2D, render_queues.getTexture(lightning.getTexture()).getHandle());
	GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
	GL11.glBegin(GL11.GL_QUADS);

	List particles = lightning.getParticles();
	for (int i = particles.size() - 1; i >= 0; i--) {
		StretchParticle particle = (StretchParticle)particles.get(i);
		render2DParticle(particle);
	}

	GL11.glEnd();
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
}
 
Example 3
Source Project: Custom-Main-Menu   Source File: TextureURL.java    License: MIT License 6 votes vote down vote up
@Override
public void bind()
{
	if (this.textureID != -1)
	{
		GlStateManager.bindTexture(this.textureID);
	}
	else
	{
		if (bi != null)
		{
			setTextureID(TextureUtil.uploadTextureImageAllocate(GL11.glGenTextures(), bi, false, false));
			bind();
			return;
		}
		CustomMainMenu.bindTransparent();
	}
}
 
Example 4
Source Project: ExtraCells1   Source File: GuiSolderingStation.java    License: MIT License 6 votes vote down vote up
@Override
public void drawScreen(int x, int y, float f)
{
	drawDefaultBackground();
	int posX = (this.width - xSize) / 2;
	int posY = (this.height - ySize) / 2;

	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	Minecraft.getMinecraft().renderEngine.bindTexture(guiTexture);

	drawTexturedModalRect(posX, posY, 0, 0, xSize, ySize);

	if (rightItem)
	{
		textfield_size.drawTextBox();
		textfield_types.drawTextBox();
	} else
	{
		this.fontRenderer.drawSplitString(StatCollector.translateToLocal("tooltip.solderingwarning.tutorial"), posX + 3, posY + 25, 170, 0x000064);
	}
	super.drawScreen(x, y, f);
}
 
Example 5
/**
 * @see org.newdawn.slick.opengl.renderer.SGL#initDisplay(int, int)
 */
public void initDisplay(int width, int height) {
	this.width = width;
	this.height = height;
	
	String extensions = GL11.glGetString(GL11.GL_EXTENSIONS);
	
	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,width,height);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
 
Example 6
public static void renderCore(EntityGolemBase golem, AdditionalGolemCore core) {
    GL11.glPushMatrix();

    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0875F, -0.96F, 0.15F + (golem.getGolemDecoration().contains("P") ? 0.03F : 0.0F));
    GL11.glScaled(0.175D, 0.175D, 0.175D);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

    ItemStack coreItem = core.getItem();
    IIcon icon = coreItem.getItem().getIcon(coreItem, 0);
    float f1 = icon.getMaxU();
    float f2 = icon.getMinV();
    float f3 = icon.getMinU();
    float f4 = icon.getMaxV();
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
    ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);

    GL11.glPopMatrix();
}
 
Example 7
Source Project: Signals   Source File: GuiButtonSpecial.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks){
    if(thisVisible) super.drawButton(mc, mouseX, mouseY, partialTicks);

    if(visible) {
        if(renderedStacks != null) {
            int middleX = this.x + width / 2;
            int startX = middleX - renderedStacks.length * 9 + 1;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            for(int i = 0; i < renderedStacks.length; i++) {
                itemRenderer.renderItemAndEffectIntoGUI(renderedStacks[i], startX + i * 18, this.y + 2);
            }
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
        if(resLoc != null) {
            mc.getTextureManager().bindTexture(resLoc);
            drawModalRectWithCustomSizedTexture(this.x + width / 2 - 8, this.y + 2, 0, 0, 16, 16, 16, 16);
        }
        if(enabled && !thisVisible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + width && mouseY < this.y + height) {
            Gui.drawRect(this.x, this.y, this.x + width, this.y + height, invisibleHoverColor);
        }
    }
}
 
Example 8
Source Project: LWJGUI   Source File: GenericShader.java    License: MIT License 6 votes vote down vote up
protected static int createProgram(int vertexShaderId, int[] fragmentShaderIds, String[] attrs, int[] indices) {

		// build the shader program
		int id = GL20.glCreateProgram();
		GL20.glAttachShader(id, vertexShaderId);
		for (int fragmentShaderId : fragmentShaderIds) {
			GL20.glAttachShader(id, fragmentShaderId);
		}

		assert (attrs.length == indices.length);
		for (int i=0; i<attrs.length; i++) {
			GL20.glBindAttribLocation(id, indices[i], attrs[i]);
		}

		GL20.glLinkProgram(id);
		boolean isSuccess = GL20.glGetProgrami(id, GL20.GL_LINK_STATUS) == GL11.GL_TRUE;
		if (!isSuccess) {
			throw new RuntimeException("Shader program did not link:\n" + GL20.glGetProgramInfoLog(id, 4096));
		}

		return id;
	}
 
Example 9
Source Project: ehacks-pro   Source File: GLUtils.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void drawFullCircle(int cx, int cy, double r, int c) {
    GL11.glScalef(0.5f, 0.5f, 0.5f);
    r *= 2.0;
    cx *= 2;
    cy *= 2;
    float f = (c >> 24 & 255) / 255.0f;
    float f1 = (c >> 16 & 255) / 255.0f;
    float f2 = (c >> 8 & 255) / 255.0f;
    float f3 = (c & 255) / 255.0f;
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glEnable(2848);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glBegin(6);
    for (int i = 0; i <= 360; ++i) {
        double x = Math.sin(i * 3.141592653589793 / 180.0) * r;
        double y = Math.cos(i * 3.141592653589793 / 180.0) * r;
        GL11.glVertex2d((cx + x), (cy + y));
    }
    GL11.glEnd();
    GL11.glDisable(2848);
    GL11.glEnable(3553);
    GL11.glDisable(3042);
    GL11.glScalef(2.0f, 2.0f, 2.0f);
}
 
Example 10
@Override
public void render(int mouseX, int mouseY, float partialTick){
    GL11.glColor4d(1, 1, 1, 1);
    if(!Mouse.isButtonDown(0)) dragging = false;
    if(!wasClicking && Mouse.isButtonDown(0) && getBounds().contains(mouseX, mouseY)) {
        dragging = true;
    }
    if(!enabled) dragging = false;
    wasClicking = Mouse.isButtonDown(0);
    if(dragging) currentScroll = (float)(mouseY - 7 - getBounds().y) / (getBounds().height - 17);
    currentScroll = MathHelper.clamp_float(currentScroll, 0, 1);
    Minecraft.getMinecraft().getTextureManager().bindTexture(scrollTexture);
    Gui.func_146110_a(x, y, 12, 0, getBounds().width, 1, 26, 15);
    for(int i = 0; i < getBounds().height - 2; i++)
        Gui.func_146110_a(x, y + 1 + i, 12, 1, getBounds().width, 1, 26, 15);
    Gui.func_146110_a(x, y + getBounds().height - 1, 12, 14, getBounds().width, 1, 26, 15);

    if(!enabled) GL11.glColor4d(0.6, 0.6, 0.6, 1);
    Gui.func_146110_a(x + 1, y + 1 + (int)((getBounds().height - 17) * currentScroll), 0, 0, 12, 15, 26, 15);
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 11
Source Project: Wurst7   Source File: MobEspHack.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void renderBoxes(double partialTicks)
{
	double extraSize = boxSize.getSelected().extraSize;
	
	for(MobEntity e : mobs)
	{
		GL11.glPushMatrix();
		
		GL11.glTranslated(e.prevX + (e.getX() - e.prevX) * partialTicks,
			e.prevY + (e.getY() - e.prevY) * partialTicks,
			e.prevZ + (e.getZ() - e.prevZ) * partialTicks);
		
		GL11.glScaled(e.getWidth() + extraSize, e.getHeight() + extraSize,
			e.getWidth() + extraSize);
		
		float f = MC.player.distanceTo(e) / 20F;
		GL11.glColor4f(2 - f, f, 0, 0.5F);
		
		GL11.glCallList(mobBox);
		
		GL11.glPopMatrix();
	}
}
 
Example 12
Source Project: TFC2   Source File: PlayerInventory.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void drawInventory(GuiContainer container, int screenWidth, int screenHeight, int upperGuiHeight)
{
	Core.bindTexture(invTexture);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	int guiX = (screenWidth - invXSize) / 2;
	int guiY = (screenHeight - (upperGuiHeight+invYSize)) / 2 + upperGuiHeight;
	container.drawTexturedModalRect(guiX, guiY, 0, 0, invXSize, invYSize);

	//encumbrance bar
	float eMult = Math.min(Core.getEncumbrance(net.minecraft.client.Minecraft.getMinecraft().player.inventory.mainInventory) / 80f, 1.0f);
	if(eMult < 0.5)
		GL11.glColor4f(0.0F, 0.8F, 0.0F, 1.0F);
	else if(eMult < 0.75)
		GL11.glColor4f(1.0F, 0.8F, 0.0F, 1.0F);
	else
		GL11.glColor4f(0.8F, 0.0F, 0.0F, 1.0F);
	container.drawTexturedModalRect(guiX+8, guiY+5, 2, 245, (int)(160 * eMult), 3);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	//encumbrance meter
	container.drawTexturedModalRect(guiX+7, guiY+4, 1, 249, 162, 5);
}
 
Example 13
public static void renderMob(WrathSpawnerLogic spawnLogic, double par1, double y, double par5, float par7) {
    Entity entity = spawnLogic.getEntityForRender();

    if (entity != null) {
        entity.setWorld(spawnLogic.getSpawnerWorld());
        float f1 = 0.4375F;
        if (spawnLogic.getEntityNameToSpawn().equals("Ghast"))
            f1 = 0.1F;
        else if (spawnLogic.getEntityNameToSpawn().equals("Slime") || spawnLogic.getEntityNameToSpawn().equals("ThaumSlime"))
            f1 = 0.4F;
        else if (spawnLogic.getEntityNameToSpawn().equals("Enderman"))
            f1 = 0.3F;
        GL11.glTranslatef(0.0F, 0.4F, 0.0F);
        if (!spawnLogic.getSpawnerWorld().isBlockIndirectlyGettingPowered(spawnLogic.getSpawnerX(), spawnLogic.getSpawnerY(), spawnLogic.getSpawnerZ()))
            GL11.glRotatef((float) (spawnLogic.field_98284_d + (spawnLogic.field_98287_c - spawnLogic.field_98284_d) * (double) par7) * 10.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(f1, f1, f1);
        entity.setLocationAndAngles(par1, y, par5, 0.0F, 0.0F);
        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, par7);
    }
}
 
Example 14
Source Project: Wurst7   Source File: EditBlockScreen.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void renderIcon(MatrixStack matrixStack, ItemStack stack, int x,
	int y, boolean large)
{
	GL11.glPushMatrix();
	
	GL11.glTranslated(x, y, 0);
	double scale = large ? 1.5 : 0.75;
	GL11.glScaled(scale, scale, scale);
	
	DiffuseLighting.enable();
	ItemStack grass = new ItemStack(Blocks.GRASS_BLOCK);
	ItemStack renderStack = !stack.isEmpty() ? stack : grass;
	WurstClient.MC.getItemRenderer().renderInGuiWithOverrides(renderStack,
		0, 0);
	DiffuseLighting.disable();
	
	GL11.glPopMatrix();
	
	if(stack.isEmpty())
		renderQuestionMark(matrixStack, x, y, large);
}
 
Example 15
Source Project: Wurst7   Source File: ClickGui.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void renderPinnedWindows(MatrixStack matrixStack, float partialTicks)
{
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glShadeModel(GL11.GL_SMOOTH);
	GL11.glLineWidth(1);
	
	for(Window window : windows)
		if(window.isPinned() && !window.isInvisible())
			renderWindow(matrixStack, window, Integer.MIN_VALUE,
				Integer.MIN_VALUE, partialTicks);
		
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
}
 
Example 16
Source Project: Wurst7   Source File: TrajectoriesHack.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void drawLine(ArrayList<Vec3d> path, Vec3d camPos)
{
	GL11.glBegin(GL11.GL_LINE_STRIP);
	GL11.glColor4f(0, 1, 0, 0.75F);
	
	for(Vec3d point : path)
		GL11.glVertex3d(point.x - camPos.x, point.y - camPos.y,
			point.z - camPos.z);
	
	GL11.glEnd();
}
 
Example 17
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data){

    switch(type){
        case ENTITY: {
            render(0.0F, 0.0F, 1.0F, 0.5F);
            return;
        }
        case EQUIPPED: {
            GL11.glRotatef(-30F, 0, 1.0F, 0.0F);
            GL11.glRotatef(70F, 0, 0F, 1.0F);
            render(0.5F, -0.5F, 0.5F, 1.0F);
            return;
        }
        case EQUIPPED_FIRST_PERSON: {
            GL11.glRotatef(-140F, 0, 1.2F, 0.0F);
            render(0.0F, 0.5F, 1.7F, 1.0F);
            return;
        }
        case INVENTORY: {
            render(0.0F, 0.0F, 1.0F, 1.0F);
            return;
        }
        default:
            return;
    }
}
 
Example 18
Source Project: ldparteditor   Source File: GData4.java    License: MIT License 5 votes vote down vote up
@Override
public void drawGL20(Composite3D c3d) {
    if (!visible)
        return;
    if (a < 1f && c3d.isDrawingSolidMaterials() || !c3d.isDrawingSolidMaterials() && a == 1f)
        return;
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor4f(r, g, b, a);
    if (GData.globalNegativeDeterminant) {
        GL11.glNormal3f(xn, yn, zn);
        GL11.glVertex3f(x1, y1, z1);
        GL11.glVertex3f(x4, y4, z4);
        GL11.glVertex3f(x3, y3, z3);
        GL11.glVertex3f(x2, y2, z2);
        GL11.glNormal3f(-xn, -yn, -zn);
        GL11.glVertex3f(x1, y1, z1);
        GL11.glVertex3f(x2, y2, z2);
        GL11.glVertex3f(x3, y3, z3);
        GL11.glVertex3f(x4, y4, z4);
    } else {
        GL11.glNormal3f(-xn, -yn, -zn);
        GL11.glVertex3f(x1, y1, z1);
        GL11.glVertex3f(x4, y4, z4);
        GL11.glVertex3f(x3, y3, z3);
        GL11.glVertex3f(x2, y2, z2);
        GL11.glNormal3f(xn, yn, zn);
        GL11.glVertex3f(x1, y1, z1);
        GL11.glVertex3f(x2, y2, z2);
        GL11.glVertex3f(x3, y3, z3);
        GL11.glVertex3f(x4, y4, z4);
    }
    GL11.glEnd();
}
 
Example 19
/**
 * Changes the YOffset of the creature, i.e. sitting animals
 * @param mocreature
 */
protected void adjustYOffset(MoCIMoCreature mocreature)
{
    float f = mocreature.getAdjustedYOffset();
    if (f != 0)
    {
        GL11.glTranslatef(0.0F, f, 0.0F);
    }
}
 
Example 20
Source Project: LWJGUI   Source File: BlurPane.java    License: MIT License 5 votes vote down vote up
private void blur(Context context) {
	// Bind final buffer
	this.buffer.bind();
	
	// Clear
	GL11.glClearColor(1, 1, 1, 1);
	GL11.glClear(GL11.GL_COLOR_BUFFER_BIT|GL11.GL_DEPTH_BUFFER_BIT);
	
	// Render the blur buffer (uses the buffer temp as texture)
	this.buffer.render(context);
	
	// unbind
	this.buffer.unbind();
}
 
Example 21
public void renderModelAt(TileEntityAirCannon tile, double d, double d1, double d2, float f){
    GL11.glPushMatrix(); // start
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(Textures.MODEL_AIR_CANNON);
    GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); // size
    GL11.glScalef(1.0F, -1F, -1F); // to make your block have a normal
                                   // positioning. comment out to see what
                                   // happens
    float angle = (float)PneumaticCraftUtils.rotateMatrixByMetadata(tile.getBlockMetadata());
    float rotationAngle = tile.rotationAngle - angle + 180F;
    model.renderModel(0.0625F, rotationAngle, tile.heightAngle, false, false);
    GL11.glPopMatrix(); // end

}
 
Example 22
Source Project: ExtraCells1   Source File: ItemRendererLevelEmitterFluid.java    License: MIT License 5 votes vote down vote up
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/blocks/texmap_level_emitter_on.png"));
	GL11.glPushMatrix();
	GL11.glTranslatef(-0.5F, 0.5F, 0.5F);
	GL11.glScalef(1.0F, -1F, -1F);
	GL11.glRotatef(180F, 1, 0, 0);
	GL11.glRotatef(-90F, 0, 0, 1);
	model.render(0.0625f);
	cable.renderBase(-0.5, 0.5F, -0.5F, Colors.CLEAR);
	cable.renderExtend(-0.5, 0.5F, -0.5F, ForgeDirection.DOWN, Colors.CLEAR);
	GL11.glPopMatrix();
}
 
Example 23
@Override
@SideOnly(Side.CLIENT)
public void render3D(float partialTicks){
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    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);
    RenderManager.instance.renderEngine.bindTexture(Textures.GLOW_RESOURCE);
    //  mc.func_110434_K().func_110577_a(Textures.GLOW_RESOURCE);
    for(Map.Entry<EntityItem, Integer> entry : searchedItems.entrySet()) {
        EntityItem item = entry.getKey();
        float height = MathHelper.sin((item.age + partialTicks) / 10.0F + item.hoverStart) * 0.1F + 0.2F;
        RenderSearchItemBlock.renderSearch(item.lastTickPosX + (item.posX - item.lastTickPosX) * partialTicks, item.lastTickPosY + (item.posY - item.lastTickPosY) * partialTicks + height, item.lastTickPosZ + (item.posZ - item.lastTickPosZ) * partialTicks, entry.getValue(), totalSearchedItemCount);
    }
    for(int i = 0; i < searchedBlocks.size(); i++) {
        if(!searchedBlocks.get(i).renderSearchBlock(totalSearchedItemCount)) {
            searchedBlocks.remove(i);
            i--;
        }
    }
    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);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
 
Example 24
public static void drawItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) {
	glSetup(x, y, z);
	
    GL11.glScaled(0.4*scale, 0.4*scale, 0);
    
    GL11.glTranslated(offX, offY, 0);
    if (item.getItem() instanceof BlockItem) GL11.glRotatef(180F, 1F, 180F, 10F);
    mc.getItemRenderer().renderItem(new ItemStack(item.getItem()), Type.GUI);
    if (item.getItem() instanceof BlockItem) GL11.glRotatef(-180F, -1F, -180F, -10F);
    GL11.glDisable(GL11.GL_LIGHTING);
    
    GL11.glScalef(-0.05F, -0.05F, 0);
    
    if (item.getCount() > 0) {
	    int w = mc.textRenderer.getStringWidth("x" + item.getCount()) / 2;
	    mc.textRenderer.drawWithShadow("x" + item.getCount(), 7 - w, 5, 0xffffff);
    }
    
    GL11.glScalef(0.85F, 0.85F, 0.85F);
    
    int c = 0;
    for (Entry<Enchantment, Integer> m: EnchantmentHelper.getEnchantments(item).entrySet()) {
    	int w1 = mc.textRenderer.getStringWidth(I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue()) / 2;
    	mc.textRenderer.drawWithShadow(
    			I18n.translate(m.getKey().getName(2).asString()).substring(0, 2) + m.getValue(), -4 - w1, c*10-1,
    			m.getKey() == Enchantments.VANISHING_CURSE || m.getKey() == Enchantments.BINDING_CURSE
    			? 0xff5050 : 0xffb0e0);
    	c--;
    }
    
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    String dur = item.getMaxDamage() - item.getDamage() + "";
       int color = 0x000000;
       try{ color = MathHelper.hsvToRgb(((float) (item.getMaxDamage() - item.getDamage()) / item.getMaxDamage()) / 3.0F, 1.0F, 1.0F); } catch (Exception e) {}
    if (item.isDamageable()) mc.textRenderer.drawWithShadow(dur, -8 - dur.length() * 3, 15,
    		new Color(color >> 16 & 255, color >> 8 & 255, color & 255).getRGB());
    glCleanup();
}
 
Example 25
Source Project: ldparteditor   Source File: OpenGLRendererPrimitives20.java    License: MIT License 5 votes vote down vote up
private void drawPlus(float x, float y) {
    drawSignBackground(x, y);
    GL11.glColor4f(View.primitive_plusNminus_Colour_r[0], View.primitive_plusNminus_Colour_g[0], View.primitive_plusNminus_Colour_b[0], 1f);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glNormal3f(0f, 0f, 1f);
    GL11.glVertex3f(x + 14f, y + 15.75f, 0f);
    GL11.glVertex3f(x + 14f, y + 15.25f, 0f);
    GL11.glVertex3f(x + 16f, y + 15.25f, 0f);
    GL11.glVertex3f(x + 16f, y + 15.75f, 0f);
    GL11.glVertex3f(x + 14.75f, y + 16.4f, 0f);
    GL11.glVertex3f(x + 14.75f, y + 14.6f, 0f);
    GL11.glVertex3f(x + 15.25f, y + 14.6f, 0f);
    GL11.glVertex3f(x + 15.25f, y + 16.4f, 0f);
    GL11.glEnd();
}
 
Example 26
Source Project: Slyther   Source File: Gui.java    License: MIT License 5 votes vote down vote up
public void drawCircle(float centerX, float centerY, float radius, int color) {
    GL11.glColor4f((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, 1.0F);
    GL11.glPushMatrix();
    GL11.glTranslatef(centerX - radius, centerY - radius, 0.0F);
    radius /= 128.0F;
    GL11.glScalef(radius, radius, 1.0F);
    renderHandler.textureManager.bindTexture("/textures/circle.png");
    drawTexture(0.0F, 0.0F, 0.0F, 0.0F, 256.0F, 256.0F, 256.0F, 256.0F);
    GL11.glPopMatrix();
}
 
Example 27
Source Project: ehacks-pro   Source File: GuiNBTTree.java    License: GNU General Public License v3.0 5 votes vote down vote up
protected void overlayBackground(int par1, int par2, int par3, int par4) {
    Tessellator var5 = Tessellator.instance;
    Wrapper.INSTANCE.mc().renderEngine.bindTexture(new ResourceLocation("textures/blocks/bedrock.png"));
    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    float var6 = 32.0f;
    var5.startDrawingQuads();
    var5.setColorRGBA_I(4210752, par4);
    var5.addVertexWithUV(0.0, par2, 0.0, 0.0, (par2 / var6));
    var5.addVertexWithUV(this.width, par2, 0.0, (this.width / var6), (par2 / var6));
    var5.setColorRGBA_I(4210752, par3);
    var5.addVertexWithUV(this.width, par1, 0.0, (this.width / var6), (par1 / var6));
    var5.addVertexWithUV(0.0, par1, 0.0, 0.0, (par1 / var6));
    var5.draw();
}
 
Example 28
Source Project: Wurst7   Source File: MobEspHack.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onDisable()
{
	EVENTS.remove(UpdateListener.class, this);
	EVENTS.remove(CameraTransformViewBobbingListener.class, this);
	EVENTS.remove(RenderListener.class, this);
	
	GL11.glDeleteLists(mobBox, 1);
	mobBox = 0;
}
 
Example 29
@SideOnly(Side.CLIENT)
public void renderInterpolated(RenderProgressingLine lastTickLine, float partialTick){
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINES);
    tess.addVertex(getInter(startX, lastTickLine.startX, partialTick), getInter(startY, lastTickLine.startY, partialTick), getInter(startZ, lastTickLine.startZ, partialTick));
    tess.addVertex(getInter(startX, lastTickLine.startX, partialTick) + (getInter(endX, lastTickLine.endX, partialTick) - getInter(startX, lastTickLine.startX, partialTick)) * progress, getInter(startY, lastTickLine.startY, partialTick) + (getInter(startY, lastTickLine.startY, partialTick) - getInter(endY, lastTickLine.endY, partialTick)) * progress, getInter(startZ, lastTickLine.startZ, partialTick) + (getInter(endZ, lastTickLine.endZ, partialTick) - getInter(startZ, lastTickLine.startZ, partialTick)) * progress);
    tess.draw();
}
 
Example 30
Source Project: ehacks-pro   Source File: BlockOverlay.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void drawESP(MovingObjectPosition position) {
    GL11.glPushMatrix();
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glLineWidth(1.0f);
    GL11.glDisable(2896);
    GL11.glDisable(3553);
    GL11.glEnable(2848);
    GL11.glDisable(2929);
    GL11.glDepthMask(false);
    double blockX = RenderManager.renderPosX;
    double blockY = RenderManager.renderPosY;
    double blockZ = RenderManager.renderPosZ;
    Block block = Wrapper.INSTANCE.world().getBlock(position.blockX, position.blockY, position.blockZ);
    GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.2f);
    BlockOverlay.drawOutlinedBoundingBox(block.getSelectedBoundingBoxFromPool(Wrapper.INSTANCE.world(), position.blockX, position.blockY, position.blockZ).expand(0.002, 0.002, 0.002).getOffsetBoundingBox(-blockX, -blockY, -blockZ));
    GL11.glColor4f(0.0f, 0.4f, 0.0f, 0.2f);
    BlockOverlay.drawBoundingBox(block.getSelectedBoundingBoxFromPool(Wrapper.INSTANCE.world(), position.blockX, position.blockY, position.blockZ).expand(0.002, 0.002, 0.002).getOffsetBoundingBox(-blockX, -blockY, -blockZ));
    GL11.glLineWidth(1.0f);
    GL11.glDisable(2848);
    GL11.glEnable(3553);
    GL11.glEnable(2896);
    GL11.glEnable(2929);
    GL11.glDepthMask(true);
    GL11.glDisable(3042);
    GL11.glPopMatrix();
}