Removed usage of GL11 in favor of using GlStateManager.

This commit is contained in:
Sebastian Hartte
2016-10-03 00:23:45 +02:00
parent 62f224d77b
commit 2ab1fc0adf
16 changed files with 93 additions and 113 deletions
@@ -24,9 +24,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@@ -252,7 +251,7 @@ public class ClientHelper extends ServerHelper
final float r = 0xff & ( col.mediumVariant >> 16 ); final float r = 0xff & ( col.mediumVariant >> 16 );
final float g = 0xff & ( col.mediumVariant >> 8 ); final float g = 0xff & ( col.mediumVariant >> 8 );
final float b = 0xff & ( col.mediumVariant ); final float b = 0xff & ( col.mediumVariant );
GL11.glColor3f( r / 255.0f, g / 255.0f, b / 255.0f ); GlStateManager.color( r / 255.0f, g / 255.0f, b / 255.0f );
} }
} }
+14 -13
View File
@@ -233,7 +233,7 @@ public abstract class AEBaseGui extends GuiContainer
{ {
final int ox = this.guiLeft; // (width - xSize) / 2; final int ox = this.guiLeft; // (width - xSize) / 2;
final int oy = this.guiTop; // (height - ySize) / 2; final int oy = this.guiTop; // (height - ySize) / 2;
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
if( this.getScrollBar() != null ) if( this.getScrollBar() != null )
{ {
@@ -250,7 +250,7 @@ public abstract class AEBaseGui extends GuiContainer
{ {
final int ox = this.guiLeft; // (width - xSize) / 2; final int ox = this.guiLeft; // (width - xSize) / 2;
final int oy = this.guiTop; // (height - ySize) / 2; final int oy = this.guiTop; // (height - ySize) / 2;
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
this.drawBG( ox, oy, x, y ); this.drawBG( ox, oy, x, y );
final List<Slot> slots = this.getInventorySlots(); final List<Slot> slots = this.getInventorySlots();
@@ -267,10 +267,10 @@ public abstract class AEBaseGui extends GuiContainer
} }
else else
{ {
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 0.4F ); GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
GlStateManager.enableBlend(); GlStateManager.enableBlend();
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 ); this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18, 18 );
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
} }
} }
} }
@@ -669,7 +669,9 @@ public abstract class AEBaseGui extends GuiContainer
this.itemRender.zLevel = 100.0F; this.itemRender.zLevel = 100.0F;
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
GlStateManager.enableDepth();
this.itemRender.renderItemAndEffectIntoGUI( is, x, y ); this.itemRender.renderItemAndEffectIntoGUI( is, x, y );
GlStateManager.disableDepth();
this.itemRender.zLevel = 0.0F; this.itemRender.zLevel = 0.0F;
this.zLevel = 0.0F; this.zLevel = 0.0F;
@@ -740,17 +742,16 @@ public abstract class AEBaseGui extends GuiContainer
{ {
this.bindTexture( "guis/states.png" ); this.bindTexture( "guis/states.png" );
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
try try
{ {
final int uv_y = (int) Math.floor( aes.getIcon() / 16 ); final int uv_y = (int) Math.floor( aes.getIcon() / 16 );
final int uv_x = aes.getIcon() - uv_y * 16; final int uv_x = aes.getIcon() - uv_y * 16;
GL11.glEnable( GL11.GL_BLEND ); GlStateManager.enableBlend();
GL11.glDisable( GL11.GL_LIGHTING ); GlStateManager.disableLighting();
GL11.glEnable( GL11.GL_TEXTURE_2D ); GlStateManager.enableTexture2D();
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
final float par1 = aes.xDisplayPosition; final float par1 = aes.xDisplayPosition;
final float par2 = aes.yDisplayPosition; final float par2 = aes.yDisplayPosition;
final float par3 = uv_x * 16; final float par3 = uv_x * 16;
@@ -770,11 +771,11 @@ public abstract class AEBaseGui extends GuiContainer
vb.pos( par1 + par5, par2 + 0, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex(); vb.pos( par1 + par5, par2 + 0, this.zLevel ).tex( ( par3 + par5 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
vb.pos( par1 + 0, par2 + 0, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex(); vb.pos( par1 + 0, par2 + 0, this.zLevel ).tex( ( par3 + 0 ) * f, ( par4 + 0 ) * f1 ).color( 1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon() ).endVertex();
tessellator.draw(); tessellator.draw();
} }
catch( final Exception err ) catch( final Exception err )
{ {
} }
GL11.glPopAttrib();
} }
} }
@@ -802,9 +803,9 @@ public abstract class AEBaseGui extends GuiContainer
this.zLevel = 100.0F; this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F; this.itemRender.zLevel = 100.0F;
GL11.glDisable( GL11.GL_LIGHTING ); GlStateManager.disableLighting();
drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66ff6666 ); drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66ff6666 );
GL11.glEnable( GL11.GL_LIGHTING ); GlStateManager.enableLighting();
this.zLevel = 0.0F; this.zLevel = 0.0F;
this.itemRender.zLevel = 0.0F; this.itemRender.zLevel = 0.0F;
@@ -29,7 +29,6 @@ import java.util.concurrent.TimeUnit;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import org.apache.commons.lang3.time.DurationFormatUtils; import org.apache.commons.lang3.time.DurationFormatUtils;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@@ -31,8 +31,7 @@ import java.util.WeakHashMap;
import com.google.common.collect.HashMultimap; import com.google.common.collect.HashMultimap;
import org.lwjgl.opengl.GL11; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -175,7 +174,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
{ {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj; final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GL11.glColor4f( 1, 1, 1, 1 ); GlStateManager.color( 1, 1, 1, 1 );
final int width = inv.getInventory().getSizeInventory() * 18; final int width = inv.getInventory().getSizeInventory() * 18;
this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 ); this.drawTexturedModalRect( offsetX + 7, offsetY + offset, 7, 139, width, 18 );
} }
@@ -19,8 +19,7 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import org.lwjgl.opengl.GL11; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
@@ -65,7 +64,7 @@ public class GuiVibrationChamber extends AEBaseGui
{ {
final int i1 = this.cvc.getCurrentProgress(); final int i1 = this.cvc.getCurrentProgress();
this.bindTexture( "guis/vibchamber.png" ); this.bindTexture( "guis/vibchamber.png" );
GL11.glColor3f( 1, 1, 1 ); GlStateManager.color( 1, 1, 1 );
final int l = -15; final int l = -15;
final int k = 25; final int k = 25;
this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 ); this.drawTexturedModalRect( k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2 );
@@ -23,10 +23,9 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.lwjgl.opengl.GL11;
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 net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@@ -195,17 +194,17 @@ public class GuiImgButton extends GuiButton implements ITooltip
this.width = 8; this.width = 8;
this.height = 8; this.height = 8;
GL11.glPushMatrix(); GlStateManager.pushMatrix();
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F ); GlStateManager.translate( this.xPosition, this.yPosition, 0.0F );
GL11.glScalef( 0.5f, 0.5f, 0.5f ); GlStateManager.scale( 0.5f, 0.5f, 0.5f );
if( this.enabled ) if( this.enabled )
{ {
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
} }
else else
{ {
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f ); GlStateManager.color( 0.5f, 0.5f, 0.5f, 1.0f );
} }
par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
@@ -218,17 +217,17 @@ public class GuiImgButton extends GuiButton implements ITooltip
this.drawTexturedModalRect( 0, 0, uv_x * 16, uv_y * 16, 16, 16 ); this.drawTexturedModalRect( 0, 0, uv_x * 16, uv_y * 16, 16, 16 );
this.mouseDragged( par1Minecraft, par2, par3 ); this.mouseDragged( par1Minecraft, par2, par3 );
GL11.glPopMatrix(); GlStateManager.popMatrix();
} }
else else
{ {
if( this.enabled ) if( this.enabled )
{ {
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
} }
else else
{ {
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f ); GlStateManager.color( 0.5f, 0.5f, 0.5f, 1.0f );
} }
par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
@@ -242,7 +241,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
this.mouseDragged( par1Minecraft, par2, par3 ); this.mouseDragged( par1Minecraft, par2, par3 );
} }
} }
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
} }
private int getIconIndex() private int getIconIndex()
@@ -19,7 +19,7 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import org.lwjgl.opengl.GL11; import net.minecraft.client.renderer.GlStateManager;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
@@ -40,7 +40,7 @@ public class GuiScrollbar implements IScrollSource
public void draw( final AEBaseGui g ) public void draw( final AEBaseGui g )
{ {
g.bindTexture( "minecraft", "gui/container/creative_inventory/tabs.png" ); g.bindTexture( "minecraft", "gui/container/creative_inventory/tabs.png" );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
if( this.getRange() == 0 ) if( this.getRange() == 0 )
{ {
@@ -19,8 +19,6 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import org.lwjgl.opengl.GL11;
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 net.minecraft.client.renderer.GlStateManager;
@@ -77,7 +75,7 @@ public class GuiTabButton extends GuiButton implements ITooltip
{ {
if( this.visible ) if( this.visible )
{ {
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; this.hovered = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
@@ -21,10 +21,9 @@ package appeng.client.gui.widgets;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.lwjgl.opengl.GL11;
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 net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n; import net.minecraft.util.text.translation.I18n;
@@ -65,7 +64,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip
{ {
final int iconIndex = this.getIconIndex(); final int iconIndex = this.getIconIndex();
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( new ResourceLocation( "appliedenergistics2", "textures/guis/states.png" ) );
this.hovered = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; this.hovered = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
@@ -26,6 +26,7 @@ import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
@@ -60,52 +61,52 @@ public class SpatialSkyRender extends IRenderHandler
if( now - this.cycle > 2000 ) if( now - this.cycle > 2000 )
{ {
this.cycle = now; this.cycle = now;
GL11.glNewList( this.dspList, GL11.GL_COMPILE ); GlStateManager.glNewList( this.dspList, GL11.GL_COMPILE );
this.renderTwinkles(); this.renderTwinkles();
GL11.glEndList(); GlStateManager.glEndList();
} }
float fade = now - this.cycle; float fade = now - this.cycle;
fade /= 1000; fade /= 1000;
fade = 0.15f * ( 1.0f - Math.abs( ( fade - 1.0f ) * ( fade - 1.0f ) ) ); fade = 0.15f * ( 1.0f - Math.abs( ( fade - 1.0f ) * ( fade - 1.0f ) ) );
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); GlStateManager.pushAttrib();
GL11.glDisable( GL11.GL_FOG ); GlStateManager.disableFog();
GL11.glDisable( GL11.GL_ALPHA_TEST ); GlStateManager.disableAlpha();
GL11.glDisable( GL11.GL_BLEND ); GlStateManager.disableBlend();
GL11.glDepthMask( false ); GlStateManager.depthMask( false );
GL11.glColor4f( 0.0f, 0.0f, 0.0f, 1.0f ); GlStateManager.color( 0.0f, 0.0f, 0.0f, 1.0f );
final Tessellator tessellator = Tessellator.getInstance(); final Tessellator tessellator = Tessellator.getInstance();
final VertexBuffer VertexBuffer = tessellator.getBuffer(); final VertexBuffer VertexBuffer = tessellator.getBuffer();
for( int i = 0; i < 6; ++i ) for( int i = 0; i < 6; ++i )
{ {
GL11.glPushMatrix(); GlStateManager.pushMatrix();
if( i == 1 ) if( i == 1 )
{ {
GL11.glRotatef( 90.0F, 1.0F, 0.0F, 0.0F ); GlStateManager.rotate( 90.0F, 1.0F, 0.0F, 0.0F );
} }
if( i == 2 ) if( i == 2 )
{ {
GL11.glRotatef( -90.0F, 1.0F, 0.0F, 0.0F ); GlStateManager.rotate( -90.0F, 1.0F, 0.0F, 0.0F );
} }
if( i == 3 ) if( i == 3 )
{ {
GL11.glRotatef( 180.0F, 1.0F, 0.0F, 0.0F ); GlStateManager.rotate( 180.0F, 1.0F, 0.0F, 0.0F );
} }
if( i == 4 ) if( i == 4 )
{ {
GL11.glRotatef( 90.0F, 0.0F, 0.0F, 1.0F ); GlStateManager.rotate( 90.0F, 0.0F, 0.0F, 1.0F );
} }
if( i == 5 ) if( i == 5 )
{ {
GL11.glRotatef( -90.0F, 0.0F, 0.0F, 1.0F ); GlStateManager.rotate( -90.0F, 0.0F, 0.0F, 1.0F );
} }
VertexBuffer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM ); VertexBuffer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM );
@@ -114,32 +115,29 @@ public class SpatialSkyRender extends IRenderHandler
VertexBuffer.color( 0f, 0f, 0f, 1f ).pos( 100.0D, -100.0D, 100.0D ).tex( 16.0D, 16.0D ).endVertex(); VertexBuffer.color( 0f, 0f, 0f, 1f ).pos( 100.0D, -100.0D, 100.0D ).tex( 16.0D, 16.0D ).endVertex();
VertexBuffer.color( 0f, 0f, 0f, 1f ).pos( 100.0D, -100.0D, -100.0D ).tex( 16.0D, 0.0D ).endVertex(); VertexBuffer.color( 0f, 0f, 0f, 1f ).pos( 100.0D, -100.0D, -100.0D ).tex( 16.0D, 0.0D ).endVertex();
tessellator.draw(); tessellator.draw();
GL11.glPopMatrix(); GlStateManager.popMatrix();
} }
GL11.glDepthMask( true ); GlStateManager.depthMask( true );
if( fade > 0.0f ) if( fade > 0.0f )
{ {
GL11.glDisable( GL11.GL_FOG ); GlStateManager.disableFog();
GL11.glDisable( GL11.GL_ALPHA_TEST ); GlStateManager.disableAlpha();
GL11.glEnable( GL11.GL_BLEND ); GlStateManager.enableBlend();
GL11.glDepthMask( false ); GlStateManager.disableTexture2D();
GL11.glEnable( GL11.GL_FOG ); GlStateManager.depthMask( false );
GL11.glDisable( GL11.GL_FOG );
GL11.glDisable( GL11.GL_ALPHA_TEST );
GL11.glDisable( GL11.GL_TEXTURE_2D );
OpenGlHelper.glBlendFunc( 770, 771, 1, 0 ); OpenGlHelper.glBlendFunc( 770, 771, 1, 0 );
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GL11.glDepthMask( false ); GlStateManager.depthMask( false );
GL11.glColor4f( fade, fade, fade, 1.0f ); GlStateManager.color( fade, fade, fade, 1.0f );
GL11.glCallList( this.dspList ); GlStateManager.callList( this.dspList );
} }
GL11.glPopAttrib(); GlStateManager.popAttrib();
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
} }
private void renderTwinkles() private void renderTwinkles()
@@ -19,8 +19,6 @@
package appeng.client.render; package appeng.client.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -61,12 +59,12 @@ public class StackSizeRenderer
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.disableDepth(); GlStateManager.disableDepth();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
GL11.glPushMatrix(); GlStateManager.pushMatrix();
GL11.glScaled( scaleFactor, scaleFactor, scaleFactor ); GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( craftLabelText ) * scaleFactor ) * inverseScaleFactor ); final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( craftLabelText ) * scaleFactor ) * inverseScaleFactor );
final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor ); final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
fontRenderer.drawStringWithShadow( craftLabelText, X, Y, 16777215 ); fontRenderer.drawStringWithShadow( craftLabelText, X, Y, 16777215 );
GL11.glPopMatrix(); GlStateManager.popMatrix();
GlStateManager.enableLighting(); GlStateManager.enableLighting();
GlStateManager.enableDepth(); GlStateManager.enableDepth();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
@@ -80,12 +78,12 @@ public class StackSizeRenderer
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.disableDepth(); GlStateManager.disableDepth();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
GL11.glPushMatrix(); GlStateManager.pushMatrix();
GL11.glScaled( scaleFactor, scaleFactor, scaleFactor ); GlStateManager.scale( scaleFactor, scaleFactor, scaleFactor );
final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor ); final int X = (int) ( ( (float) xPos + offset + 16.0f - fontRenderer.getStringWidth( stackSize ) * scaleFactor ) * inverseScaleFactor );
final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor ); final int Y = (int) ( ( (float) yPos + offset + 16.0f - 7.0f * scaleFactor ) * inverseScaleFactor );
fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 ); fontRenderer.drawStringWithShadow( stackSize, X, Y, 16777215 );
GL11.glPopMatrix(); GlStateManager.popMatrix();
GlStateManager.enableLighting(); GlStateManager.enableLighting();
GlStateManager.enableDepth(); GlStateManager.enableDepth();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
@@ -19,8 +19,6 @@
package appeng.client.render; package appeng.client.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@@ -48,7 +46,7 @@ public class TesrRenderHelper
*/ */
public static void moveToFace( EnumFacing face ) public static void moveToFace( EnumFacing face )
{ {
GL11.glTranslated( face.getFrontOffsetX() * 0.50, face.getFrontOffsetY() * 0.50, face.getFrontOffsetZ() * 0.50 ); GlStateManager.translate( face.getFrontOffsetX() * 0.50, face.getFrontOffsetY() * 0.50, face.getFrontOffsetZ() * 0.50 );
} }
/** /**
@@ -61,34 +59,34 @@ public class TesrRenderHelper
switch( face ) switch( face )
{ {
case UP: case UP:
GL11.glScalef( 1.0f, -1.0f, 1.0f ); GlStateManager.scale( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f ); GlStateManager.rotate( 90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( spin * 90.0F, 0, 0, 1 ); GlStateManager.rotate( spin * 90.0F, 0, 0, 1 );
break; break;
case DOWN: case DOWN:
GL11.glScalef( 1.0f, -1.0f, 1.0f ); GlStateManager.scale( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f ); GlStateManager.rotate( -90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( spin * -90.0F, 0, 0, 1 ); GlStateManager.rotate( spin * -90.0F, 0, 0, 1 );
break; break;
case EAST: case EAST:
GL11.glScalef( -1.0f, -1.0f, -1.0f ); GlStateManager.scale( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f ); GlStateManager.rotate( -90.0f, 0.0f, 1.0f, 0.0f );
break; break;
case WEST: case WEST:
GL11.glScalef( -1.0f, -1.0f, -1.0f ); GlStateManager.scale( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f ); GlStateManager.rotate( 90.0f, 0.0f, 1.0f, 0.0f );
break; break;
case NORTH: case NORTH:
GL11.glScalef( -1.0f, -1.0f, -1.0f ); GlStateManager.scale( -1.0f, -1.0f, -1.0f );
break; break;
case SOUTH: case SOUTH:
GL11.glScalef( -1.0f, -1.0f, -1.0f ); GlStateManager.scale( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f ); GlStateManager.rotate( 180.0f, 0.0f, 1.0f, 0.0f );
break; break;
default: default:
@@ -137,9 +135,9 @@ public class TesrRenderHelper
// Render the item count // Render the item count
final FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; final FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
final int width = fr.getStringWidth( renderedStackSize ); final int width = fr.getStringWidth( renderedStackSize );
GL11.glTranslatef( 0.0f, spacing, 0 ); GlStateManager.translate( 0.0f, spacing, 0 );
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f ); GlStateManager.scale( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
GL11.glTranslatef( -0.5f * width, 0.0f, 0.5f ); GlStateManager.translate( -0.5f * width, 0.0f, 0.5f );
fr.drawString( renderedStackSize, 0, 0, 0 ); fr.drawString( renderedStackSize, 0, 0, 0 );
} }
@@ -19,8 +19,6 @@
package appeng.client.render.crafting; package appeng.client.render.crafting;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@@ -53,7 +51,7 @@ public class CraftingMonitorTESR extends TileEntitySpecialRenderer<TileCraftingM
if( jobProgress != null ) if( jobProgress != null )
{ {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 ); GlStateManager.translate( x + 0.5, y + 0.5, z + 0.5 );
TesrRenderHelper.moveToFace( facing ); TesrRenderHelper.moveToFace( facing );
TesrRenderHelper.rotateToFace( facing, (byte) 0 ); TesrRenderHelper.rotateToFace( facing, (byte) 0 );
@@ -19,9 +19,8 @@
package appeng.entity; package appeng.entity;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderEntityItem; import net.minecraft.client.renderer.entity.RenderEntityItem;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@@ -48,15 +47,15 @@ public class RenderFloatingItem extends RenderEntityItem
final EntityFloatingItem efi = (EntityFloatingItem) entityItem; final EntityFloatingItem efi = (EntityFloatingItem) entityItem;
if( efi.getProgress() > 0.0 ) if( efi.getProgress() > 0.0 )
{ {
GL11.glPushMatrix(); GlStateManager.pushMatrix();
if( !( efi.getEntityItem().getItem() instanceof ItemBlock ) ) if( !( efi.getEntityItem().getItem() instanceof ItemBlock ) )
{ {
GL11.glTranslatef( 0, -0.15f, 0 ); GlStateManager.translate( 0, -0.15f, 0 );
} }
super.doRender( efi, x, y, z, yaw, partialTick ); super.doRender( efi, x, y, z, yaw, partialTick );
GL11.glPopMatrix(); GlStateManager.popMatrix();
} }
} }
} }
@@ -19,8 +19,6 @@
package appeng.entity; package appeng.entity;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@@ -74,10 +72,10 @@ public class RenderTinyTNTPrimed extends Render
f2 *= f2; f2 *= f2;
f2 *= f2; f2 *= f2;
final float f3 = 1.0F + f2 * 0.3F; final float f3 = 1.0F + f2 * 0.3F;
GL11.glScalef( f3, f3, f3 ); GlStateManager.scale( f3, f3, f3 );
} }
GL11.glScalef( 0.5f, 0.5f, 0.5f ); GlStateManager.scale( 0.5f, 0.5f, 0.5f );
f2 = ( 1.0F - ( tnt.getFuse() - life + 1.0F ) / 100.0F ) * 0.8F; f2 = ( 1.0F - ( tnt.getFuse() - life + 1.0F ) / 100.0F ) * 0.8F;
this.bindEntityTexture( tnt ); this.bindEntityTexture( tnt );
GlStateManager.translate( -0.5F, -0.5F, 0.5F ); GlStateManager.translate( -0.5F, -0.5F, 0.5F );
@@ -22,8 +22,6 @@ package appeng.parts.reporting;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.lwjgl.opengl.GL11;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@@ -252,7 +250,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
} }
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GL11.glTranslated( x + 0.5, y + 0.5, z + 0.5 ); GlStateManager.translate( x + 0.5, y + 0.5, z + 0.5 );
EnumFacing facing = this.getSide().getFacing(); EnumFacing facing = this.getSide().getFacing();