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

The following are Jave code examples for showing how to use glDisable() of the org.lwjgl.opengl.GL11 class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: betaexpansion   File: GuiIngame.java   View Source Code Vote up 6 votes
private void renderPumpkinBlur(int i, int j)
{
    GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
    GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("%blur%/misc/pumpkinblur.png"));
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(0.0D, j, -90D, 0.0D, 1.0D);
    tessellator.addVertexWithUV(i, j, -90D, 1.0D, 1.0D);
    tessellator.addVertexWithUV(i, 0.0D, -90D, 1.0D, 0.0D);
    tessellator.addVertexWithUV(0.0D, 0.0D, -90D, 0.0D, 0.0D);
    tessellator.draw();
    GL11.glDepthMask(true);
    GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
    GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
 
Example 2
Project: ObsidianSuite   File: GuiEntityRenderer.java   View Source Code Vote up 6 votes
protected void drawLine(Vec3d p1, Vec3d p2, int colour, float alpha, float width)
{
	GL11.glPushMatrix();
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	float[] rgb = MathHelper.intToRGB(colour);
	GL11.glColor4f(rgb[0], rgb[1], rgb[2], alpha);
	GL11.glLineWidth(width);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glBegin(GL11.GL_LINE_LOOP);
	GL11.glVertex3d(p1.x,p1.y,p1.z);
	GL11.glVertex3d(p2.x,p2.y,p2.z);
	GL11.glEnd();
	GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glPopMatrix();
}
 
Example 3
Project: BaseClient   File: RenderUtils.java   View Source Code Vote up 6 votes
public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) {
    GL11.glEnable((int)3042);
    GL11.glDisable((int)3553);
    GL11.glBlendFunc((int)770, (int)771);
    GL11.glEnable((int)2848);
    GL11.glShadeModel((int)7425);
    GL11.glPushMatrix();
    GL11.glBegin((int)7);
    RenderUtils.glColor(col1);
    GL11.glVertex2d((double)x2, (double)y);
    GL11.glVertex2d((double)x, (double)y);
    RenderUtils.glColor(col2);
    GL11.glVertex2d((double)x, (double)y2);
    GL11.glVertex2d((double)x2, (double)y2);
    GL11.glEnd();
    GL11.glPopMatrix();
    GL11.glEnable((int)3553);
    GL11.glDisable((int)3042);
    GL11.glDisable((int)2848);
    GL11.glShadeModel((int)7424);
}
 
Example 4
Project: Backmemed   File: RenderUtils.java   View Source Code Vote up 6 votes
public static void drawChestESP(double d, double d1, double d2, double r, double b, double g, double length, double length2)
{
	GL11.glPushMatrix();
	GL11.glEnable(3042);
	GL11.glBlendFunc(770, 771);
	GL11.glLineWidth(1.5F);
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glLineWidth(1.0F);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glDisable(2929);
	GL11.glDepthMask(false);
	GL11.glColor4d(r, g, b, 0.15);
	drawColorBox(new AxisAlignedBB(d, d1, d2, d + length2, d1 + 1.0, d2 + length), 0F, 0F, 0F, 0F);
	GL11.glColor4d(0, 0, 0, 0.5);
	drawSelectionBoundingBox(new AxisAlignedBB(d, d1, d2, d + length2, d1 + 1.0, d2 + length));
	GL11.glLineWidth(2.0F);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_LIGHTING);
	GL11.glEnable(2929);
	GL11.glDepthMask(true);
	GL11.glDisable(3042);
	GL11.glPopMatrix();
}
 
Example 5
Project: EMC   File: RenderUtils.java   View Source Code Vote up 6 votes
public static void frame(double x, double y, double z, double x2, double y2, double z2, Color color) {
	x -= Minecraft.getMinecraft().getRenderManager().renderPosX;
	y -= Minecraft.getMinecraft().getRenderManager().renderPosY;
	z -= Minecraft.getMinecraft().getRenderManager().renderPosZ;
	x2 -= Minecraft.getMinecraft().getRenderManager().renderPosX;
	y2 -= Minecraft.getMinecraft().getRenderManager().renderPosY;
	z2 -= Minecraft.getMinecraft().getRenderManager().renderPosZ;
	GL11.glBlendFunc(770, 771);
	GL11.glEnable(3042);
	GL11.glLineWidth(2.0F);
	GL11.glDisable(3553);
	GL11.glDisable(2929);
	GL11.glDepthMask(false);
	glColor(color);
	drawSelectionBoundingBox(new AxisAlignedBB(x, y, z, x2, y2, z2));
	GL11.glEnable(3553);
	GL11.glEnable(2929);
	GL11.glDepthMask(true);
	GL11.glDisable(3042);
}
 
