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.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -76,7 +75,7 @@ public abstract class SettingsPanel extends GameGui implements ConfigPanel {
postDrawContents(mouseX, mouseY, partialTicks); postDrawContents(mouseX, mouseY, partialTicks);
GlStateManager.popAttrib(); GL11.glPopAttrib();
} }
@Override @Override

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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