mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 21:02:15 +00:00
Use GLSM instead of relying on the redirector
This commit is contained in:
1 parent
70cfa2ae90
commit
5f61e387fb
84 files changed
+628
-1140
No files matched your search
@@ -537,7 +537,7 @@ public class OpenGLDebugging {
|
||||
|
||||
// Check per-unit texture state
|
||||
for (int i = 0; i < textureUnits.textureMatricies.length; i++) {
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE0 + i);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0 + i);
|
||||
|
||||
// Check GL_TEXTURE_2D enabled
|
||||
final boolean cachedEnabled = textureUnits.getTextureUnitStates(i).isEnabled();
|
||||
@@ -565,7 +565,7 @@ public class OpenGLDebugging {
|
||||
}
|
||||
}
|
||||
}
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE0 + currentActiveTexture);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0 + currentActiveTexture);
|
||||
|
||||
// Add stack trace if requested
|
||||
if (mismatch && logStacktrace) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.joml.Matrix4f;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -94,12 +93,12 @@ public class BatchingFontRenderer {
|
||||
|
||||
//noinspection deprecation
|
||||
fontShaderId = FontAAShader.getProgram().getProgramId();
|
||||
AAMode = GL20.glGetUniformLocation(fontShaderId, "aaMode");
|
||||
AAStrength = GL20.glGetUniformLocation(fontShaderId, "strength");
|
||||
mvpMatrixLocation = GL20.glGetUniformLocation(fontShaderId, "u_MVPMatrix");
|
||||
AAMode = GLStateManager.glGetUniformLocation(fontShaderId, "aaMode");
|
||||
AAStrength = GLStateManager.glGetUniformLocation(fontShaderId, "strength");
|
||||
mvpMatrixLocation = GLStateManager.glGetUniformLocation(fontShaderId, "u_MVPMatrix");
|
||||
if (ebo == null) {
|
||||
ebo = new IndexBuffer();
|
||||
vbo = GL15.glGenBuffers();
|
||||
vbo = GLStateManager.glGenBuffers();
|
||||
allocateBuffers();
|
||||
}
|
||||
}
|
||||
@@ -323,7 +322,7 @@ public class BatchingFontRenderer {
|
||||
}
|
||||
|
||||
// Upload first (to reduce stalls)
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
vertexData.limit(vertexDataPos);
|
||||
vboCapacity = StreamingUploader.upload(vertexData, vboCapacity);
|
||||
|
||||
@@ -346,42 +345,42 @@ public class BatchingFontRenderer {
|
||||
GLStateManager.glUseProgram(fontShaderId);
|
||||
if (FontConfig.fontAAMode != fontAAModeLast) {
|
||||
fontAAModeLast = FontConfig.fontAAMode;
|
||||
GL20.glUniform1i(AAMode, FontConfig.fontAAMode);
|
||||
GLStateManager.glUniform1i(AAMode, FontConfig.fontAAMode);
|
||||
}
|
||||
if (FontConfig.fontAAStrength != fontAAStrengthLast) {
|
||||
fontAAStrengthLast = FontConfig.fontAAStrength;
|
||||
GL20.glUniform1f(AAStrength, FontConfig.fontAAStrength / 120.f);
|
||||
GLStateManager.glUniform1f(AAStrength, FontConfig.fontAAStrength / 120.f);
|
||||
}
|
||||
try (MemoryStack stack = stackPush()) {
|
||||
final FloatBuffer mvpBuf = stack.mallocFloat(16);
|
||||
GLStateManager.getProjectionMatrix().mul(GLStateManager.getModelViewMatrix(), scratchMvp);
|
||||
scratchMvp.get(mvpBuf);
|
||||
GL20.glUniformMatrix4(mvpMatrixLocation, false, mvpBuf);
|
||||
GLStateManager.glUniformMatrix4(mvpMatrixLocation, false, mvpBuf);
|
||||
}
|
||||
|
||||
if (fontVAO == 0) {
|
||||
fontVAO = GL30.glGenVertexArrays();
|
||||
fontVAO = GLStateManager.glGenVertexArrays();
|
||||
|
||||
GLStateManager.glBindVertexArray(fontVAO);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
|
||||
ebo.bind();
|
||||
|
||||
// position
|
||||
GL20.glVertexAttribPointer(0, 2, GL11.GL_FLOAT, false, VERTEX_SIZE, 0);
|
||||
GL20.glEnableVertexAttribArray(0);
|
||||
GLStateManager.glVertexAttribPointer(0, 2, GL11.GL_FLOAT, false, VERTEX_SIZE, 0);
|
||||
GLStateManager.glEnableVertexAttribArray(0);
|
||||
|
||||
// texcoords
|
||||
GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, VERTEX_SIZE, 8);
|
||||
GL20.glEnableVertexAttribArray(1);
|
||||
GLStateManager.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, VERTEX_SIZE, 8);
|
||||
GLStateManager.glEnableVertexAttribArray(1);
|
||||
|
||||
// color
|
||||
GL20.glVertexAttribPointer(2, 4, GL11.GL_UNSIGNED_BYTE, true, VERTEX_SIZE, 16);
|
||||
GL20.glEnableVertexAttribArray(2);
|
||||
GLStateManager.glVertexAttribPointer(2, 4, GL11.GL_UNSIGNED_BYTE, true, VERTEX_SIZE, 16);
|
||||
GLStateManager.glEnableVertexAttribArray(2);
|
||||
|
||||
// tex bounds
|
||||
GL20.glVertexAttribPointer(3, 4, GL11.GL_FLOAT, false, VERTEX_SIZE, 20);
|
||||
GL20.glEnableVertexAttribArray(3);
|
||||
GLStateManager.glVertexAttribPointer(3, 4, GL11.GL_FLOAT, false, VERTEX_SIZE, 20);
|
||||
GLStateManager.glEnableVertexAttribArray(3);
|
||||
}
|
||||
|
||||
GLStateManager.glBindVertexArray(fontVAO);
|
||||
@@ -403,13 +402,13 @@ public class BatchingFontRenderer {
|
||||
}
|
||||
lastTexture = cmd.texture;
|
||||
}
|
||||
GL11.glDrawElements(GL11.GL_TRIANGLES, cmd.idxCount, GL11.GL_UNSIGNED_SHORT, (long) cmd.startVtx * 2L);
|
||||
GLStateManager.glDrawElements(GL11.GL_TRIANGLES, cmd.idxCount, GL11.GL_UNSIGNED_SHORT, (long) cmd.startVtx * 2L);
|
||||
}
|
||||
|
||||
|
||||
GLStateManager.glUseProgram(prevProgram);
|
||||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
|
||||
if (isTextureEnabledBefore) {
|
||||
|
||||
+24
-27
@@ -6,9 +6,6 @@ import com.mitchej123.glsm.GLStateManagerService;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
@@ -38,81 +35,81 @@ public class AngelicaGLStateManagerService implements GLStateManagerService {
|
||||
|
||||
@Override
|
||||
public String glGetString(int pname) {
|
||||
return GL11.glGetString(pname);
|
||||
return GLStateManager.glGetString(pname);
|
||||
}
|
||||
|
||||
// ===================== FRAMEBUFFER OPERATIONS =====================
|
||||
|
||||
@Override
|
||||
public int glGenFramebuffers() {
|
||||
return GL30.glGenFramebuffers();
|
||||
return GLStateManager.glGenFramebuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteFramebuffers(int framebuffer) {
|
||||
GL30.glDeleteFramebuffers(framebuffer);
|
||||
GLStateManager.glDeleteFramebuffers(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindFramebuffer(int target, int framebuffer) {
|
||||
GL30.glBindFramebuffer(target, framebuffer);
|
||||
GLStateManager.glBindFramebuffer(target, framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glCheckFramebufferStatus(int target) {
|
||||
return GL30.glCheckFramebufferStatus(target);
|
||||
return GLStateManager.glCheckFramebufferStatus(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level) {
|
||||
GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
GLStateManager.glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
// ===================== SHADER OPERATIONS =====================
|
||||
|
||||
@Override
|
||||
public int glCreateShader(int type) {
|
||||
return GL20.glCreateShader(type);
|
||||
return GLStateManager.glCreateShader(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glCompileShader(int shader) {
|
||||
GL20.glCompileShader(shader);
|
||||
GLStateManager.glCompileShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glGetShaderi(int shader, int pname) {
|
||||
return GL20.glGetShaderi(shader, pname);
|
||||
return GLStateManager.glGetShaderi(shader, pname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String glGetShaderInfoLog(int shader, int maxLength) {
|
||||
return GL20.glGetShaderInfoLog(shader, maxLength);
|
||||
return GLStateManager.glGetShaderInfoLog(shader, maxLength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteShader(int shader) {
|
||||
GL20.glDeleteShader(shader);
|
||||
GLStateManager.glDeleteShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glCreateProgram() {
|
||||
return GL20.glCreateProgram();
|
||||
return GLStateManager.glCreateProgram();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glAttachShader(int program, int shader) {
|
||||
GL20.glAttachShader(program, shader);
|
||||
GLStateManager.glAttachShader(program, shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glLinkProgram(int program) {
|
||||
GL20.glLinkProgram(program);
|
||||
GLStateManager.glLinkProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glGetProgrami(int program, int pname) {
|
||||
return GL20.glGetProgrami(program, pname);
|
||||
return GLStateManager.glGetProgrami(program, pname);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,29 +119,29 @@ public class AngelicaGLStateManagerService implements GLStateManagerService {
|
||||
|
||||
@Override
|
||||
public void glDeleteProgram(int program) {
|
||||
GL20.glDeleteProgram(program);
|
||||
GLStateManager.glDeleteProgram(program);
|
||||
}
|
||||
|
||||
// ===================== UNIFORM/ATTRIBUTE OPERATIONS =====================
|
||||
|
||||
@Override
|
||||
public int glGetUniformLocation(int program, CharSequence name) {
|
||||
return GL20.glGetUniformLocation(program, name);
|
||||
return GLStateManager.glGetUniformLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform1i(int location, int value) {
|
||||
GL20.glUniform1i(location, value);
|
||||
GLStateManager.glUniform1i(location, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glGetAttribLocation(int program, CharSequence name) {
|
||||
return GL20.glGetAttribLocation(program, name);
|
||||
return GLStateManager.glGetAttribLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindAttribLocation(int program, int index, CharSequence name) {
|
||||
GL20.glBindAttribLocation(program, index, name);
|
||||
GLStateManager.glBindAttribLocation(program, index, name);
|
||||
}
|
||||
|
||||
// ===================== VAO OPERATIONS =====================
|
||||
@@ -168,7 +165,7 @@ public class AngelicaGLStateManagerService implements GLStateManagerService {
|
||||
|
||||
@Override
|
||||
public int glGenBuffers() {
|
||||
return GL15.glGenBuffers();
|
||||
return GLStateManager.glGenBuffers();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,13 +182,13 @@ public class AngelicaGLStateManagerService implements GLStateManagerService {
|
||||
|
||||
@Override
|
||||
public int glGenTextures() {
|
||||
return GL11.glGenTextures();
|
||||
return GLStateManager.glGenTextures();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGenTextures(int[] textures) {
|
||||
final IntBuffer buffer = getIntArrayBuffer(textures.length);
|
||||
GL11.glGenTextures(buffer);
|
||||
GLStateManager.glGenTextures(buffer);
|
||||
buffer.get(textures);
|
||||
}
|
||||
|
||||
@@ -225,7 +222,7 @@ public class AngelicaGLStateManagerService implements GLStateManagerService {
|
||||
|
||||
@Override
|
||||
public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) {
|
||||
GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
GLStateManager.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.gtnewhorizons.angelica.client.rendering;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import org.embeddedt.embeddium.impl.gl.shader.uniform.GlUniform;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
public class GlUniformFloat2v extends GlUniform<float[]> {
|
||||
|
||||
@@ -14,10 +14,10 @@ public class GlUniformFloat2v extends GlUniform<float[]> {
|
||||
if (value.length != 2) {
|
||||
throw new IllegalArgumentException("value.length != 2");
|
||||
}
|
||||
GL20.glUniform2f(this.index, value[0], value[1]);
|
||||
GLStateManager.glUniform2f(this.index, value[0], value[1]);
|
||||
}
|
||||
|
||||
public void set(float x, float y) {
|
||||
GL20.glUniform2f(this.index, x, y);
|
||||
GLStateManager.glUniform2f(this.index, x, y);
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -15,7 +15,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@@ -236,7 +235,7 @@ public class TessellatorStreamingDrawer {
|
||||
if (drawMode == GL11.GL_QUADS) {
|
||||
QuadConverter.drawQuadsAsTriangles(firstVertex, vertexCount);
|
||||
} else {
|
||||
GL11.glDrawArrays(drawMode, firstVertex, vertexCount);
|
||||
GLStateManager.glDrawArrays(drawMode, firstVertex, vertexCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,20 +259,20 @@ public class TessellatorStreamingDrawer {
|
||||
if (orphanVAOs[flags] == 0) {
|
||||
orphanBuffers[flags] = new OrphanStreamingBuffer();
|
||||
|
||||
orphanVAOs[flags] = GL30.glGenVertexArrays();
|
||||
orphanVAOs[flags] = GLStateManager.glGenVertexArrays();
|
||||
GLStateManager.glBindVertexArray(orphanVAOs[flags]);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, orphanBuffers[flags].getBufferId());
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, orphanBuffers[flags].getBufferId());
|
||||
format.setupBufferState(0L);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
}
|
||||
|
||||
if (persistentBuffer != null && persistentVAOs[flags] == 0) {
|
||||
persistentVAOs[flags] = GL30.glGenVertexArrays();
|
||||
persistentVAOs[flags] = GLStateManager.glGenVertexArrays();
|
||||
GLStateManager.glBindVertexArray(persistentVAOs[flags]);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, persistentBuffer.getBufferId());
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, persistentBuffer.getBufferId());
|
||||
format.setupBufferState(0L);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ public class DriverCompatabilityCheck {
|
||||
* Should be called after GL context is created and GLStateManager is initialized.
|
||||
*/
|
||||
public static void checkDriverCompatibility() {
|
||||
final String vendor = GL11.glGetString(GL11.GL_VENDOR);
|
||||
final String renderer = GL11.glGetString(GL11.GL_RENDERER);
|
||||
final String version = GL11.glGetString(GL11.GL_VERSION);
|
||||
final String vendor = GLStateManager.glGetString(GL11.GL_VENDOR);
|
||||
final String renderer = GLStateManager.glGetString(GL11.GL_RENDERER);
|
||||
final String version = GLStateManager.glGetString(GL11.GL_VERSION);
|
||||
|
||||
LOGGER.info("OpenGL Vendor: {}", vendor);
|
||||
LOGGER.info("OpenGL Renderer: {}", renderer);
|
||||
@@ -50,6 +50,6 @@ public class DriverCompatabilityCheck {
|
||||
}
|
||||
|
||||
LOGGER.info("Enabling workaround for NVIDIA threaded optimizations");
|
||||
GL11.glEnable(ARBDebugOutput.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
GLStateManager.glEnable(ARBDebugOutput.GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import java.nio.IntBuffer;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.Iris;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -54,7 +55,7 @@ public class NativeImage extends BufferedImage {
|
||||
|
||||
public void downloadTexture(int level, boolean bl) {
|
||||
// this.checkAllocated();
|
||||
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, format.components);
|
||||
GLStateManager.glPixelStorei(GL11.GL_PACK_ALIGNMENT, format.components);
|
||||
// GlStateManager._getTexImage(3553, level, format.glFormat, GL11.GL_UNSIGNED_BYTE, this.pixels);
|
||||
|
||||
// final int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
|
||||
@@ -63,7 +64,7 @@ public class NativeImage extends BufferedImage {
|
||||
final IntBuffer buffer = MemoryUtilities.memAllocInt(size);
|
||||
|
||||
try {
|
||||
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, format.glFormat, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
|
||||
GLStateManager.glGetTexImage(GL11.GL_TEXTURE_2D, level, format.glFormat, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
|
||||
|
||||
int[] data = new int[size];
|
||||
buffer.get(data);
|
||||
|
||||
@@ -9,25 +9,16 @@ import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryStack.stackPush;
|
||||
import static com.gtnewhorizons.angelica.glsm.GLStateManager.glBindBuffer;
|
||||
import static org.lwjgl.opengl.GL11.GL_FLOAT;
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_TRIANGLE_STRIP;
|
||||
import static org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER;
|
||||
import static org.lwjgl.opengl.GL15.GL_STATIC_DRAW;
|
||||
import static org.lwjgl.opengl.GL15.glBufferData;
|
||||
import static org.lwjgl.opengl.GL15.glGenBuffers;
|
||||
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
|
||||
import static org.lwjgl.opengl.GL20.glUniform1;
|
||||
import static org.lwjgl.opengl.GL20.glUniform1f;
|
||||
import static org.lwjgl.opengl.GL20.glUniform1i;
|
||||
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
|
||||
|
||||
public abstract class F3Graph {
|
||||
private static final int NUM_SAMPLES = 240;
|
||||
@@ -119,11 +110,11 @@ public abstract class F3Graph {
|
||||
final int uPxPerNs = shader.getUniformLocation("pxPerNs");
|
||||
final int uLeft = shader.getUniformLocation("left");
|
||||
|
||||
vao = GL30.glGenVertexArrays();
|
||||
vao = GLStateManager.glGenVertexArrays();
|
||||
GLStateManager.glBindVertexArray(vao);
|
||||
|
||||
vertBuf = glGenBuffers();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertBuf);
|
||||
vertBuf = GLStateManager.glGenBuffers();
|
||||
GLStateManager.glBindBuffer(GL_ARRAY_BUFFER, vertBuf);
|
||||
try (final MemoryStack stack = stackPush()) {
|
||||
final FloatBuffer vertices = stack.mallocFloat(VERT_COUNT * VERT_FLOATS);
|
||||
// Since we use a triangle strip, we only need 4 vertices. The quad extends to the top of the screen so spikes
|
||||
@@ -136,27 +127,27 @@ public abstract class F3Graph {
|
||||
});
|
||||
vertices.rewind();
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
|
||||
GLStateManager.glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
// Configure vertex attribute in the VAO
|
||||
glVertexAttribPointer(aPos, VERT_FLOATS, GL_FLOAT, false, VERT_FLOATS * 4, 0);
|
||||
glEnableVertexAttribArray(aPos);
|
||||
GLStateManager.glVertexAttribPointer(aPos, VERT_FLOATS, GL_FLOAT, false, VERT_FLOATS * 4, 0);
|
||||
GLStateManager.glEnableVertexAttribArray(aPos);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
final ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
// Load initial value for uniforms
|
||||
glUniform1f(uFBWidth, mc.displayWidth);
|
||||
glUniform1f(uFBHeight, mc.displayHeight);
|
||||
glUniform1f(uScaleFactor, sr.getScaleFactor());
|
||||
glUniform1i(uHeadIdx, samplesHead);
|
||||
glUniform1(uSamples, sampleBuf);
|
||||
glUniform1f(uPxPerNs, pxPerNs);
|
||||
glUniform1i(uLeft, left ? 1 : 0); // this is how you load bool uniforms
|
||||
GLStateManager.glUniform1f(uFBWidth, mc.displayWidth);
|
||||
GLStateManager.glUniform1f(uFBHeight, mc.displayHeight);
|
||||
GLStateManager.glUniform1f(uScaleFactor, sr.getScaleFactor());
|
||||
GLStateManager.glUniform1i(uHeadIdx, samplesHead);
|
||||
GLStateManager.glUniform1(uSamples, sampleBuf);
|
||||
GLStateManager.glUniform1f(uPxPerNs, pxPerNs);
|
||||
GLStateManager.glUniform1i(uLeft, left ? 1 : 0); // this is how you load bool uniforms
|
||||
|
||||
ShaderProgram.clear();
|
||||
}
|
||||
@@ -205,11 +196,11 @@ public abstract class F3Graph {
|
||||
shader.use();
|
||||
|
||||
// Load uniforms
|
||||
glUniform1f(uFBWidth, mc.displayWidth);
|
||||
glUniform1f(uFBHeight, mc.displayHeight);
|
||||
glUniform1f(uScaleFactor, sr.getScaleFactor());
|
||||
glUniform1i(uHeadIdx, samplesHead);
|
||||
glUniform1(uSamples, sampleBuf);
|
||||
GLStateManager.glUniform1f(uFBWidth, mc.displayWidth);
|
||||
GLStateManager.glUniform1f(uFBHeight, mc.displayHeight);
|
||||
GLStateManager.glUniform1f(uScaleFactor, sr.getScaleFactor());
|
||||
GLStateManager.glUniform1i(uHeadIdx, samplesHead);
|
||||
GLStateManager.glUniform1(uSamples, sampleBuf);
|
||||
|
||||
GLStateManager.glBindVertexArray(vao);
|
||||
|
||||
|
||||
@@ -194,6 +194,8 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
handle.exclusions().add("org.taumc.celeritas");
|
||||
handle.exclusions().add("com.mitchej123.lwjgl.lwjgl3");
|
||||
handle.exclusions().add("com.mitchej123.glsm");
|
||||
handle.exclusions().add("com.gtnewhorizons.angelica.lwjgl3");
|
||||
handle.exclusions().add("com.gtnewhorizons.angelica.vulkan");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-576
@@ -1,603 +1,40 @@
|
||||
package com.gtnewhorizons.angelica.loading.shared.transformers;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizon.gtnhlib.asm.ClassConstantPoolParser;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import com.gtnewhorizons.angelica.glsm.redirect.GLSMRedirector;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.TypeInsnNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* This transformer redirects many GL calls to our custom GLStateManager
|
||||
* Mod-level wrapper around {@link GLSMRedirector}. Adds mod-specific transformer exclusions and delegates all redirect logic to GLSM.
|
||||
* <p>
|
||||
* THIS CLASS MIGHT BE LOADED ON A DIFFERENT CLASS LOADER,
|
||||
* IT SHOULD NOT CALL ANY CODE FROM THE MAIN MOD
|
||||
*/
|
||||
public final class AngelicaRedirector {
|
||||
|
||||
private static final boolean ASSERT_MAIN_THREAD = Boolean.getBoolean("angelica.assertMainThread");
|
||||
private static final boolean LOG_SPAM = Boolean.getBoolean("angelica.redirectorLogspam");
|
||||
private static final Logger LOGGER = LogManager.getLogger("AngelicaRedirector");
|
||||
private static final String Drawable = "org/lwjgl/opengl/Drawable";
|
||||
private static final String GLStateManager = "com/gtnewhorizons/angelica/glsm/GLStateManager";
|
||||
private static final String GL11 = "org/lwjgl/opengl/GL11";
|
||||
private static final String GL11C = "org/lwjgl/opengl/GL11C";
|
||||
private static final String GL12 = "org/lwjgl/opengl/GL12";
|
||||
private static final String GL13 = "org/lwjgl/opengl/GL13";
|
||||
private static final String GL14 = "org/lwjgl/opengl/GL14";
|
||||
private static final String GL15 = "org/lwjgl/opengl/GL15";
|
||||
private static final String GL20 = "org/lwjgl/opengl/GL20";
|
||||
private static final String GL30 = "org/lwjgl/opengl/GL30";
|
||||
private static final String ARBVertexArrayObject = "org/lwjgl/opengl/ARBVertexArrayObject";
|
||||
private static final String APPLEVertexArrayObject = "org/lwjgl/opengl/APPLEVertexArrayObject";
|
||||
private static final String Project = "org/lwjgl/util/glu/Project";
|
||||
private static final String GLU = "org/lwjgl/util/glu/GLU";
|
||||
private static final String OpenGlHelper = "net/minecraft/client/renderer/OpenGlHelper";
|
||||
private static final String EXTBlendFunc = "org/lwjgl/opengl/EXTBlendFuncSeparate";
|
||||
private static final String ARBMultiTexture = "org/lwjgl/opengl/ARBMultitexture";
|
||||
private static final String ARBShaderObjects = "org/lwjgl/opengl/ARBShaderObjects";
|
||||
private final GLSMRedirector core = new GLSMRedirector();
|
||||
private final String[] allExclusions;
|
||||
|
||||
// Redirect VAO related calls from NHLib and LWJGLService
|
||||
private static final String UniversalVAO = "com/gtnewhorizon/gtnhlib/client/opengl/UniversalVAO";
|
||||
private static final String UniversalVAODot = "com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO";
|
||||
private static final String VaoFunctions = "com/gtnewhorizon/gtnhlib/client/renderer/vao/VaoFunctions";
|
||||
private static final String LWJGLService = "com/mitchej123/lwjgl/LWJGLService";
|
||||
|
||||
// Don't redirect these items inside of UniversalVAO, since we might be delegating to them
|
||||
private static final Set<String> UniversalVAOSkippedMethods = ImmutableSet.of(
|
||||
"glBindVertexArray", "glGenVertexArrays", "glDeleteVertexArrays", "glIsVertexArray"
|
||||
);
|
||||
|
||||
private static final String MinecraftClient = "net.minecraft.client";
|
||||
private static final String SplashProgress = "cpw.mods.fml.client.SplashProgress";
|
||||
private static final Set<String> ExcludedMinecraftMainThreadChecks = ImmutableSet.of(
|
||||
"startGame", "func_71384_a",
|
||||
"initializeTextures", "func_77474_a"
|
||||
);
|
||||
|
||||
private static final Map<String, Map<String, String>> methodRedirects = new HashMap<>(32);
|
||||
private static final Map<String, Map<String, String>> interfaceRedirects = new HashMap<>();
|
||||
private static final Map<Integer, String> glCapRedirects = new HashMap<>();
|
||||
private static final Map<String, String> gluRedirects = new HashMap<>();
|
||||
private static final ClassConstantPoolParser cstPoolParser;
|
||||
|
||||
static {
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_ALPHA_TEST, "AlphaTest");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_BLEND, "Blend");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_DEPTH_TEST, "DepthTest");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_CULL_FACE, "Cull");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_LIGHTING, "Lighting");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_TEXTURE_2D, "Texture");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_FOG, "Fog");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL12.GL_RESCALE_NORMAL, "RescaleNormal");
|
||||
glCapRedirects.put(org.lwjgl.opengl.GL11.GL_SCISSOR_TEST, "ScissorTest");
|
||||
methodRedirects.put(GL11, RedirectMap.newMap()
|
||||
.add("glAlphaFunc")
|
||||
.add("glBegin")
|
||||
.add("glBindTexture")
|
||||
.add("glBlendFunc")
|
||||
.add("glCallList")
|
||||
.add("glCallLists")
|
||||
.add("glClear")
|
||||
.add("glClearColor")
|
||||
.add("glClearDepth")
|
||||
.add("glClearStencil")
|
||||
.add("glClipPlane")
|
||||
.add("glColor3b")
|
||||
.add("glColor3d")
|
||||
.add("glColor3f")
|
||||
.add("glColor3ub")
|
||||
.add("glColor4b")
|
||||
.add("glColor4d")
|
||||
.add("glColor4f")
|
||||
.add("glColor4ub")
|
||||
.add("glColorMask")
|
||||
.add("glColorMaterial")
|
||||
.add("glDeleteLists")
|
||||
.add("glGenLists")
|
||||
.add("glGenTextures")
|
||||
.add("glIsList")
|
||||
.add("glDeleteTextures")
|
||||
.add("glDepthFunc")
|
||||
.add("glDepthMask")
|
||||
.add("glDepthRange")
|
||||
.add("glDrawArrays")
|
||||
.add("glDrawBuffer")
|
||||
.add("glDrawElements")
|
||||
.add("glEdgeFlag")
|
||||
.add("glEnd")
|
||||
.add("glEndList")
|
||||
.add("glFog")
|
||||
.add("glFogf")
|
||||
.add("glFogi")
|
||||
.add("glFrustum")
|
||||
.add("glGetBoolean")
|
||||
.add("glGetFloat")
|
||||
.add("glGetInteger")
|
||||
.add("glGetLight")
|
||||
.add("glGetMaterial")
|
||||
.add("glGetTexLevelParameteri")
|
||||
.add("glGetTexParameterf")
|
||||
.add("glGetTexParameteri")
|
||||
.add("glIsEnabled")
|
||||
.add("glMaterial")
|
||||
.add("glMaterialf")
|
||||
.add("glMateriali")
|
||||
.add("glLight")
|
||||
.add("glLightf")
|
||||
.add("glLighti")
|
||||
.add("glLightModel")
|
||||
.add("glLightModelf")
|
||||
.add("glLightModeli")
|
||||
.add("glLineStipple")
|
||||
.add("glLineWidth")
|
||||
.add("glListBase")
|
||||
.add("glLoadIdentity")
|
||||
.add("glLoadMatrix")
|
||||
.add("glLogicOp")
|
||||
.add("glMatrixMode")
|
||||
.add("glMultMatrix")
|
||||
.add("glNewList")
|
||||
.add("glNormal3b")
|
||||
.add("glNormal3d")
|
||||
.add("glNormal3f")
|
||||
.add("glNormal3i")
|
||||
.add("glOrtho")
|
||||
.add("glPopAttrib")
|
||||
.add("glPopMatrix")
|
||||
.add("glPushAttrib")
|
||||
.add("glPushMatrix")
|
||||
.add("glRasterPos2d")
|
||||
.add("glRasterPos2f")
|
||||
.add("glRasterPos2i")
|
||||
.add("glRasterPos3d")
|
||||
.add("glRasterPos3f")
|
||||
.add("glRasterPos3i")
|
||||
.add("glRasterPos4d")
|
||||
.add("glRasterPos4f")
|
||||
.add("glRasterPos4i")
|
||||
.add("glRotated")
|
||||
.add("glRotatef")
|
||||
.add("glScaled")
|
||||
.add("glScalef")
|
||||
.add("glShadeModel")
|
||||
.add("glTexCoord1d")
|
||||
.add("glTexCoord1f")
|
||||
.add("glTexCoord2d")
|
||||
.add("glTexCoord2f")
|
||||
.add("glTexCoord3d")
|
||||
.add("glTexCoord3f")
|
||||
.add("glTexCoord4d")
|
||||
.add("glTexCoord4f")
|
||||
.add("glTexEnvi")
|
||||
.add("glTexEnvf")
|
||||
.add("glTexEnv")
|
||||
.add("glGetTexEnv")
|
||||
.add("glGetTexEnvi")
|
||||
.add("glGetTexEnvf")
|
||||
.add("glTexGeni")
|
||||
.add("glTexGenf")
|
||||
.add("glTexGend")
|
||||
.add("glTexGen")
|
||||
.add("glGetTexGen")
|
||||
.add("glGetTexGeni")
|
||||
.add("glGetTexGenf")
|
||||
.add("glGetTexGend")
|
||||
.add("glTexImage1D")
|
||||
.add("glTexImage2D")
|
||||
.add("glTexImage3D")
|
||||
.add("glTexSubImage1D")
|
||||
.add("glTexSubImage2D")
|
||||
.add("glCopyTexImage1D")
|
||||
.add("glCopyTexImage2D")
|
||||
.add("glCopyTexSubImage1D")
|
||||
.add("glCopyTexSubImage2D")
|
||||
.add("glPixelStoref")
|
||||
.add("glPixelStorei")
|
||||
.add("glPixelTransferf")
|
||||
.add("glPixelTransferi")
|
||||
.add("glTexParameter")
|
||||
.add("glTexParameterf")
|
||||
.add("glTexParameteri")
|
||||
.add("glTexParameteri")
|
||||
.add("glCullFace")
|
||||
.add("glFrontFace")
|
||||
.add("glHint")
|
||||
.add("glLineStipple")
|
||||
.add("glLineWidth")
|
||||
.add("glPointSize")
|
||||
.add("glPolygonMode")
|
||||
.add("glPolygonOffset")
|
||||
.add("glPolygonStipple")
|
||||
.add("glAccum")
|
||||
.add("glReadBuffer")
|
||||
.add("glSampleCoverage")
|
||||
.add("glScissor")
|
||||
.add("glStencilFunc")
|
||||
.add("glStencilFuncSeparate")
|
||||
.add("glStencilMask")
|
||||
.add("glStencilMaskSeparate")
|
||||
.add("glStencilOp")
|
||||
.add("glStencilOpSeparate")
|
||||
.add("glTranslated")
|
||||
.add("glTranslatef")
|
||||
.add("glVertex2d")
|
||||
.add("glVertex2f")
|
||||
.add("glVertex2i")
|
||||
.add("glVertex3d")
|
||||
.add("glVertex3f")
|
||||
.add("glVertex3i")
|
||||
.add("glVertexPointer")
|
||||
.add("glColorPointer")
|
||||
.add("glNormalPointer")
|
||||
.add("glTexCoordPointer")
|
||||
.add("glEnableClientState")
|
||||
.add("glDisableClientState")
|
||||
.add("glInterleavedArrays")
|
||||
.add("glPushClientAttrib")
|
||||
.add("glPopClientAttrib")
|
||||
.add("glViewport")
|
||||
.add("glFeedbackBuffer")
|
||||
.add("glRenderMode")
|
||||
.add("glPassThrough")
|
||||
.add("glSelectBuffer")
|
||||
.add("glInitNames")
|
||||
.add("glPushName")
|
||||
.add("glPopName")
|
||||
.add("glLoadName")
|
||||
);
|
||||
methodRedirects.put(GL12, RedirectMap.newMap()
|
||||
.add("glTexImage3D")
|
||||
.add("glTexSubImage3D")
|
||||
.add("glCopyTexSubImage3D")
|
||||
);
|
||||
methodRedirects.put(GL13, RedirectMap.newMap()
|
||||
.add("glActiveTexture")
|
||||
.add("glSampleCoverage")
|
||||
.add("glClientActiveTexture")
|
||||
.add("glMultiTexCoord2f")
|
||||
.add("glMultiTexCoord2d")
|
||||
.add("glMultiTexCoord2s")
|
||||
);
|
||||
methodRedirects.put(GL14, RedirectMap.newMap()
|
||||
.add("glBlendFuncSeparate", "tryBlendFuncSeparate")
|
||||
.add("glBlendColor")
|
||||
.add("glBlendEquation")
|
||||
);
|
||||
methodRedirects.put(GL15, RedirectMap.newMap()
|
||||
.add("glBindBuffer")
|
||||
.add("glDeleteBuffers")
|
||||
);
|
||||
methodRedirects.put(GL20, RedirectMap.newMap()
|
||||
.add("glBlendEquationSeparate")
|
||||
.add("glDrawBuffers")
|
||||
.add("glStencilFuncSeparate")
|
||||
.add("glStencilMaskSeparate")
|
||||
.add("glStencilOpSeparate")
|
||||
.add("glUseProgram")
|
||||
.add("glShaderSource")
|
||||
.add("glLinkProgram")
|
||||
.add("glDeleteProgram")
|
||||
.add("glCreateShader")
|
||||
.add("glCompileShader")
|
||||
.add("glCreateProgram")
|
||||
.add("glAttachShader")
|
||||
.add("glDetachShader")
|
||||
.add("glValidateProgram")
|
||||
.add("glGetUniformLocation")
|
||||
.add("glGetAttribLocation")
|
||||
.add("glUniform1f")
|
||||
.add("glUniform2f")
|
||||
.add("glUniform3f")
|
||||
.add("glUniform4f")
|
||||
.add("glUniform1i")
|
||||
.add("glUniform2i")
|
||||
.add("glUniform3i")
|
||||
.add("glUniform4i")
|
||||
.add("glUniform1")
|
||||
.add("glUniform2")
|
||||
.add("glUniform3")
|
||||
.add("glUniform4")
|
||||
.add("glUniformMatrix2")
|
||||
.add("glUniformMatrix3")
|
||||
.add("glUniformMatrix4")
|
||||
.add("glGetActiveUniform")
|
||||
.add("glGetAttachedShaders")
|
||||
.add("glGetShaderSource")
|
||||
.add("glGetUniform")
|
||||
.add("glVertexAttribPointer")
|
||||
.add("glEnableVertexAttribArray")
|
||||
.add("glDisableVertexAttribArray")
|
||||
);
|
||||
methodRedirects.put(GL30, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
.add("glDeleteVertexArrays")
|
||||
.add("glBindFramebuffer")
|
||||
.add("glVertexAttribIPointer")
|
||||
);
|
||||
|
||||
// MINECRAFT
|
||||
methodRedirects.put(OpenGlHelper, RedirectMap.newMap()
|
||||
.add("glBlendFunc", "tryBlendFuncSeparate")
|
||||
.add("func_148821_a", "tryBlendFuncSeparate")
|
||||
.add("func_153171_g", "glBindFramebuffer")
|
||||
.add("func_153174_h", "glDeleteFramebuffers")
|
||||
.add("func_153165_e", "glGenFramebuffers")
|
||||
.add("func_153167_i", "glCheckFramebufferStatus")
|
||||
.add("func_153188_a", "glFramebufferTexture2D")
|
||||
.add("setActiveTexture")
|
||||
.add("setLightmapTextureCoords")
|
||||
.add("isFramebufferEnabled")
|
||||
);
|
||||
methodRedirects.put(EXTBlendFunc, RedirectMap.newMap().add("glBlendFuncSeparateEXT", "tryBlendFuncSeparate"));
|
||||
|
||||
// ARB
|
||||
methodRedirects.put(ARBMultiTexture, RedirectMap.newMap()
|
||||
.add("glActiveTextureARB")
|
||||
);
|
||||
methodRedirects.put(ARBShaderObjects, RedirectMap.newMap()
|
||||
.add("glUseProgramObjectARB", "glUseProgram")
|
||||
.add("glShaderSourceARB", "glShaderSource")
|
||||
.add("glLinkProgramARB", "glLinkProgram")
|
||||
.add("glCreateShaderObjectARB", "glCreateShader")
|
||||
.add("glCompileShaderARB", "glCompileShader")
|
||||
.add("glCreateProgramObjectARB", "glCreateProgram")
|
||||
.add("glAttachObjectARB", "glAttachShader")
|
||||
.add("glDetachObjectARB", "glDetachShader")
|
||||
.add("glValidateProgramARB", "glValidateProgram")
|
||||
.add("glGetUniformLocationARB", "glGetUniformLocation")
|
||||
.add("glGetAttribLocationARB", "glGetAttribLocation")
|
||||
.add("glDeleteObjectARB")
|
||||
.add("glGetObjectParameterARB")
|
||||
.add("glGetObjectParameteriARB")
|
||||
.add("glGetInfoLogARB")
|
||||
.add("glGetHandleARB")
|
||||
.add("glUniform1fARB", "glUniform1f")
|
||||
.add("glUniform2fARB", "glUniform2f")
|
||||
.add("glUniform3fARB", "glUniform3f")
|
||||
.add("glUniform4fARB", "glUniform4f")
|
||||
.add("glUniform1iARB", "glUniform1i")
|
||||
.add("glUniform2iARB", "glUniform2i")
|
||||
.add("glUniform3iARB", "glUniform3i")
|
||||
.add("glUniform4iARB", "glUniform4i")
|
||||
.add("glUniform1ARB", "glUniform1")
|
||||
.add("glUniform2ARB", "glUniform2")
|
||||
.add("glUniform3ARB", "glUniform3")
|
||||
.add("glUniform4ARB", "glUniform4")
|
||||
.add("glUniformMatrix2ARB", "glUniformMatrix2")
|
||||
.add("glUniformMatrix3ARB", "glUniformMatrix3")
|
||||
.add("glUniformMatrix4ARB", "glUniformMatrix4")
|
||||
.add("glGetActiveUniformARB", "glGetActiveUniform")
|
||||
.add("glGetAttachedObjectsARB", "glGetAttachedShaders")
|
||||
.add("glGetShaderSourceARB", "glGetShaderSource")
|
||||
.add("glGetUniformARB", "glGetUniform")
|
||||
);
|
||||
methodRedirects.put(ARBVertexArrayObject, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
.add("glDeleteVertexArrays")
|
||||
);
|
||||
|
||||
|
||||
// APPLE
|
||||
methodRedirects.put(APPLEVertexArrayObject, RedirectMap.newMap()
|
||||
.add("glBindVertexArrayAPPLE", "glBindVertexArray")
|
||||
);
|
||||
|
||||
// GTNHLib VAO
|
||||
methodRedirects.put(UniversalVAO, RedirectMap.newMap()
|
||||
.add("bindVertexArray", "glBindVertexArray")
|
||||
.add("deleteVertexArrays", "glDeleteVertexArrays")
|
||||
);
|
||||
|
||||
// OTHER
|
||||
methodRedirects.put(Project, RedirectMap.newMap()
|
||||
.add("gluPerspective")
|
||||
.add("gluLookAt")
|
||||
.add("gluPickMatrix")
|
||||
);
|
||||
methodRedirects.put(GLU, RedirectMap.newMap()
|
||||
.add("gluPerspective")
|
||||
.add("gluLookAt")
|
||||
.add("gluOrtho2D")
|
||||
.add("gluPickMatrix")
|
||||
);
|
||||
|
||||
// Interface/virtual redirects — callers invoke these on a receiver object
|
||||
interfaceRedirects.put(VaoFunctions, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
.add("glDeleteVertexArrays")
|
||||
);
|
||||
interfaceRedirects.put(LWJGLService, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
);
|
||||
|
||||
gluRedirects.put("org/lwjgl/util/glu/Sphere", "com/gtnewhorizons/angelica/glsm/compat/lwjgl/AngelicaSphere");
|
||||
gluRedirects.put("org/lwjgl/util/glu/Cylinder", "com/gtnewhorizons/angelica/glsm/compat/lwjgl/AngelicaCylinder");
|
||||
gluRedirects.put("org/lwjgl/util/glu/Disk", "com/gtnewhorizons/angelica/glsm/compat/lwjgl/AngelicaDisk");
|
||||
gluRedirects.put("org/lwjgl/util/glu/PartialDisk", "com/gtnewhorizons/angelica/glsm/compat/lwjgl/AngelicaPartialDisk");
|
||||
|
||||
final List<String> stringsToSearch = new ArrayList<>(32);
|
||||
stringsToSearch.add(VaoFunctions);
|
||||
stringsToSearch.add(LWJGLService);
|
||||
stringsToSearch.addAll(gluRedirects.keySet());
|
||||
final String glPrefix = "org/lwjgl/opengl/GL";
|
||||
for (var entry : new HashMap<>(methodRedirects).entrySet()) {
|
||||
stringsToSearch.add(entry.getKey());
|
||||
if (entry.getKey().startsWith(glPrefix)) {
|
||||
methodRedirects.put(entry.getKey() + "C", entry.getValue());
|
||||
stringsToSearch.add(entry.getKey() + "C");
|
||||
}
|
||||
}
|
||||
cstPoolParser = new ClassConstantPoolParser(stringsToSearch.toArray(new String[0]));
|
||||
public AngelicaRedirector() {
|
||||
final List<String> exclusions = new ArrayList<>(Arrays.asList(core.getCoreExclusions()));
|
||||
exclusions.add("com.gtnewhorizons.angelica.lwjgl3.");
|
||||
exclusions.add("com.gtnewhorizons.angelica.transform");
|
||||
allExclusions = exclusions.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public String[] getTransformerExclusions() {
|
||||
return new String[]{
|
||||
"org.lwjgl",
|
||||
"com.gtnewhorizon.gtnhlib.asm",
|
||||
"com.gtnewhorizons.angelica.glsm.",
|
||||
"com.gtnewhorizons.angelica.transform",
|
||||
"me.eigenraven.lwjgl3ify"
|
||||
};
|
||||
return allExclusions;
|
||||
}
|
||||
|
||||
public boolean shouldTransform(byte[] basicClass) {
|
||||
return cstPoolParser.find(basicClass);
|
||||
return core.shouldTransform(basicClass);
|
||||
}
|
||||
|
||||
/** @return Was the class changed? */
|
||||
public boolean transformClassNode(String transformedName, ClassNode cn) {
|
||||
boolean changed = false;
|
||||
final boolean isOpenGlHelper = transformedName.equals("net.minecraft.client.renderer.OpenGlHelper");
|
||||
final boolean isUniversalVAO = transformedName.startsWith(UniversalVAODot);
|
||||
for (MethodNode mn : cn.methods) {
|
||||
if (isOpenGlHelper && (mn.name.equals("glBlendFunc") || mn.name.equals("func_148821_a"))) {
|
||||
continue;
|
||||
}
|
||||
boolean redirectInMethod = false;
|
||||
for (AbstractInsnNode node : mn.instructions.toArray()) {
|
||||
if (node instanceof TypeInsnNode tNode) {
|
||||
// Redirect NEW and CHECKCAST for quadric classes
|
||||
if (tNode.getOpcode() == Opcodes.NEW || tNode.getOpcode() == Opcodes.CHECKCAST) {
|
||||
final String redirect = gluRedirects.get(tNode.desc);
|
||||
if (redirect != null) {
|
||||
if (LOG_SPAM) {
|
||||
LOGGER.info("Redirecting {} in {} from {} to {}", tNode.getOpcode() == Opcodes.NEW ? "NEW" : "CHECKCAST", transformedName, tNode.desc, redirect);
|
||||
}
|
||||
tNode.desc = redirect;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
} else if (node instanceof MethodInsnNode mNode) {
|
||||
if (mNode.desc.equals("(I)V") && (mNode.owner.equals(GL11) || mNode.owner.equals(GL11C)) && (mNode.name.equals("glEnable") || mNode.name.equals("glDisable"))) {
|
||||
final AbstractInsnNode prevNode = node.getPrevious();
|
||||
String name = null;
|
||||
if (prevNode instanceof LdcInsnNode ldcNode) {
|
||||
name = glCapRedirects.get(((Integer) ldcNode.cst));
|
||||
} else if (prevNode instanceof IntInsnNode intNode) {
|
||||
name = glCapRedirects.get(intNode.operand);
|
||||
}
|
||||
if (name != null) {
|
||||
if (mNode.name.equals("glEnable")) {
|
||||
name = "enable" + name;
|
||||
} else {
|
||||
name = "disable" + name;
|
||||
}
|
||||
}
|
||||
if (LOG_SPAM) {
|
||||
if (name == null) {
|
||||
LOGGER.info("Redirecting call in {} from GL11.{}(I)V to GLStateManager.{}(I)V", transformedName, mNode.name, mNode.name);
|
||||
} else {
|
||||
LOGGER.info("Redirecting call in {} from GL11.{}(I)V to GLStateManager.{}()V", transformedName, mNode.name, name);
|
||||
}
|
||||
}
|
||||
mNode.owner = GLStateManager;
|
||||
if (name != null) {
|
||||
mNode.name = name;
|
||||
mNode.desc = "()V";
|
||||
mn.instructions.remove(prevNode);
|
||||
}
|
||||
changed = true;
|
||||
redirectInMethod = true;
|
||||
} else if (mNode.name.equals("makeCurrent") && mNode.owner.startsWith(Drawable)) {
|
||||
mNode.setOpcode(Opcodes.INVOKESTATIC);
|
||||
mNode.owner = GLStateManager;
|
||||
mNode.desc = "(L" + Drawable + ";)V";
|
||||
mNode.itf = false;
|
||||
changed = true;
|
||||
if (LOG_SPAM) {
|
||||
LOGGER.info("Redirecting call in {} to GLStateManager.makeCurrent()", transformedName);
|
||||
}
|
||||
} else {
|
||||
final Map<String, String> redirects = methodRedirects.get(mNode.owner);
|
||||
if (redirects != null) {
|
||||
final String glsmName = redirects.get(mNode.name);
|
||||
// Skip VAO method redirects inside UniversalVAO
|
||||
if (glsmName != null && !(isUniversalVAO && UniversalVAOSkippedMethods.contains(glsmName))) {
|
||||
if (LOG_SPAM) {
|
||||
final String shortOwner = mNode.owner.substring(mNode.owner.lastIndexOf("/") + 1);
|
||||
LOGGER.info("Redirecting call in {} from {}.{}{} to GLStateManager.{}{}", transformedName, shortOwner, mNode.name, mNode.desc, glsmName, mNode.desc);
|
||||
}
|
||||
mNode.owner = GLStateManager;
|
||||
mNode.name = glsmName;
|
||||
changed = true;
|
||||
redirectInMethod = true;
|
||||
}
|
||||
}
|
||||
// Interface/virtual redirects: rewrite receiver-based calls to static GLStateManager calls
|
||||
if ((mNode.getOpcode() == Opcodes.INVOKEINTERFACE || mNode.getOpcode() == Opcodes.INVOKEVIRTUAL) && mNode.desc.equals("(I)V")) {
|
||||
final Map<String, String> ifaceRedirects = interfaceRedirects.get(mNode.owner);
|
||||
if (ifaceRedirects != null) {
|
||||
final String glsmName = ifaceRedirects.get(mNode.name);
|
||||
if (glsmName != null && !(isUniversalVAO && UniversalVAOSkippedMethods.contains(glsmName))) {
|
||||
if (LOG_SPAM) {
|
||||
final String shortOwner = mNode.owner.substring(mNode.owner.lastIndexOf("/") + 1);
|
||||
LOGGER.info("Redirecting interface call in {} from {}.{}{} to GLStateManager.{}{}", transformedName, shortOwner, mNode.name, mNode.desc, glsmName, "(I)V");
|
||||
}
|
||||
// Stack is: [receiver, int_arg]. We need just [int_arg] for static call.
|
||||
// Insert SWAP + POP before the call to remove the receiver.
|
||||
mn.instructions.insertBefore(mNode, new InsnNode(Opcodes.SWAP));
|
||||
mn.instructions.insertBefore(mNode, new InsnNode(Opcodes.POP));
|
||||
mNode.setOpcode(Opcodes.INVOKESTATIC);
|
||||
mNode.owner = GLStateManager;
|
||||
mNode.name = glsmName;
|
||||
mNode.desc = "(I)V";
|
||||
mNode.itf = false;
|
||||
changed = true;
|
||||
redirectInMethod = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Redirect <init> calls for quadric classes
|
||||
if (mNode.getOpcode() == Opcodes.INVOKESPECIAL && mNode.name.equals("<init>")) {
|
||||
final String redirect = gluRedirects.get(mNode.owner);
|
||||
if (redirect != null) {
|
||||
if (LOG_SPAM) {
|
||||
LOGGER.info("Redirecting <init> in {} from {} to {}", transformedName, mNode.owner, redirect);
|
||||
}
|
||||
mNode.owner = redirect;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ASSERT_MAIN_THREAD && redirectInMethod && !transformedName.startsWith(SplashProgress) && !(transformedName.startsWith(MinecraftClient) && ExcludedMinecraftMainThreadChecks.contains(mn.name))) {
|
||||
mn.instructions.insert(new MethodInsnNode(Opcodes.INVOKESTATIC, GLStateManager, "assertMainThread", "()V", false));
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
return core.transformClassNode(transformedName, cn);
|
||||
}
|
||||
|
||||
private static final class RedirectMap<K> extends HashMap<K, K> {
|
||||
|
||||
public static RedirectMap<String> newMap() {
|
||||
return new RedirectMap<>();
|
||||
}
|
||||
|
||||
public RedirectMap<K> add(K name) {
|
||||
this.put(name, name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RedirectMap<K> add(K name, K newName) {
|
||||
this.put(name, newName);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public enum Mixins implements IMixins {
|
||||
, "angelica.MixinForgeHooksClient_CoreProfile"
|
||||
, "angelica.MixinGameSettings"
|
||||
, "angelica.MixinMinecraft"
|
||||
, "angelica.MixinMinecraft_FrameHook"
|
||||
, "angelica.MixinMinecraftServer"
|
||||
, "angelica.bugfixes.MixinRenderGlobal_DestroyBlock"
|
||||
, "angelica.bugfixes.MixinRendererLivingEntity_EyeDepth"
|
||||
|
||||
@@ -464,11 +464,11 @@ public class CloudRenderer implements IResourceManagerReloadListener {
|
||||
}
|
||||
|
||||
if (WIREFRAME) {
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
||||
GLStateManager.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
||||
GLStateManager.glLineWidth(2.0F);
|
||||
GLStateManager.glDepthMask(false);
|
||||
vao.draw();
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
||||
GLStateManager.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
||||
GLStateManager.glDepthMask(true);
|
||||
}
|
||||
|
||||
@@ -488,8 +488,8 @@ public class CloudRenderer implements IResourceManagerReloadListener {
|
||||
private void reloadTextures() {
|
||||
if (mc.renderEngine != null) {
|
||||
mc.renderEngine.bindTexture(texture);
|
||||
texW = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
|
||||
texH = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
|
||||
texW = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
|
||||
texH = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.util.function.Function;
|
||||
@@ -82,7 +81,7 @@ public class PanoramaRenderer {
|
||||
fboB = createFbo(texB);
|
||||
|
||||
buildCubeGeometry();
|
||||
emptyVao = GL30.glGenVertexArrays();
|
||||
emptyVao = GLStateManager.glGenVertexArrays();
|
||||
initShaders();
|
||||
}
|
||||
|
||||
@@ -101,7 +100,7 @@ public class PanoramaRenderer {
|
||||
try {
|
||||
final GlProgram<T> program = GlProgram.builder(name).attachShader(vert).attachShader(frag).link(factory);
|
||||
program.bind();
|
||||
GL20.glUniform1i(GL20.glGetUniformLocation(program.handle(), "u_Texture"), 0);
|
||||
GLStateManager.glUniform1i(GLStateManager.glGetUniformLocation(program.handle(), "u_Texture"), 0);
|
||||
program.unbind();
|
||||
return program;
|
||||
} finally {
|
||||
@@ -137,48 +136,48 @@ public class PanoramaRenderer {
|
||||
}
|
||||
ibuf.flip();
|
||||
|
||||
cubeVao = GL30.glGenVertexArrays();
|
||||
GL30.glBindVertexArray(cubeVao);
|
||||
cubeVao = GLStateManager.glGenVertexArrays();
|
||||
GLStateManager.glBindVertexArray(cubeVao);
|
||||
|
||||
cubeVbo = GL15.glGenBuffers();
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, cubeVbo);
|
||||
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vbuf, GL15.GL_STATIC_DRAW);
|
||||
cubeVbo = GLStateManager.glGenBuffers();
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, cubeVbo);
|
||||
GLStateManager.glBufferData(GL15.GL_ARRAY_BUFFER, vbuf, GL15.GL_STATIC_DRAW);
|
||||
|
||||
GL20.glEnableVertexAttribArray(0);
|
||||
GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, VERTEX_STRIDE, 0);
|
||||
GL20.glEnableVertexAttribArray(1);
|
||||
GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, VERTEX_STRIDE, 12);
|
||||
GL20.glEnableVertexAttribArray(2);
|
||||
GL20.glVertexAttribPointer(2, 1, GL11.GL_FLOAT, false, VERTEX_STRIDE, 20);
|
||||
GLStateManager.glEnableVertexAttribArray(0);
|
||||
GLStateManager.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, VERTEX_STRIDE, 0);
|
||||
GLStateManager.glEnableVertexAttribArray(1);
|
||||
GLStateManager.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, VERTEX_STRIDE, 12);
|
||||
GLStateManager.glEnableVertexAttribArray(2);
|
||||
GLStateManager.glVertexAttribPointer(2, 1, GL11.GL_FLOAT, false, VERTEX_STRIDE, 20);
|
||||
|
||||
cubeIbo = GL15.glGenBuffers();
|
||||
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, cubeIbo);
|
||||
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, ibuf, GL15.GL_STATIC_DRAW);
|
||||
cubeIbo = GLStateManager.glGenBuffers();
|
||||
GLStateManager.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, cubeIbo);
|
||||
GLStateManager.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, ibuf, GL15.GL_STATIC_DRAW);
|
||||
|
||||
GL30.glBindVertexArray(0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
}
|
||||
|
||||
private static int createTexture() {
|
||||
final int tex = GL11.glGenTextures();
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex);
|
||||
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, FBO_SIZE, FBO_SIZE, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
|
||||
final int tex = GLStateManager.glGenTextures();
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, tex);
|
||||
GLStateManager.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, FBO_SIZE, FBO_SIZE, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, 0);
|
||||
return tex;
|
||||
}
|
||||
|
||||
private static int createFbo(int colorTex) {
|
||||
final int fbo = GL30.glGenFramebuffers();
|
||||
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbo);
|
||||
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTex, 0);
|
||||
final int status = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
|
||||
final int fbo = GLStateManager.glGenFramebuffers();
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbo);
|
||||
GLStateManager.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTex, 0);
|
||||
final int status = GLStateManager.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
|
||||
if (status != GL30.GL_FRAMEBUFFER_COMPLETE) {
|
||||
throw new RuntimeException("Panorama FBO incomplete: 0x" + Integer.toHexString(status));
|
||||
}
|
||||
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
|
||||
return fbo;
|
||||
}
|
||||
|
||||
@@ -186,35 +185,35 @@ public class PanoramaRenderer {
|
||||
if (!initialized) return;
|
||||
initialized = false;
|
||||
if (fboA != 0) {
|
||||
GL30.glDeleteFramebuffers(fboA);
|
||||
GLStateManager.glDeleteFramebuffers(fboA);
|
||||
fboA = 0;
|
||||
}
|
||||
if (fboB != 0) {
|
||||
GL30.glDeleteFramebuffers(fboB);
|
||||
GLStateManager.glDeleteFramebuffers(fboB);
|
||||
fboB = 0;
|
||||
}
|
||||
if (texA != 0) {
|
||||
GL11.glDeleteTextures(texA);
|
||||
GLStateManager.glDeleteTextures(texA);
|
||||
texA = 0;
|
||||
}
|
||||
if (texB != 0) {
|
||||
GL11.glDeleteTextures(texB);
|
||||
GLStateManager.glDeleteTextures(texB);
|
||||
texB = 0;
|
||||
}
|
||||
if (cubeVao != 0) {
|
||||
GL30.glDeleteVertexArrays(cubeVao);
|
||||
GLStateManager.glDeleteVertexArrays(cubeVao);
|
||||
cubeVao = 0;
|
||||
}
|
||||
if (cubeVbo != 0) {
|
||||
GL15.glDeleteBuffers(cubeVbo);
|
||||
GLStateManager.glDeleteBuffers(cubeVbo);
|
||||
cubeVbo = 0;
|
||||
}
|
||||
if (cubeIbo != 0) {
|
||||
GL15.glDeleteBuffers(cubeIbo);
|
||||
GLStateManager.glDeleteBuffers(cubeIbo);
|
||||
cubeIbo = 0;
|
||||
}
|
||||
if (emptyVao != 0) {
|
||||
GL30.glDeleteVertexArrays(emptyVao);
|
||||
GLStateManager.glDeleteVertexArrays(emptyVao);
|
||||
emptyVao = 0;
|
||||
}
|
||||
if (cubeProgram != null) {
|
||||
@@ -240,42 +239,42 @@ public class PanoramaRenderer {
|
||||
GLStateManager.disableDepthTest();
|
||||
|
||||
mc.getFramebuffer().unbindFramebuffer();
|
||||
GL11.glViewport(0, 0, FBO_SIZE, FBO_SIZE);
|
||||
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboA);
|
||||
GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
GLStateManager.glViewport(0, 0, FBO_SIZE, FBO_SIZE);
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboA);
|
||||
GLStateManager.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
drawCubeFaces(panoramaTimer, partialTicks, panoramaPaths, mc);
|
||||
|
||||
GLStateManager.disableBlend();
|
||||
blurProgram.bind();
|
||||
GL30.glBindVertexArray(emptyVao);
|
||||
GLStateManager.glBindVertexArray(emptyVao);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
|
||||
final BlurUniforms bu = blurProgram.getInterface();
|
||||
|
||||
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboB);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texA);
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboB);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, texA);
|
||||
bu.direction.set(1.0f / FBO_SIZE, 0.0f);
|
||||
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);
|
||||
GLStateManager.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);
|
||||
|
||||
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboA);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texB);
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboA);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, texB);
|
||||
bu.direction.set(0.0f, 1.0f / FBO_SIZE);
|
||||
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);
|
||||
GLStateManager.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);
|
||||
|
||||
mc.getFramebuffer().bindFramebuffer(true);
|
||||
GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
|
||||
GLStateManager.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
|
||||
|
||||
blitProgram.bind();
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texA);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, texA);
|
||||
|
||||
final float f1 = screenWidth > screenHeight ? 120.0F / screenWidth : 120.0F / screenHeight;
|
||||
blitProgram.getInterface().scaleV.setFloat(screenHeight * f1 / 256.0F);
|
||||
blitProgram.getInterface().scaleU.setFloat(screenWidth * f1 / 256.0F);
|
||||
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);
|
||||
GLStateManager.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);
|
||||
|
||||
GL30.glBindVertexArray(0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
blitProgram.unbind();
|
||||
|
||||
GLStateManager.enableDepthTest();
|
||||
@@ -297,7 +296,7 @@ public class PanoramaRenderer {
|
||||
GLStateManager.glDepthMask(false);
|
||||
|
||||
cubeProgram.bind();
|
||||
GL30.glBindVertexArray(cubeVao);
|
||||
GLStateManager.glBindVertexArray(cubeVao);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
|
||||
final CubeUniforms cu = cubeProgram.getInterface();
|
||||
@@ -307,10 +306,10 @@ public class PanoramaRenderer {
|
||||
cu.mvp.set(mvpScratch);
|
||||
|
||||
mc.getTextureManager().bindTexture(panoramaPaths[face]);
|
||||
GL11.glDrawElements(GL11.GL_TRIANGLES, INDICES_PER_FACE, GL11.GL_UNSIGNED_SHORT, 0);
|
||||
GLStateManager.glDrawElements(GL11.GL_TRIANGLES, INDICES_PER_FACE, GL11.GL_UNSIGNED_SHORT, 0);
|
||||
}
|
||||
|
||||
GL30.glBindVertexArray(0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
cubeProgram.unbind();
|
||||
GLStateManager.glDepthMask(true);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import org.embeddedt.embeddium.impl.gl.shader.uniform.GlUniformMatrix4f;
|
||||
import org.embeddedt.embeddium.impl.render.shader.ShaderLoader;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
public final class SelectionBoxRenderer {
|
||||
|
||||
@@ -51,7 +50,7 @@ public final class SelectionBoxRenderer {
|
||||
fs.destroy();
|
||||
if (gs != null) gs.destroy();
|
||||
|
||||
emptyVao = GL30.glGenVertexArrays();
|
||||
emptyVao = GLStateManager.glGenVertexArrays();
|
||||
}
|
||||
|
||||
public static void draw(AxisAlignedBB aabb, int color) {
|
||||
@@ -86,7 +85,7 @@ public final class SelectionBoxRenderer {
|
||||
}
|
||||
|
||||
GLStateManager.glBindVertexArray(emptyVao);
|
||||
GL11.glDrawArrays(GL11.GL_LINES, 0, 24);
|
||||
GLStateManager.glDrawArrays(GL11.GL_LINES, 0, 24);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
|
||||
program.unbind();
|
||||
@@ -98,7 +97,7 @@ public final class SelectionBoxRenderer {
|
||||
program = null;
|
||||
}
|
||||
if (emptyVao != 0) {
|
||||
GL30.glDeleteVertexArrays(emptyVao);
|
||||
GLStateManager.glDeleteVertexArrays(emptyVao);
|
||||
emptyVao = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@ import com.gtnewhorizons.angelica.Tags;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import static com.gtnewhorizons.angelica.glsm.backend.BackendManager.RENDER_BACKEND;
|
||||
import com.gtnewhorizons.angelica.glsm.ffp.ShaderManager;
|
||||
import com.gtnewhorizons.angelica.client.rendering.TessellatorStreamingDrawer;
|
||||
import com.gtnewhorizons.angelica.glsm.states.FogState;
|
||||
@@ -42,7 +43,7 @@ public class CeleritasDebugScreenHandler {
|
||||
}
|
||||
|
||||
event.right.add("");
|
||||
event.right.add(EnumChatFormatting.GREEN + "Angelica " + Tags.VERSION + " [Celeritas Renderer]");
|
||||
event.right.add(EnumChatFormatting.GREEN + "Angelica " + Tags.VERSION + " [Celeritas Renderer] [" + RENDER_BACKEND.getName() + "]");
|
||||
event.right.addAll(renderer.getDebugStrings());
|
||||
final ShaderManager sm = ShaderManager.getInstance();
|
||||
if (sm != null) {
|
||||
|
||||
+2
-2
@@ -216,13 +216,13 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
|
||||
@Override
|
||||
public void drawChunkLayer(BlockRenderLayer renderLayer, double x, double y, double z) {
|
||||
if (DEBUG_WIREFRAME_MODE) {
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
||||
GLStateManager.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
|
||||
}
|
||||
|
||||
super.drawChunkLayer(renderLayer, x, y, z);
|
||||
|
||||
if (DEBUG_WIREFRAME_MODE) {
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
||||
GLStateManager.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
|
||||
}
|
||||
|
||||
GLStateManager.glColor4f(1, 1, 1, 1);
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
import com.prupe.mcpatcher.MCPatcherUtils;
|
||||
@@ -396,7 +396,7 @@ public class ColorizeBlock {
|
||||
waterColor = new float[3];
|
||||
ColorUtils.intToFloat3(waterColorMap.getColorMultiplier(), waterColor);
|
||||
}
|
||||
GL11.glColor4f(waterColor[0], waterColor[1], waterColor[2], 1.0f);
|
||||
GLStateManager.glColor4f(waterColor[0], waterColor[1], waterColor[2], 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.mal.resource.BlendMethod;
|
||||
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
|
||||
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
|
||||
@@ -33,42 +34,42 @@ final class Enchantment extends OverrideBase {
|
||||
private float armorScaleY;
|
||||
|
||||
static void beginOuter2D() {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GLStateManager.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GLStateManager.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
GLStateManager.glEnable(GL11.GL_BLEND);
|
||||
GLStateManager.glDepthFunc(GL11.GL_EQUAL);
|
||||
GLStateManager.glDepthMask(false);
|
||||
GLStateManager.glDisable(GL11.GL_LIGHTING);
|
||||
GLStateManager.glMatrixMode(GL11.GL_TEXTURE);
|
||||
}
|
||||
|
||||
static void endOuter2D() {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GLStateManager.glDisable(GL11.GL_BLEND);
|
||||
GLStateManager.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GLStateManager.glDepthMask(true);
|
||||
GLStateManager.glEnable(GL11.GL_LIGHTING);
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void beginOuter3D() {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
lightingWasEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GLStateManager.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GLStateManager.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
GLStateManager.glEnable(GL11.GL_BLEND);
|
||||
GLStateManager.glDepthFunc(GL11.GL_EQUAL);
|
||||
lightingWasEnabled = GLStateManager.glGetBoolean(GL11.GL_LIGHTING);
|
||||
GLStateManager.glDisable(GL11.GL_LIGHTING);
|
||||
GLStateManager.glMatrixMode(GL11.GL_TEXTURE);
|
||||
}
|
||||
|
||||
static void endOuter3D() {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GLStateManager.glDisable(GL11.GL_BLEND);
|
||||
GLStateManager.glDepthFunc(GL11.GL_LEQUAL);
|
||||
if (lightingWasEnabled) {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GLStateManager.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
|
||||
Enchantment(PropertiesFile properties) {
|
||||
@@ -161,46 +162,46 @@ final class Enchantment extends OverrideBase {
|
||||
}
|
||||
|
||||
void beginArmor(float intensity) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GLStateManager.glEnable(GL11.GL_BLEND);
|
||||
GLStateManager.glDepthFunc(GL11.GL_EQUAL);
|
||||
GLStateManager.glDepthMask(false);
|
||||
GLStateManager.glDisable(GL11.GL_LIGHTING);
|
||||
GLStateManager.glMatrixMode(GL11.GL_TEXTURE);
|
||||
begin(intensity);
|
||||
if (!armorScaleSet) {
|
||||
setArmorScale();
|
||||
}
|
||||
GL11.glScalef(armorScaleX, armorScaleY, 1.0f);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GLStateManager.glScalef(armorScaleX, armorScaleY, 1.0f);
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
|
||||
void endArmor() {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GLStateManager.glDisable(GL11.GL_BLEND);
|
||||
GLStateManager.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GLStateManager.glDepthMask(true);
|
||||
GLStateManager.glEnable(GL11.GL_LIGHTING);
|
||||
GLStateManager.glMatrixMode(GL11.GL_TEXTURE);
|
||||
end();
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GLStateManager.glLoadIdentity();
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
|
||||
void begin(float intensity) {
|
||||
blendMethod.applyBlending();
|
||||
blendMethod.applyDepthFunc();
|
||||
blendMethod.applyFade(intensity);
|
||||
GL11.glPushMatrix();
|
||||
GLStateManager.glPushMatrix();
|
||||
if (speed != 0.0) {
|
||||
double offset = ((double) System.currentTimeMillis() * speed) / 3000.0;
|
||||
offset -= Math.floor(offset);
|
||||
GL11.glTranslatef((float) offset * 8.0f, 0.0f, 0.0f);
|
||||
GLStateManager.glTranslatef((float) offset * 8.0f, 0.0f, 0.0f);
|
||||
}
|
||||
GL11.glRotatef(rotation, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glRotatef(rotation, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
void end() {
|
||||
GL11.glPopMatrix();
|
||||
GLStateManager.glPopMatrix();
|
||||
}
|
||||
|
||||
private void setArmorScale() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.glu.GLU;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
import com.prupe.mcpatcher.MCPatcherUtils;
|
||||
import com.prupe.mcpatcher.mal.resource.GLAPI;
|
||||
@@ -145,8 +146,8 @@ public class CustomAnimation implements Comparable<CustomAnimation> {
|
||||
return;
|
||||
}
|
||||
TexturePackAPI.bindTexture(dstName);
|
||||
int dstWidth = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
|
||||
int dstHeight = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
|
||||
int dstWidth = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
|
||||
int dstHeight = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
|
||||
int levels = MipmapHelper.getMipmapLevelsForCurrentTexture();
|
||||
if (x + w > dstWidth || y + h > dstHeight) {
|
||||
properties.error(
|
||||
@@ -238,7 +239,7 @@ public class CustomAnimation implements Comparable<CustomAnimation> {
|
||||
}
|
||||
GLAPI.glBindTexture(texture);
|
||||
update(texture, 0, 0);
|
||||
int glError = GL11.glGetError();
|
||||
int glError = GLStateManager.glGetError();
|
||||
if (glError != 0) {
|
||||
logger.severe("%s: %s", this, GLU.gluErrorString(glError));
|
||||
error = true;
|
||||
@@ -351,7 +352,7 @@ public class CustomAnimation implements Comparable<CustomAnimation> {
|
||||
// Without the cast the code won't compile
|
||||
@SuppressWarnings("RedundantCast")
|
||||
private void update(int texture, int dx, int dy) {
|
||||
GL11.glTexSubImage2D(
|
||||
GLStateManager.glTexSubImage2D(
|
||||
GL11.GL_TEXTURE_2D,
|
||||
mipmapLevel,
|
||||
x + dx,
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.util.glu.GLU;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
import com.prupe.mcpatcher.MCPatcherUtils;
|
||||
import com.prupe.mcpatcher.mal.resource.BlendMethod;
|
||||
@@ -55,7 +56,7 @@ public class FancyDial {
|
||||
private static final int glAttributes;
|
||||
private static boolean initialized;
|
||||
private static boolean active;
|
||||
private static final int drawList = GL11.glGenLists(1);
|
||||
private static final int drawList = GLStateManager.glGenLists(1);
|
||||
|
||||
private static final Map<TextureAtlasSprite, ResourceLocation> setupInfo = new IdentityHashMap<>();
|
||||
private static final Map<TextureAtlasSprite, FancyDial> instances = new IdentityHashMap<>();
|
||||
@@ -97,9 +98,9 @@ public class FancyDial {
|
||||
}
|
||||
glAttributes = bits;
|
||||
|
||||
GL11.glNewList(drawList, GL11.GL_COMPILE);
|
||||
GLStateManager.glNewList(drawList, GL11.GL_COMPILE);
|
||||
drawBox();
|
||||
GL11.glEndList();
|
||||
GLStateManager.glEndList();
|
||||
}
|
||||
|
||||
public static void setup(TextureAtlasSprite icon) {
|
||||
@@ -136,12 +137,12 @@ public class FancyDial {
|
||||
if (!active) {
|
||||
return false;
|
||||
}
|
||||
int oldFB = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
||||
int oldFB = GLStateManager.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
||||
if (oldFB != 0 && warnCount < 10) {
|
||||
logger.finer("rendering %s while non-default framebuffer %d is active", icon.getIconName(), oldFB);
|
||||
warnCount++;
|
||||
}
|
||||
int oldTexture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
int oldTexture = GLStateManager.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
|
||||
try {
|
||||
FancyDial instance = getInstance(icon);
|
||||
@@ -271,7 +272,7 @@ public class FancyDial {
|
||||
|
||||
outputFrames = properties.getInt("outputFrames", 0);
|
||||
|
||||
int glError = GL11.glGetError();
|
||||
int glError = GLStateManager.glGetError();
|
||||
if (glError != 0) {
|
||||
logger.severe("%s during %s setup", GLU.gluErrorString(glError), name);
|
||||
return;
|
||||
@@ -367,7 +368,7 @@ public class FancyDial {
|
||||
lastItemFrameRenderer = false;
|
||||
}
|
||||
|
||||
int glError = GL11.glGetError();
|
||||
int glError = GLStateManager.glGetError();
|
||||
if (glError != 0) {
|
||||
logger.severe("%s during %s update", GLU.gluErrorString(glError), name);
|
||||
ok = false;
|
||||
@@ -430,7 +431,7 @@ public class FancyDial {
|
||||
private void renderImpl(double angle) {
|
||||
for (Layer layer : layers) {
|
||||
layer.blendMethod.applyBlending();
|
||||
GL11.glPushMatrix();
|
||||
GLStateManager.glPushMatrix();
|
||||
TexturePackAPI.bindTexture(layer.textureName);
|
||||
float offsetX = layer.offsetX;
|
||||
float offsetY = layer.offsetY;
|
||||
@@ -442,26 +443,26 @@ public class FancyDial {
|
||||
scaleX += scaleXDelta;
|
||||
scaleY += scaleYDelta;
|
||||
}
|
||||
GL11.glTranslatef(offsetX, offsetY, 0.0f);
|
||||
GL11.glScalef(scaleX, scaleY, 1.0f);
|
||||
GLStateManager.glTranslatef(offsetX, offsetY, 0.0f);
|
||||
GLStateManager.glScalef(scaleX, scaleY, 1.0f);
|
||||
float layerAngle = (float) (angle * layer.rotationMultiplier + layer.rotationOffset);
|
||||
GL11.glRotatef(layerAngle, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glCallList(drawList);
|
||||
GL11.glPopMatrix();
|
||||
GLStateManager.glRotatef(layerAngle, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glCallList(drawList);
|
||||
GLStateManager.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawBox() {
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
GL11.glTexCoord2f(0.0f, 0.0f);
|
||||
GL11.glVertex3f(-1.0f, -1.0f, 0.0f);
|
||||
GL11.glTexCoord2f(1.0f, 0.0f);
|
||||
GL11.glVertex3f(1.0f, -1.0f, 0.0f);
|
||||
GL11.glTexCoord2f(1.0f, 1.0f);
|
||||
GL11.glVertex3f(1.0f, 1.0f, 0.0f);
|
||||
GL11.glTexCoord2f(0.0f, 1.0f);
|
||||
GL11.glVertex3f(-1.0f, 1.0f, 0.0f);
|
||||
GL11.glEnd();
|
||||
GLStateManager.glBegin(GL11.GL_QUADS);
|
||||
GLStateManager.glTexCoord2f(0.0f, 0.0f);
|
||||
GLStateManager.glVertex3f(-1.0f, -1.0f, 0.0f);
|
||||
GLStateManager.glTexCoord2f(1.0f, 0.0f);
|
||||
GLStateManager.glVertex3f(1.0f, -1.0f, 0.0f);
|
||||
GLStateManager.glTexCoord2f(1.0f, 1.0f);
|
||||
GLStateManager.glVertex3f(1.0f, 1.0f, 0.0f);
|
||||
GLStateManager.glTexCoord2f(0.0f, 1.0f);
|
||||
GLStateManager.glVertex3f(-1.0f, 1.0f, 0.0f);
|
||||
GLStateManager.glEnd();
|
||||
}
|
||||
|
||||
private void finish() {
|
||||
@@ -619,58 +620,58 @@ public class FancyDial {
|
||||
void bind() {
|
||||
EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, frameBuffer);
|
||||
|
||||
GL11.glPushAttrib(glAttributes);
|
||||
GL11.glViewport(x0, y0, width, height);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
GL11.glScissor(x0, y0, width, height);
|
||||
GLStateManager.glPushAttrib(glAttributes);
|
||||
GLStateManager.glViewport(x0, y0, width, height);
|
||||
GLStateManager.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
GLStateManager.glScissor(x0, y0, width, height);
|
||||
|
||||
lightmapEnabled = false;
|
||||
if (gl13Supported) {
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE1);
|
||||
lightmapEnabled = GL11.glIsEnabled(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE1);
|
||||
lightmapEnabled = GLStateManager.glIsEnabled(GL11.GL_TEXTURE_2D);
|
||||
if (lightmapEnabled) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.glDisable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
GLStateManager.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GLStateManager.glDisable(GL11.GL_LIGHTING);
|
||||
GLStateManager.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GLStateManager.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
if (useGL13) {
|
||||
GL11.glDisable(GL13.GL_MULTISAMPLE);
|
||||
GLStateManager.glDisable(GL13.GL_MULTISAMPLE);
|
||||
}
|
||||
|
||||
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
GLStateManager.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLStateManager.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
|
||||
GLStateManager.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GLStateManager.glPushMatrix();
|
||||
GLStateManager.glLoadIdentity();
|
||||
GLStateManager.glOrtho(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
|
||||
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glLoadIdentity();
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GLStateManager.glPushMatrix();
|
||||
GLStateManager.glLoadIdentity();
|
||||
}
|
||||
|
||||
void unbind() {
|
||||
GL11.glPopAttrib();
|
||||
GLStateManager.glPopAttrib();
|
||||
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glPopMatrix();
|
||||
GLStateManager.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GLStateManager.glPopMatrix();
|
||||
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glPopMatrix();
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GLStateManager.glPopMatrix();
|
||||
|
||||
if (lightmapEnabled) {
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE1);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE1);
|
||||
GLStateManager.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
}
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GLStateManager.glEnable(GL11.GL_BLEND);
|
||||
GLAPI.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||
|
||||
EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);
|
||||
@@ -679,13 +680,13 @@ public class FancyDial {
|
||||
void read(ByteBuffer buffer) {
|
||||
EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, frameBuffer);
|
||||
buffer.position(0);
|
||||
GL11.glReadPixels(x0, y0, width, height, MipmapHelper.TEX_FORMAT, MipmapHelper.TEX_DATA_TYPE, buffer);
|
||||
GLStateManager.glReadPixels(x0, y0, width, height, MipmapHelper.TEX_FORMAT, MipmapHelper.TEX_DATA_TYPE, buffer);
|
||||
}
|
||||
|
||||
void write(ByteBuffer buffer) {
|
||||
GLAPI.glBindTexture(texture);
|
||||
buffer.position(0);
|
||||
GL11.glTexSubImage2D(
|
||||
GLStateManager.glTexSubImage2D(
|
||||
GL11.GL_TEXTURE_2D,
|
||||
0,
|
||||
x0,
|
||||
@@ -701,7 +702,7 @@ public class FancyDial {
|
||||
if (!deleted) {
|
||||
deleted = true;
|
||||
if (ownTexture) {
|
||||
GL11.glDeleteTextures(texture);
|
||||
GLStateManager.glDeleteTextures(texture);
|
||||
}
|
||||
EXTFramebufferObject.glDeleteFramebuffersEXT(frameBuffer);
|
||||
}
|
||||
@@ -714,7 +715,7 @@ public class FancyDial {
|
||||
}
|
||||
|
||||
private static int blankTexture(int width, int height) {
|
||||
int texture = GL11.glGenTextures();
|
||||
int texture = GLStateManager.glGenTextures();
|
||||
MipmapHelper.setupTexture(texture, width, height, "scratch");
|
||||
return texture;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.util.glu.GLU;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
import com.prupe.mcpatcher.mal.resource.GLAPI;
|
||||
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
|
||||
@@ -51,7 +52,7 @@ public class MipmapHelper {
|
||||
|
||||
anisoSupported = GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic;
|
||||
if (anisoSupported) {
|
||||
anisoMax = (int) GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
|
||||
anisoMax = (int) GLStateManager.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
|
||||
checkGLError("glGetFloat(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)");
|
||||
anisoLevel = Math.max(Math.min(MCPatcherForgeConfig.ExtendedHD.anisotropicFiltering, anisoMax), 1);
|
||||
} else {
|
||||
@@ -76,30 +77,30 @@ public class MipmapHelper {
|
||||
final int magFilter = blur ? GL11.GL_LINEAR : GL11.GL_NEAREST;
|
||||
final int minFilter = mipmaps > 0 ? GL11.GL_LINEAR_MIPMAP_LINEAR : magFilter;
|
||||
final int wrap = clamp ? GL11.GL_CLAMP : GL11.GL_REPEAT;
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, mipmaps);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, mipmaps);
|
||||
if (mipmaps > 0) {
|
||||
checkGLError("%s: set GL_TEXTURE_MAX_LEVEL = %d", textureName, mipmaps);
|
||||
if (anisoSupported && anisoLevel > 1) {
|
||||
GL11.glTexParameterf(
|
||||
GLStateManager.glTexParameterf(
|
||||
GL11.GL_TEXTURE_2D,
|
||||
EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT,
|
||||
anisoLevel);
|
||||
checkGLError("%s: set GL_TEXTURE_MAX_ANISOTROPY_EXT = %f", textureName, anisoLevel);
|
||||
}
|
||||
if (lodSupported) {
|
||||
GL11.glTexEnvi(
|
||||
GLStateManager.glTexEnvi(
|
||||
EXTTextureLODBias.GL_TEXTURE_FILTER_CONTROL_EXT,
|
||||
EXTTextureLODBias.GL_TEXTURE_LOD_BIAS_EXT,
|
||||
lodBias);
|
||||
checkGLError("%s: set GL_TEXTURE_LOD_BIAS_EXT = %d", textureName, lodBias);
|
||||
}
|
||||
}
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, minFilter);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, magFilter);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, wrap);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, wrap);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, minFilter);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, magFilter);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, wrap);
|
||||
GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, wrap);
|
||||
for (int level = 0; level <= mipmaps; level++) {
|
||||
GL11.glTexImage2D(
|
||||
GLStateManager.glTexImage2D(
|
||||
GL11.GL_TEXTURE_2D,
|
||||
level,
|
||||
GL11.GL_RGBA,
|
||||
@@ -172,11 +173,11 @@ public class MipmapHelper {
|
||||
}
|
||||
|
||||
static int getMipmapLevelsForCurrentTexture() {
|
||||
final int filter = GL11.glGetTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER);
|
||||
final int filter = GLStateManager.glGetTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER);
|
||||
if (filter != GL11.GL_NEAREST_MIPMAP_LINEAR && filter != GL11.GL_NEAREST_MIPMAP_NEAREST) {
|
||||
return 0;
|
||||
}
|
||||
return Math.min(maxMipmapLevel, GL11.glGetTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL));
|
||||
return Math.min(maxMipmapLevel, GLStateManager.glGetTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL));
|
||||
}
|
||||
|
||||
private static int gcd(int a, int b) {
|
||||
@@ -273,7 +274,7 @@ public class MipmapHelper {
|
||||
}
|
||||
|
||||
private static void checkGLError(String format, Object... params) {
|
||||
final int error = GL11.glGetError();
|
||||
final int error = GLStateManager.glGetError();
|
||||
if (error != 0) {
|
||||
final String message = GLU.gluErrorString(error) + ": " + String.format(format, params);
|
||||
new RuntimeException(message).printStackTrace();
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.MCPatcherUtils;
|
||||
|
||||
public class BlendMethod {
|
||||
@@ -155,38 +156,38 @@ public class BlendMethod {
|
||||
|
||||
public void applyFade(float fade) {
|
||||
if (fadeRGB && fadeAlpha) {
|
||||
GL11.glColor4f(fade, fade, fade, fade);
|
||||
GLStateManager.glColor4f(fade, fade, fade, fade);
|
||||
} else if (fadeRGB) {
|
||||
GL11.glColor4f(fade, fade, fade, 1.0f);
|
||||
GLStateManager.glColor4f(fade, fade, fade, 1.0f);
|
||||
} else if (fadeAlpha) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, fade);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, fade);
|
||||
}
|
||||
}
|
||||
|
||||
public void applyAlphaTest() {
|
||||
if (blend) {
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GLStateManager.glDisable(GL11.GL_ALPHA_TEST);
|
||||
} else {
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
GLStateManager.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GLStateManager.glAlphaFunc(GL11.GL_GREATER, 0.01f);
|
||||
}
|
||||
}
|
||||
|
||||
public void applyDepthFunc() {
|
||||
if (blend) {
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GLStateManager.glDepthFunc(GL11.GL_EQUAL);
|
||||
} else {
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glDepthMask(true);
|
||||
GLStateManager.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GLStateManager.glDepthMask(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void applyBlending() {
|
||||
if (blend) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GLStateManager.glEnable(GL11.GL_BLEND);
|
||||
GLAPI.glBlendFuncSeparate(srcBlend, dstBlend, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
} else {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GLStateManager.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
package com.prupe.mcpatcher.mal.resource;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
public class GLAPI {
|
||||
|
||||
private static final boolean useGlBlendFuncSeparate = GLContext.getCapabilities().OpenGL14;
|
||||
|
||||
public static void glBindTexture(int texture) {
|
||||
if (texture >= 0) {
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, texture);
|
||||
}
|
||||
}
|
||||
|
||||
public static void glBlendFuncSeparate(int src, int dst, int srcAlpha, int dstAlpha) {
|
||||
if (useGlBlendFuncSeparate) {
|
||||
GL14.glBlendFuncSeparate(src, dst, srcAlpha, dstAlpha);
|
||||
GLStateManager.glBlendFuncSeparate(src, dst, srcAlpha, dstAlpha);
|
||||
} else {
|
||||
GL11.glBlendFunc(src, dst);
|
||||
GLStateManager.glBlendFunc(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
import com.prupe.mcpatcher.mal.resource.PropertiesFile;
|
||||
import com.prupe.mcpatcher.mal.resource.TexturePackAPI;
|
||||
@@ -124,8 +125,8 @@ public class LineRenderer {
|
||||
TexturePackAPI.bindTexture(texture);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GLStateManager.glDisable(GL11.GL_CULL_FACE);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
dx += sx + plusSX;
|
||||
dy += sy + plusSY;
|
||||
dz += sz + plusSZ;
|
||||
@@ -177,7 +178,7 @@ public class LineRenderer {
|
||||
u0 = u1;
|
||||
}
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GLStateManager.glEnable(GL11.GL_CULL_FACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
import com.prupe.mcpatcher.MCPatcherUtils;
|
||||
import com.prupe.mcpatcher.ctm.CTMUtils;
|
||||
@@ -290,21 +291,21 @@ public class RenderPass {
|
||||
case RenderPassAPI.TRANSLUCENT_RENDER_PASS:
|
||||
case RenderPassAPI.BACKFACE_RENDER_PASS:
|
||||
if (!backfaceCulling[pass]) {
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GLStateManager.glDisable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
break;
|
||||
|
||||
case RenderPassAPI.OVERLAY_RENDER_PASS:
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glPolygonOffset(-2.0f, -2.0f);
|
||||
GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GLStateManager.glPolygonOffset(-2.0f, -2.0f);
|
||||
GLStateManager.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
if (backfaceCulling[pass]) {
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GLStateManager.glEnable(GL11.GL_CULL_FACE);
|
||||
} else {
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GLStateManager.glDisable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
if (ambientOcclusion) {
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
GLStateManager.glShadeModel(GL11.GL_SMOOTH);
|
||||
}
|
||||
blendMethod.applyBlending();
|
||||
break;
|
||||
@@ -323,18 +324,18 @@ public class RenderPass {
|
||||
case RenderPassAPI.TRANSLUCENT_RENDER_PASS:
|
||||
case RenderPassAPI.BACKFACE_RENDER_PASS:
|
||||
if (!backfaceCulling[currentRenderPass]) {
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GLStateManager.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
break;
|
||||
|
||||
case RenderPassAPI.OVERLAY_RENDER_PASS:
|
||||
GL11.glPolygonOffset(0.0f, 0.0f);
|
||||
GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
GLStateManager.glPolygonOffset(0.0f, 0.0f);
|
||||
GLStateManager.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
|
||||
if (!backfaceCulling[currentRenderPass]) {
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GLStateManager.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GLStateManager.glDisable(GL11.GL_BLEND);
|
||||
GLStateManager.glShadeModel(GL11.GL_FLAT);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
import com.prupe.mcpatcher.MCPatcherUtils;
|
||||
import com.prupe.mcpatcher.mal.resource.BlendMethod;
|
||||
@@ -384,42 +385,42 @@ public class SkyRenderer {
|
||||
TexturePackAPI.bindTexture(texture);
|
||||
setBlendingMethod(brightness);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GLStateManager.glPushMatrix();
|
||||
|
||||
if (rotate) {
|
||||
GL11.glRotatef(celestialAngle * 360.0f * speed, axis[0], axis[1], axis[2]);
|
||||
GLStateManager.glRotatef(celestialAngle * 360.0f * speed, axis[0], axis[1], axis[2]);
|
||||
}
|
||||
|
||||
// north
|
||||
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glRotatef(-90.0f, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GLStateManager.glRotatef(-90.0f, 0.0f, 0.0f, 1.0f);
|
||||
drawTile(4);
|
||||
|
||||
// top
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GLStateManager.glPushMatrix();
|
||||
GLStateManager.glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
|
||||
drawTile(1);
|
||||
GL11.glPopMatrix();
|
||||
GLStateManager.glPopMatrix();
|
||||
|
||||
// bottom
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
|
||||
GLStateManager.glPushMatrix();
|
||||
GLStateManager.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
|
||||
drawTile(0);
|
||||
GL11.glPopMatrix();
|
||||
GLStateManager.glPopMatrix();
|
||||
|
||||
// west
|
||||
GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
|
||||
drawTile(5);
|
||||
|
||||
// south
|
||||
GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
|
||||
drawTile(2);
|
||||
|
||||
// east
|
||||
GL11.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
|
||||
drawTile(3);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GLStateManager.glPopMatrix();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -440,14 +441,14 @@ public class SkyRenderer {
|
||||
blendMethod.applyFade(brightness);
|
||||
blendMethod.applyAlphaTest();
|
||||
blendMethod.applyBlending();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static void clearBlendingMethod() {
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GLStateManager.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GLStateManager.glEnable(GL11.GL_BLEND);
|
||||
GLAPI.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, rainStrength);
|
||||
GLStateManager.glColor4f(1.0f, 1.0f, 1.0f, rainStrength);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user