Jump to content

[1.7.10] Scaling texture keeps moving


The_SlayerMC

Recommended Posts

Hi, im using the drawBackground method inside GuiContainer and when i draw my texture its too small (i want it bigger than 256) when i scale the texture using GL11.glScalef(x, y, z); it makes it bigger but when i change the size of the screen it moves. So how do i get a scaled texture to stay in a ration depending on what the screen size is?

 

I currently have this:

 

public class GuiKaren extends GuiContainer {

public GuiKaren() {
	super(new ContainerEmpty());
}

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	this.mc.getTextureManager().bindTexture(new ResourceLocation(SlayerAPI.PREFIX + "textures/gui/people/karen.png"));
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        GL11.glPushMatrix();
        float scale = 1.0F;
        GL11.glScalef(scale, scale, scale);
        this.drawTexturedModalRect(k - 100, l, 0, 0, 220, 220);
	int guit = ClientTickHandler.guit;
	this.mc.getTextureManager().bindTexture(new ResourceLocation(SlayerAPI.PREFIX + "textures/gui/background.png"));

	if(guit > 5) {
		this.drawTexturedModalRect(k - 130, l - 120, 0, 0, 232, 100);
	} else if(guit < 5) {
		this.drawTexturedModalRect(k - 130, l - 120, 0, 102, 232, 100);
	} else {
		this.drawTexturedModalRect(k - 130, l - 120, 0, 0, 232, 100);
	}
        GL11.glPopMatrix();
}
}

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.