Example 6
Project: Progetto-C   File: FBOGraphics.java   View Source Code Vote up 6 votes
/**
 * 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 7
Project: BaseClient   File: Shaders.java   View Source Code Vote up 5 votes
public static void glDisableWrapper(int cap)
{
    GL11.glDisable(cap);

    if (cap == 3553)
    {
        disableTexture2D();
    }
    else if (cap == 2912)
    {
        disableFog();
    }
}
 
Example 8
Project: WurstSDK   File: GuiPluginList.java   View Source Code Vote up 5 votes
private void drawIcon(int x, int y, boolean selected) {
    Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("sdk/plugin.png"));
    GL11.glEnable(3042);
    if (selected) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    } else {
        GL11.glColor4f(0.9F, 0.9F, 0.9F, 1.0F);
    }

    Gui.drawModalRectWithCustomSizedTexture(x, y, 24, 24, 24, 24, 24, 24);
    Gui.drawModalRectWithCustomSizedTexture(x, y, 120, 24, 24, 24, 24, 24);
    GL11.glDisable(3042);
}
 
Example 9
Project: Wurst-MC-1.12   File: TemplateToolMod.java   View Source Code Vote up 5 votes
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
	// middle
	int middleX = width / 2;
	int middleY = height / 2;
	
	// background positions
	int x1 = middleX - 100;
	int y1 = middleY + 15;
	int x2 = middleX + 100;
	int y2 = middleY + 26;
	
	// background
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glColor4f(0, 0, 0, 0.5F);
	GL11.glBegin(GL11.GL_QUADS);
	{
		GL11.glVertex2d(x1, y1);
		GL11.glVertex2d(x2, y1);
		GL11.glVertex2d(x2, y2);
		GL11.glVertex2d(x1, y2);
	}
	GL11.glEnd();
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	
	// name field
	nameField.drawTextBox();
	
	// buttons
	super.drawScreen(mouseX, mouseY, partialTicks);
}
 
Example 10
Project: Backmemed   File: RenderUtils.java   View Source Code Vote up 5 votes
public static void drawBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2) {
       drawRect((float)x, (float)y, (float)x2, (float)y2, col2);

       float f = (float)(col1 >> 24 & 0xFF) / 255F;
       float f1 = (float)(col1 >> 16 & 0xFF) / 255F;
       float f2 = (float)(col1 >> 8 & 0xFF) / 255F;
       float f3 = (float)(col1 & 0xFF) / 255F;
       GL11.glPushMatrix();
       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.glColor4f(f1, f2, f3, f);
       GL11.glLineWidth(l1);
       GL11.glBegin(GL11.GL_LINES);
       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.glEnable(GL11.GL_TEXTURE_2D);
       GL11.glDisable(GL11.GL_BLEND);
       GL11.glDisable(GL11.GL_LINE_SMOOTH);
       GL11.glPopMatrix();
}
 
Example 11
Project: Backmemed   File: Trajectories.java   View Source Code Vote up 5 votes
public void enableDefaults() {
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glBlendFunc(770, 771);
	GL11.glEnable(3042);
	GL11.glDisable(3553);
	GL11.glDisable(2929);
	GL11.glEnable(GL13.GL_MULTISAMPLE);
	GL11.glDepthMask(false);
}
 
Example 12
Project: BaseClient   File: RenderUtils.java   View Source Code Vote up 5 votes
public static void disableLighting() {
    OpenGlHelper.setActiveTexture((int)OpenGlHelper.lightmapTexUnit);
    GL11.glDisable((int)3553);
    OpenGlHelper.setActiveTexture((int)OpenGlHelper.defaultTexUnit);
    GL11.glEnable((int)3042);
    GL11.glBlendFunc((int)770, (int)771);
    GL11.glEnable((int)2848);
    GL11.glDisable((int)2896);
    GL11.glDisable((int)3553);
}
 
Example 13
Project: IceMod   File: RenderHunkOIce.java   View Source Code Vote up 5 votes
/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 */
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
    Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);

    if (icon != null)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        this.bindEntityTexture(par1Entity);
        Tessellator tessellator = Tessellator.instance;

        if (icon == ItemPotion.func_94589_d("bottle_splash"))
        {
            int i = PotionHelper.func_77915_a(((EntityPotion)par1Entity).getPotionDamage(), false);
            float f2 = (float)(i >> 16 & 255) / 255.0F;
            float f3 = (float)(i >> 8 & 255) / 255.0F;
            float f4 = (float)(i & 255) / 255.0F;
            GL11.glColor3f(f2, f3, f4);
            GL11.glPushMatrix();
            this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
            GL11.glPopMatrix();
            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }

        this.func_77026_a(tessellator, icon);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
}
 
