Skip to content

Commit 00cc226

Browse files
committed
Fixed GL11 reference to GlStateManager
1 parent a064d01 commit 00cc226

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

src/main/java/stellarapi/feature/gui/overlay/OverlayContainer.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.google.common.collect.ImmutableList;
66

77
import net.minecraft.client.gui.ScaledResolution;
8+
import net.minecraft.client.renderer.GlStateManager;
89
import stellarapi.api.gui.overlay.EnumOverlayMode;
910
import stellarapi.api.gui.overlay.IOverlayElement;
1011
import stellarapi.api.gui.overlay.IRawOverlayElement;
@@ -159,19 +160,19 @@ public void render(int mouseX, int mouseY, float partialTicks) {
159160
scaledMouseX -= animationOffsetX;
160161
scaledMouseY -= animationOffsetY;
161162

162-
GL11.glPushMatrix();
163-
GL11.glTranslatef((pos.getHorizontalPos().getOffset(this.width, width) + animationOffsetX),
163+
GlStateManager.pushMatrix();
164+
GlStateManager.translate((pos.getHorizontalPos().getOffset(this.width, width) + animationOffsetX),
164165
(pos.getVerticalPos().getOffset(this.height, height) + animationOffsetY), 0.0f);
165166

166167
element.render(scaledMouseX, scaledMouseY, partialTicks);
167-
GL11.glPopMatrix();
168+
GlStateManager.popMatrix();
168169

169170
if (delegate.getHandler() != null)
170171
delegate.getHandler().render(mouseX, mouseY, partialTicks);
171172
}
172173

173174
// Refreshes color for next elements to be rendered correctly.
174-
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
175+
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
175176
}
176177

