Normalise GL.pop/pushAttribute method usage. Docs say we shouldn't use the GlStateManager methods. I'm include to agree. I don't think they're meant for general popping/pushing of all attributes.

This commit is contained in:
Sollace 2018-12-10 22:33:06 +02:00
parent 65cf88e50a
commit 96825570a6
8 changed files with 15 additions and 16 deletions

View file

@ -8,7 +8,6 @@ import com.mumfrey.liteloader.modconfig.ConfigPanelHost;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11;
@ -76,7 +75,7 @@ public abstract class SettingsPanel extends GameGui implements ConfigPanel {
postDrawContents(mouseX, mouseY, partialTicks);
GlStateManager.popAttrib();
GL11.glPopAttrib();
}
@Override

View file

@ -474,7 +474,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
*/
private void enableClipping(int yBottom) {
popAttrib();
GL11.glPopAttrib();
if (doubleBuffer == null) {
doubleBuffer = BufferUtils.createByteBuffer(32).asDoubleBuffer();

View file

@ -149,7 +149,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
color(1, 1, 1, 1);
disableBlend();
popMatrix();
popAttrib();
GL11.glPopAttrib();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
pushMatrix();
@ -162,8 +162,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
super.doRender(entity, x, y, z, entityYaw, partialTicks);
popMatrix();
popAttrib();
GL11.glPopAttrib();
}
static class BedHead extends TileEntityBed {
@ -192,7 +191,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
dispatcher.getRenderer(this).render(BedHead.instance, -0.5F, 0, 0, 0, -1, 1);
popMatrix();
popAttrib();
GL11.glPopAttrib();
}
}
@ -214,7 +213,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
render.doRender(this, 0, 0, 0, 0, 0);
popMatrix();
popAttrib();
GL11.glPopAttrib();
}
}
}

View file

@ -66,7 +66,7 @@ public class SeaponyTail implements IModelPart {
GlStateManager.enableBlend();
tailBase.render(scale);
GlStateManager.disableBlend();
GlStateManager.popAttrib();
GL11.glPopAttrib();
}
}

View file

@ -58,7 +58,7 @@ public class UnicornHorn implements IModelPart {
enableTexture2D();
enableLighting();
disableBlend();
popAttrib();
glPopAttrib();
}
}

View file

@ -3,7 +3,6 @@ package com.minelittlepony.model.gear;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
@ -42,6 +41,6 @@ public abstract class AbstractGear extends ModelBase implements IGear, PonyModel
renderPart(scale);
GlStateManager.popAttrib();
GL11.glPopAttrib();
}
}

View file

@ -1,10 +1,11 @@
package com.minelittlepony.model.gear;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.opengl.GL11;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.capabilities.IModel;
import com.minelittlepony.pony.data.PonyWearable;
@ -88,7 +89,8 @@ public class ChristmasHat extends AbstractGear {
@Override
public void renderPart(float scale) {
GlStateManager.pushAttrib();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
if (tint != 0) {
Color.glColor(tint, 1);
}
@ -96,7 +98,7 @@ public class ChristmasHat extends AbstractGear {
left.render(scale);
right.render(scale);
GlStateManager.popAttrib();
GL11.glPopAttrib();
}
}

View file

@ -86,6 +86,6 @@ public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T>
gear.setRotationAndAngles(model.isGoingFast(), move, swing, model.getWobbleAmount(), ticks);
gear.renderPart(scale);
GlStateManager.popAttrib();
GL11.glPopAttrib();
}
}