Example 14
Project: pnc-repressurized   File: ModuleRegulatorTube.java   View Source Code Vote up 5 votes
@SideOnly(Side.CLIENT)
private void renderPreview() {
    if (!hasTicked) {
        TileEntityPneumaticBase tile = (TileEntityPneumaticBase) getTube();
        NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(tile.getPos()));
        TileEntity neighbor = tile.getWorld().getTileEntity(tile.getPos().offset(dir));
        inLine = neighbor instanceof IPneumaticMachine;
        if (inLine) {
            IAirHandler neighborHandler = ((IPneumaticMachine) neighbor).getAirHandler(dir);
            inverted = neighborHandler != null && neighborHandler.getPressure() > tile.getAirHandler(null).getPressure();
            NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(neighbor.getPos()));
        }
        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, 0.5);  // 0.5 because we're rendering a preview
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
}
 
Example 15
Project: betaexpansion   File: RenderGlobal.java   View Source Code Vote up 4 votes
public void renderClouds(float f)
{
    if(mc.theWorld.worldProvider.isNether)
    {
        return;
    }
    if(mc.gameSettings.g_Clouds == 3)
    {
    	return;
    }
    if(mc.gameSettings.g_Clouds == 2 || (mc.gameSettings.fancyGraphics && mc.gameSettings.g_Clouds != 1))
    {
        renderCloudsFancy(f);
        return;
    }
    GL11.glDisable(2884 /*GL_CULL_FACE*/);
    float f1 = (float)(mc.renderViewEntity.lastTickPosY + (mc.renderViewEntity.posY - mc.renderViewEntity.lastTickPosY) * (double)f);
    byte byte0 = 32;
    int i = 256 / byte0;
    Tessellator tessellator = Tessellator.instance;
    GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, renderEngine.getTexture("/environment/clouds.png"));
    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glBlendFunc(770, 771);
    Vec3D vec3d = worldObj.func_628_d(f);
    float f2 = (float)vec3d.xCoord;
    float f3 = (float)vec3d.yCoord;
    float f4 = (float)vec3d.zCoord;
    if(mc.gameSettings.anaglyph)
    {
        float f5 = (f2 * 30F + f3 * 59F + f4 * 11F) / 100F;
        float f7 = (f2 * 30F + f3 * 70F) / 100F;
        float f8 = (f2 * 30F + f4 * 70F) / 100F;
        f2 = f5;
        f3 = f7;
        f4 = f8;
    }
    float f6 = 0.0004882813F;
    double d = mc.renderViewEntity.prevPosX + (mc.renderViewEntity.posX - mc.renderViewEntity.prevPosX) * (double)f + (double)(((float)cloudOffsetX + f) * 0.03F);
    double d1 = mc.renderViewEntity.prevPosZ + (mc.renderViewEntity.posZ - mc.renderViewEntity.prevPosZ) * (double)f;
    int j = MathHelper.floor_double(d / 2048D);
    int k = MathHelper.floor_double(d1 / 2048D);
    d -= j * 2048 /*GL_EXP*/;
    d1 -= k * 2048 /*GL_EXP*/;
    float f9 = (worldObj.worldProvider.getCloudHeight() - f1) + 0.33F;
    float f10 = (float)(d * (double)f6);
    float f11 = (float)(d1 * (double)f6);
    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(f2, f3, f4, 0.8F);
    for(int l = -byte0 * i; l < byte0 * i; l += byte0)
    {
        for(int i1 = -byte0 * i; i1 < byte0 * i; i1 += byte0)
        {
            tessellator.addVertexWithUV(l + 0, f9, i1 + byte0, (float)(l + 0) * f6 + f10, (float)(i1 + byte0) * f6 + f11);
            tessellator.addVertexWithUV(l + byte0, f9, i1 + byte0, (float)(l + byte0) * f6 + f10, (float)(i1 + byte0) * f6 + f11);
            tessellator.addVertexWithUV(l + byte0, f9, i1 + 0, (float)(l + byte0) * f6 + f10, (float)(i1 + 0) * f6 + f11);
            tessellator.addVertexWithUV(l + 0, f9, i1 + 0, (float)(l + 0) * f6 + f10, (float)(i1 + 0) * f6 + f11);
        }

    }

    tessellator.draw();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(3042 /*GL_BLEND*/);
    GL11.glEnable(2884 /*GL_CULL_FACE*/);
}
 