177178
public int getWidth() {

src/main/java/stellarapi/feature/gui/overlay/configurator/OverlayConfiguratorHandler.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import net.minecraft.client.Minecraft;
88
import net.minecraft.client.gui.Gui;
9+
import net.minecraft.client.renderer.GlStateManager;
910
import stellarapi.api.gui.overlay.EnumOverlayMode;
1011
import stellarapi.api.gui.overlay.IOverlayManager;
1112
import stellarapi.api.gui.overlay.IRawHandler;
@@ -153,10 +154,10 @@ public void render(int mouseX, int mouseY, float partialTicks) {
153154
possible ? 0xff00ff00 : 0xffff0000);
154155
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
155156

156-
GL11.glDisable(GL11.GL_ALPHA_TEST);
157+
GlStateManager.disableAlpha();
157158
Gui.drawRect(offsetX + 1, offsetY + 1, offsetX + elementWidth - 1, offsetY + elementHeight - 1,
158159
possible ? 0x0f00ff00 : 0x0fff0000);
159-
GL11.glEnable(GL11.GL_ALPHA_TEST);
160+
GlStateManager.enableAlpha();
160161
} else if (this.eventButton == 1) {
161162
boolean contain = mainOverlay.doesContain(this.currentSelected);
162163

@@ -165,10 +166,10 @@ public void render(int mouseX, int mouseY, float partialTicks) {
165166
!contain ? 0xff0066ff : 0xffff0000);
166167
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
167168

168-
GL11.glDisable(GL11.GL_ALPHA_TEST);
169+
GlStateManager.disableAlpha();
169170
Gui.drawRect(offsetX + 3, offsetY + 3, offsetX + elementWidth - 3, offsetY + elementHeight - 3,
170171
!contain ? 0x0f0099ff : 0x0fff0000);
171-
GL11.glEnable(GL11.GL_ALPHA_TEST);
172+
GlStateManager.enableAlpha();
172173

173174
if (!contain)
174175
Gui.drawRect(offsetX + elementWidth / 2 - 1, offsetY + elementHeight / 2 - 8,
@@ -199,9 +200,9 @@ public void render(int mouseX, int mouseY, float partialTicks) {
199200
Gui.drawRect(offsetX + 3, offsetY + 3, offsetX + elementWidth - 3, offsetY + elementHeight - 3, 0xff0000ff);
200201
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
201202

202-
GL11.glDisable(GL11.GL_ALPHA_TEST);
203+
GlStateManager.disableAlpha();
203204
Gui.drawRect(offsetX + 3, offsetY + 3, offsetX + elementWidth - 3, offsetY + elementHeight - 3, 0x0f0000ff);
204-
GL11.glEnable(GL11.GL_ALPHA_TEST);
205+
GlStateManager.enableAlpha();
205206
}
206207
}
207208

src/main/java/stellarapi/lib/gui/GuiRenderer.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import net.minecraft.client.Minecraft;
1111
import net.minecraft.client.renderer.BufferBuilder;
12+
import net.minecraft.client.renderer.GlStateManager;
1213
import net.minecraft.client.renderer.Tessellator;
1314
import net.minecraft.client.renderer.texture.TextureManager;
1415
import stellarapi.StellarAPI;
@@ -108,8 +109,8 @@ public void render(String info, IRectangleBound totalBound, IRectangleBound clip
108109
float centerX = totalBound.getMainX(0.5f);
109110
float centerY = totalBound.getMainY(0.5f);
110111

111-
GL11.glPushMatrix();
112-
GL11.glTranslatef(centerX, centerY, 0.0f);
112+
GlStateManager.pushMatrix();
113+
GlStateManager.translate(centerX, centerY, 0.0f);
113114

114115
for (IMatrixTransformation trans : this.transformation)
115116
trans.doTransform();
@@ -128,7 +129,7 @@ public void render(String info, IRectangleBound totalBound, IRectangleBound clip
128129

129130
currentModel.renderModel(info, this.temp, this.tempClip, this.tessellator, this.worldRenderer,
130131
this.textureManager, this.currentColor);
131-
GL11.glPopMatrix();
132+
GlStateManager.popMatrix();
132133

133134
if (this.matrixPushedTillNextRender) {
134135
innerTrans.clear();
@@ -148,7 +149,7 @@ public void endRender() {
148149
transformation.clear();
149150
innerTrans.clear();
150151
this.currentModel = null;
151-
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
152+
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
152153
}
153154

154155
private interface IMatrixTransformation {
@@ -166,7 +167,7 @@ public Translation(float x, float y) {
166167

167168
@Override
168169
public void doTransform() {
169-
GL11.glTranslatef(x, y, 0.0f);
170+
GlStateManager.translate(x, y, 0.0f);
170171
}
171172
}
172173

@@ -181,7 +182,7 @@ public Scale(float x, float y) {
181182

182183
@Override
183184
public void doTransform() {
184-
GL11.glScalef(x, y, 1.0f);
185+
GlStateManager.scale(x, y, 1.0f);
185186
}
186187
}
187188

@@ -198,7 +199,7 @@ public Rotation(float angle, float x, float y, float z) {
198199

199200
@Override
200201
public void doTransform() {
201-
GL11.glRotatef(angle, x, y, z);
202+
GlStateManager.rotate(angle, x, y, z);
202203
}
203204
}
204205

@@ -214,6 +215,6 @@ public void preRender(float partialTicks) {
214215

215216
@Override
216217
public void postRender(float partialTicks) {
217-
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
218+
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
218219
}
219220
}

src/main/java/stellarapi/lib/gui/model/font/WrappedFontRenderer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package stellarapi.lib.gui.model.font;
22

3-
import org.lwjgl.opengl.GL11;
4-
53
import net.minecraft.client.Minecraft;
64
import net.minecraft.client.gui.FontRenderer;
5+
import net.minecraft.client.renderer.GlStateManager;
76
import net.minecraft.util.ResourceLocation;
87
import net.minecraft.util.text.TextFormatting;
98

@@ -69,7 +68,7 @@ public int drawString(String str, float posX, float posY, int color, boolean dro
6968

7069
@Override
7170
protected void setColor(float r, float g, float b, float a) {
72-
GL11.glColor4f(this.redWrapped * r, this.greenWrapped * g, this.blueWrapped * b, this.alphaWrapped * a);
71+
GlStateManager.color(this.redWrapped * r, this.greenWrapped * g, this.blueWrapped * b, this.alphaWrapped * a);
7372
}
7473

7574
}

0 commit comments

Comments
 (0)