Example 16
Project: Wurst-MC-1.12   File: ExcavatorMod.java   View Source Code Vote up 4 votes
@Override
public void onRenderGUI()
{
	// 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;
	
	// translate to center
	ScaledResolution sr = new ScaledResolution(mc);
	int msgWidth = Fonts.segoe15.getStringWidth(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);
	Fonts.segoe15.drawString(message, 2, -1, 0xffffffff);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_BLEND);
}
 
Example 17
Project: BaseClient   File: Draw.java   View Source Code Vote up 4 votes
public static void endClip() {
    GL11.glDisable((int)3089);
}
 
Example 18
Project: betaexpansion   File: RenderPlayer.java   View Source Code Vote up 4 votes
protected void renderName(EntityPlayer entityplayer, double d, double d1, double d2)
{
    if(Minecraft.isGuiEnabled() && entityplayer != renderManager.livingPlayer)
    {
        float f = 1.6F;
        float f1 = 0.01666667F * f;
        float f2 = entityplayer.getDistanceToEntity(renderManager.livingPlayer);
        float f3 = entityplayer.isSneaking() ? 32F : 64F;
        if(f2 < f3)
        {
            String s = entityplayer.username;
            if(!entityplayer.isSneaking())
            {
                if(entityplayer.isPlayerSleeping())
                {
                    renderLivingLabel(entityplayer, s, d, d1 - 1.5D, d2, 64);
                } else
                {
                    renderLivingLabel(entityplayer, s, d, d1, d2, 64);
                }
            } else
            {
                FontRenderer fontrenderer = getFontRendererFromRenderManager();
                GL11.glPushMatrix();
                GL11.glTranslatef((float)d + 0.0F, (float)d1 + 2.3F, (float)d2);
                GL11.glNormal3f(0.0F, 1.0F, 0.0F);
                GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
                GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
                GL11.glScalef(-f1, -f1, f1);
                GL11.glDisable(2896 /*GL_LIGHTING*/);
                GL11.glTranslatef(0.0F, 0.25F / f1, 0.0F);
                GL11.glDepthMask(false);
                GL11.glEnable(3042 /*GL_BLEND*/);
                GL11.glBlendFunc(770, 771);
                Tessellator tessellator = Tessellator.instance;
                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, -1D, 0.0D);
                tessellator.addVertex(-i - 1, 8D, 0.0D);
                tessellator.addVertex(i + 1, 8D, 0.0D);
                tessellator.addVertex(i + 1, -1D, 0.0D);
                tessellator.draw();
                GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
                GL11.glDepthMask(true);
                fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 0x20ffffff);
                GL11.glEnable(2896 /*GL_LIGHTING*/);
                GL11.glDisable(3042 /*GL_BLEND*/);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                GL11.glPopMatrix();
            }
        }
    }
}
 
Example 19
Project: pnc-repressurized   File: GuiAnimatedStat.java   View Source Code Vote up 4 votes
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    lastMouseX = mouseX;
    lastMouseY = mouseY;
    float zLevel = 0;
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
    int renderBaseX = (int) (oldBaseX + (baseX - oldBaseX) * partialTicks);
    int renderAffectedY = (int) (oldAffectedY + (affectedY - oldAffectedY) * partialTicks);
    int renderWidth = (int) (oldWidth + (width - oldWidth) * partialTicks);
    int renderHeight = (int) (oldHeight + (height - oldHeight) * partialTicks);

    if (leftSided) renderWidth *= -1;
    Gui.drawRect(renderBaseX, renderAffectedY /* + 1 */, renderBaseX + renderWidth /*- 1*/, renderAffectedY + renderHeight, backGroundColor);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glLineWidth(3.0F);
    GL11.glColor4d(0, 0, 0, 1);
    BufferBuilder wr = Tessellator.getInstance().getBuffer();
    wr.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION);
    wr.pos(renderBaseX, renderAffectedY, zLevel).endVertex();
    wr.pos(renderBaseX + renderWidth, renderAffectedY, zLevel).endVertex();
    wr.pos(renderBaseX + renderWidth, renderAffectedY + renderHeight, zLevel).endVertex();
    wr.pos(renderBaseX, renderAffectedY + renderHeight, zLevel).endVertex();
    Tessellator.getInstance().draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    if (leftSided) renderWidth *= -1;
    // if done expanding, draw the information
    if (doneExpanding) {
        GL11.glPushMatrix();
        GL11.glTranslated(renderBaseX + (leftSided ? -renderWidth : 16), renderAffectedY, 0);
        GL11.glScaled(textSize, textSize, textSize);
        GL11.glTranslated(-renderBaseX - (leftSided ? -renderWidth : 16), -renderAffectedY, 0);
        fontRenderer.drawStringWithShadow(title, renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + 2, 0xFFFF00);
        for (int i = curScroll; i < textList.size() && i < curScroll + MAX_LINES; i++) {

            if (textList.get(i).contains("\u00a70") || textList.get(i).contains(TextFormatting.DARK_RED.toString())) {
                fontRenderer.drawString(textList.get(i), renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + (i - curScroll) * 10 + 12, 0xFFFFFF);
            } else {
                fontRenderer.drawStringWithShadow(textList.get(i), renderBaseX + (leftSided ? -renderWidth + 2 : 18), renderAffectedY + (i - curScroll) * 10 + 12, 0xFFFFFF);
            }
        }
        GL11.glPopMatrix();

        GL11.glPushMatrix();
        GL11.glTranslated(renderBaseX, renderAffectedY, 0);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        for (IGuiWidget widget : widgets)
            widget.render(mouseX - renderBaseX, mouseY - renderAffectedY, partialTicks);
        GL11.glPopMatrix();
    }
    if (renderHeight > 16 && renderWidth > 16) {
        GL11.glColor4d(1, 1, 1, 1);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        if (iStack.isEmpty()) {
            if (texture.contains(Textures.GUI_LOCATION)) {
                GuiPneumaticContainerBase.drawTexture(texture, renderBaseX - (leftSided ? 16 : 0), renderAffectedY);
            } else {
                fontRenderer.drawString(texture, renderBaseX - (leftSided ? 16 : 0), renderAffectedY, 0xFFFFFFFF);
            }
        } else if (gui != null || !(iStack.getItem() instanceof ItemBlock)) {
            if (itemRenderer == null) itemRenderer = Minecraft.getMinecraft().getRenderItem();
            itemRenderer.zLevel = 1;
            GL11.glPushMatrix();
            GL11.glTranslated(0, 0, -50);
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            itemRenderer.renderItemAndEffectIntoGUI(iStack, renderBaseX - (leftSided ? 16 : 0), renderAffectedY);
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
            GL11.glPopMatrix();
        }
        GL11.glDisable(GL11.GL_BLEND);
    }
}
 
Example 20
Project: LagGoggles   File: LagOverlayGui.java   View Source Code Vote up 4 votes
public void drawEntityTags(float partialTicks){
    /* ENTITIES */
    for(Map.Entry<Entity, String> e : ENTITY_NANO.entrySet()){
        GL11.glPushMatrix();

        Entity entity = e.getKey();
        double pXe;
        double pYe;
        double pZe;

        if(entity.isDead) {
            pXe = entity.posX;
            pYe = entity.posY;
            pZe = entity.posZ;
        }else{
            pXe = entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks;
            pYe = entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks;
            pZe = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks;
        }

        GL11.glTranslated(pXe, pYe + 2.3D, pZe);
        GL11.glRotated(-RENDER_MANAGER.playerViewY, 0.0, 1.0, 0.0);
        GL11.glRotated(RENDER_MANAGER.playerViewX, 1.0, 0.0, 0.0);
        /* Flip it! */
        GL11.glScaled(-0.015, -0.015, 0.015);


        double[] c = Graphical.heatToColor(ENTITY_HEAT.get(entity));
        GL11.glColor4d(c[0],c[1],c[2], 0.6);


        GL11.glBegin(GL11.GL_QUADS);
        String text = e.getValue();
        if(entity.isDead){
            text = text + " (" + entity.getName() + ")";
        }
        int width_plus_2 = FONT_RENDERER.getStringWidth(text) + 2;
        int height_div_2_plus_1 = (FONT_RENDERER.FONT_HEIGHT/2) + 1;
        GL11.glVertex3d(0           ,-height_div_2_plus_1,0);
        GL11.glVertex3d(0           , height_div_2_plus_1 - 1,0);
        GL11.glVertex3d(width_plus_2, height_div_2_plus_1 - 1,0);
        GL11.glVertex3d(width_plus_2,-height_div_2_plus_1,0);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glColor4d(0,0,0,1);

        FONT_RENDERER.drawString(text, 1, -FONT_RENDERER.FONT_HEIGHT/2, 0x000000);

        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPopMatrix();
    }
}