mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 05:12:16 +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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ package jss.notfine.gui.options.control.element;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.Option;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.control.ControlValueFormatter;
|
||||
import me.jellysquid.mods.sodium.client.util.Dim2i;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class SliderControlElement extends NotFineControlElement<Integer> {
|
||||
private final ControlValueFormatter formatter;
|
||||
@@ -42,7 +42,7 @@ public class SliderControlElement extends NotFineControlElement<Integer> {
|
||||
if(mousePressed) {
|
||||
updateSlider(mouseX);
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GLStateManager.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
drawTexturedModalRect(xPosition + (int)(value * (float)(width - 8)), yPosition, 0, 66, 4, 20);
|
||||
drawTexturedModalRect(xPosition + (int)(value * (float)(width - 8)) + 4, yPosition, 196, 66, 4, 20);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package jss.notfine.render;
|
||||
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.util.RandomXoshiro256StarStar;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
@@ -12,9 +13,9 @@ public class RenderStars {
|
||||
//private static final ResourceLocation locationStarsPng = new ResourceLocation("textures/colormap/stars.png");
|
||||
|
||||
public static void reloadStarRenderList(RenderGlobal render) {
|
||||
GL11.glNewList(render.starGLCallList, GL11.GL_COMPILE);
|
||||
GLStateManager.glNewList(render.starGLCallList, GL11.GL_COMPILE);
|
||||
renderStars();
|
||||
GL11.glEndList();
|
||||
GLStateManager.glEndList();
|
||||
}
|
||||
|
||||
public static void renderStars() {
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@ import me.jellysquid.mods.sodium.client.util.Dim2i;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -57,7 +56,7 @@ public abstract class AbstractFrame extends AbstractWidget implements ParentElem
|
||||
public void applyScissor(int x, int y, int width, int height, Runnable action) {
|
||||
final double scale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight).getScaleFactor();
|
||||
GLStateManager.enableScissorTest();
|
||||
GL11.glScissor((int) (x * scale), (int) (Minecraft.getMinecraft().getFramebuffer().framebufferHeight - (y + height) * scale), (int) (width * scale), (int) (height * scale));
|
||||
GLStateManager.glScissor((int) (x * scale), (int) (Minecraft.getMinecraft().getFramebuffer().framebufferHeight - (y + height) * scale), (int) (width * scale), (int) (height * scale));
|
||||
action.run();
|
||||
GLStateManager.disableScissorTest();
|
||||
}
|
||||
|
||||
+4
-3
@@ -14,6 +14,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ChatAllowedCharacters;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -176,12 +177,12 @@ public class SearchTextFieldComponent extends AbstractWidget {
|
||||
if (x1 > this.dim.getOriginX() + this.dim.getWidth()) {
|
||||
x1 = this.dim.getOriginX() + this.dim.getWidth();
|
||||
}
|
||||
GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
|
||||
GL11.glLogicOp(GL11.GL_OR_REVERSE);
|
||||
GLStateManager.glEnable(GL11.GL_COLOR_LOGIC_OP);
|
||||
GLStateManager.glLogicOp(GL11.GL_OR_REVERSE);
|
||||
|
||||
drawRect(x1, y1, x2, y2, -0xFFFF01);
|
||||
|
||||
GL11.glDisable(GL11.GL_COLOR_LOGIC_OP);
|
||||
GLStateManager.glDisable(GL11.GL_COLOR_LOGIC_OP);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ public abstract class AbstractWidget implements Drawable, Element {
|
||||
}
|
||||
|
||||
protected void drawQuads(Consumer<Tessellator> consumer) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.glEnable(GL11.GL_BLEND);
|
||||
GLStateManager.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.defaultBlendFunc();
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
@@ -42,8 +42,8 @@ public abstract class AbstractWidget implements Drawable, Element {
|
||||
consumer.accept(tessellator);
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GLStateManager.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GLStateManager.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
protected static void addQuad(Tessellator consumer, double x1, double y1, double x2, double y2, float a, float r, float g, float b) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coderbot.iris.gl.buffer;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import org.embeddedt.embeddium.impl.gl.debug.GLDebug;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -40,8 +41,8 @@ public class ShaderStorageBuffer {
|
||||
if (!info.relative()) return;
|
||||
|
||||
RenderSystem.deleteBuffers(id);
|
||||
int newId = GL15.glGenBuffers();
|
||||
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, newId);
|
||||
int newId = GLStateManager.glGenBuffers();
|
||||
GLStateManager.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, newId);
|
||||
|
||||
// Calculation time
|
||||
int newWidth = (int) (width * info.scaleX());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coderbot.iris.gl.buffer;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import net.coderbot.iris.gl.sampler.SamplerLimits;
|
||||
@@ -36,13 +37,13 @@ public class ShaderStorageBufferHolder {
|
||||
if (bufferInfo.relative()) {
|
||||
buffers[index].resizeIfRelative(width, height);
|
||||
} else {
|
||||
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, buffer);
|
||||
GLStateManager.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, buffer);
|
||||
RenderSystem.bufferStorage(GL43.GL_SHADER_STORAGE_BUFFER, bufferInfo.size(), 0);
|
||||
RenderSystem.clearBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, GL30.GL_R8, 0, bufferInfo.size(), GL11.GL_RED, GL11.GL_BYTE, new int[]{0});
|
||||
RenderSystem.bindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, index, buffer);
|
||||
}
|
||||
});
|
||||
GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
|
||||
GLStateManager.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
|
||||
}
|
||||
|
||||
private static long toMib(long x) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.coderbot.iris.gl.framebuffer;
|
||||
import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryStack.*;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.bytebuf.MemoryStack;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import com.gtnewhorizons.angelica.glsm.texture.TextureInfoCache;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntArrayMap;
|
||||
@@ -10,7 +11,6 @@ import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import java.nio.IntBuffer;
|
||||
import net.coderbot.iris.gl.GlResource;
|
||||
import net.coderbot.iris.gl.texture.DepthBufferFormat;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
@@ -25,8 +25,8 @@ public class GlFramebuffer extends GlResource {
|
||||
super(RenderSystem.createFramebuffer());
|
||||
|
||||
this.attachments = new Int2IntArrayMap();
|
||||
this.maxDrawBuffers = GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
this.maxColorAttachments = GL11.glGetInteger(GL30.GL_MAX_COLOR_ATTACHMENTS);
|
||||
this.maxDrawBuffers = GLStateManager.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
this.maxColorAttachments = GLStateManager.glGetInteger(GL30.GL_MAX_COLOR_ATTACHMENTS);
|
||||
this.hasDepthAttachment = false;
|
||||
}
|
||||
|
||||
@@ -91,26 +91,26 @@ public class GlFramebuffer extends GlResource {
|
||||
}
|
||||
|
||||
public void bind() {
|
||||
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_FRAMEBUFFER, getGlId());
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, getGlId());
|
||||
}
|
||||
|
||||
public void bindAsReadBuffer() {
|
||||
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_READ_FRAMEBUFFER, getGlId());
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, getGlId());
|
||||
}
|
||||
|
||||
public void bindAsDrawBuffer() {
|
||||
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_DRAW_FRAMEBUFFER, getGlId());
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, getGlId());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void destroyInternal() {
|
||||
OpenGlHelper.func_153174_h/*glDeleteFramebuffers*/(getGlId());
|
||||
GLStateManager.glDeleteFramebuffers(getGlId());
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
bind();
|
||||
|
||||
return OpenGlHelper.func_153167_i/*glCheckFramebufferStatus*/(GL30.GL_FRAMEBUFFER) == GL30.GL_FRAMEBUFFER_COMPLETE;
|
||||
return GLStateManager.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) == GL30.GL_FRAMEBUFFER_COMPLETE;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.coderbot.iris.shaderpack.FilledIndirectPointer;
|
||||
import org.joml.Vector2f;
|
||||
import org.joml.Vector3i;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import org.lwjgl.opengl.GL42;
|
||||
import org.lwjgl.opengl.GL43;
|
||||
|
||||
@@ -65,7 +65,7 @@ public final class ComputeProgram extends GlResource {
|
||||
}
|
||||
|
||||
public void use() {
|
||||
GL20.glUseProgram(getGlId());
|
||||
GLStateManager.glUseProgram(getGlId());
|
||||
|
||||
uniforms.update();
|
||||
samplers.update();
|
||||
@@ -87,13 +87,13 @@ public final class ComputeProgram extends GlResource {
|
||||
|
||||
public static void unbind() {
|
||||
ProgramUniforms.clearActiveUniforms();
|
||||
GL20.glUseProgram(0);
|
||||
GLStateManager.glUseProgram(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyInternal() {
|
||||
DepthColorStorage.unregisterOwnedProgram(getGlId());
|
||||
GL20.glDeleteProgram(getGlId());
|
||||
GLStateManager.glDeleteProgram(getGlId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.coderbot.iris.gl.program;
|
||||
|
||||
import net.coderbot.iris.gl.GlResource;
|
||||
import net.coderbot.iris.gl.blending.DepthColorStorage;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
public final class Program extends GlResource {
|
||||
private final ProgramUniforms uniforms;
|
||||
@@ -20,7 +20,7 @@ public final class Program extends GlResource {
|
||||
}
|
||||
|
||||
public void use() {
|
||||
GL20.glUseProgram(getGlId());
|
||||
GLStateManager.glUseProgram(getGlId());
|
||||
|
||||
uniforms.update();
|
||||
samplers.update();
|
||||
@@ -30,13 +30,13 @@ public final class Program extends GlResource {
|
||||
public static void unbind() {
|
||||
ProgramUniforms.clearActiveUniforms();
|
||||
ProgramSamplers.clearActiveSamplers();
|
||||
GL20.glUseProgram(0);
|
||||
GLStateManager.glUseProgram(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyInternal() {
|
||||
DepthColorStorage.unregisterOwnedProgram(getGlId());
|
||||
GL20.glDeleteProgram(getGlId());
|
||||
GLStateManager.glDeleteProgram(getGlId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.coderbot.iris.gl.image.ImageBinding;
|
||||
import net.coderbot.iris.gl.image.ImageHolder;
|
||||
import net.coderbot.iris.gl.image.ImageLimits;
|
||||
import net.coderbot.iris.gl.texture.InternalTextureFormat;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -60,12 +60,12 @@ public class ProgramImages {
|
||||
|
||||
@Override
|
||||
public boolean hasImage(String name) {
|
||||
return GL20.glGetUniformLocation(program, name) != -1;
|
||||
return GLStateManager.glGetUniformLocation(program, name) != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTextureImage(IntSupplier textureID, InternalTextureFormat internalFormat, String name) {
|
||||
int location = GL20.glGetUniformLocation(program, name);
|
||||
int location = GLStateManager.glGetUniformLocation(program, name);
|
||||
|
||||
if (location == -1) {
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coderbot.iris.gl.sampler;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
@@ -12,9 +13,9 @@ public class SamplerLimits {
|
||||
private final int maxShaderStorageUnits;
|
||||
|
||||
private SamplerLimits() {
|
||||
this.maxTextureUnits = GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS);
|
||||
this.maxDrawBuffers = GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
this.maxShaderStorageUnits = RenderSystem.supportsSSBO() ? GL11.glGetInteger(GL43.GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS) : 0;
|
||||
this.maxTextureUnits = GLStateManager.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS);
|
||||
this.maxDrawBuffers = GLStateManager.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
this.maxShaderStorageUnits = RenderSystem.supportsSSBO() ? GLStateManager.glGetInteger(GL43.GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS) : 0;
|
||||
}
|
||||
|
||||
public static SamplerLimits get() {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package net.coderbot.iris.gl.shader;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLDebug;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import net.coderbot.iris.gl.GlResource;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -28,12 +29,12 @@ public class GlShader extends GlResource {
|
||||
}
|
||||
|
||||
private static int createShader(ShaderType type, String name, String src) {
|
||||
int handle = GL20.glCreateShader(type.id);
|
||||
int handle = GLStateManager.glCreateShader(type.id);
|
||||
// TODO: Iris
|
||||
// ShaderWorkarounds.safeShaderSource(handle, src);
|
||||
// TODO: ShaderWorkaround
|
||||
GL20.glShaderSource(handle, src + '\0');
|
||||
GL20.glCompileShader(handle);
|
||||
GLStateManager.glShaderSource(handle, src + '\0');
|
||||
GLStateManager.glCompileShader(handle);
|
||||
|
||||
GLDebug.nameObject(KHRDebug.GL_SHADER, handle, name + "(" + type.name().toLowerCase(Locale.ROOT) + ")");
|
||||
|
||||
@@ -43,7 +44,7 @@ public class GlShader extends GlResource {
|
||||
LOGGER.warn("Shader compilation log for " + name + ": " + log);
|
||||
}
|
||||
|
||||
int result = GL20.glGetShaderi(handle, GL20.GL_COMPILE_STATUS);
|
||||
int result = GLStateManager.glGetShaderi(handle, GL20.GL_COMPILE_STATUS);
|
||||
|
||||
if (result != GL11.GL_TRUE) {
|
||||
throw new RuntimeException("Shader compilation failed, see log for details");
|
||||
@@ -62,6 +63,6 @@ public class GlShader extends GlResource {
|
||||
|
||||
@Override
|
||||
protected void destroyInternal() {
|
||||
GL20.glDeleteShader(this.getGlId());
|
||||
GLStateManager.glDeleteShader(this.getGlId());
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
package net.coderbot.iris.gl.shader;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLDebug;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -20,7 +21,7 @@ public class ProgramCreator {
|
||||
public static final int AT_MIDBLOCK = 14;
|
||||
|
||||
public static int create(String name, GlShader... shaders) {
|
||||
int program = GL20.glCreateProgram();
|
||||
int program = GLStateManager.glCreateProgram();
|
||||
|
||||
// TODO: This is *really* hardcoded, we need to refactor this to support external calls to glBindAttribLocation
|
||||
RenderSystem.bindAttributeLocation(program, MC_ENTITY, "mc_Entity");
|
||||
@@ -29,10 +30,10 @@ public class ProgramCreator {
|
||||
RenderSystem.bindAttributeLocation(program, AT_MIDBLOCK, "at_midBlock");
|
||||
|
||||
for (GlShader shader : shaders) {
|
||||
GL20.glAttachShader(program, shader.getHandle());
|
||||
GLStateManager.glAttachShader(program, shader.getHandle());
|
||||
}
|
||||
|
||||
GL20.glLinkProgram(program);
|
||||
GLStateManager.glLinkProgram(program);
|
||||
|
||||
GLDebug.nameObject(KHRDebug.GL_PROGRAM, program, name);
|
||||
|
||||
@@ -47,7 +48,7 @@ public class ProgramCreator {
|
||||
LOGGER.warn("Program link log for " + name + ": " + log);
|
||||
}
|
||||
|
||||
int result = GL20.glGetProgrami(program, GL20.GL_LINK_STATUS);
|
||||
int result = GLStateManager.glGetProgrami(program, GL20.GL_LINK_STATUS);
|
||||
|
||||
if (result != GL11.GL_TRUE) {
|
||||
throw new RuntimeException("Shader program linking failed, see log for details");
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.coderbot.iris.texture.format.TextureFormat;
|
||||
import net.coderbot.iris.texture.format.TextureFormatLoader;
|
||||
import net.coderbot.iris.uniforms.VanillaBiomeList;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
@@ -146,7 +147,7 @@ public class StandardMacros {
|
||||
* @see <a href="https://github.com/sp614x/optifine/blob/9c6a5b5326558ccc57c6490b66b3be3b2dc8cbef/OptiFineDoc/doc/shaders.txt#L705-L707">Optifine Doc for GLSL Version</a>
|
||||
*/
|
||||
public static String getGlVersion(int name) {
|
||||
final String info = GL11.glGetString(name);
|
||||
final String info = GLStateManager.glGetString(name);
|
||||
|
||||
Matcher matcher = SEMVER_PATTERN.matcher(Objects.requireNonNull(info));
|
||||
|
||||
@@ -208,7 +209,7 @@ public class StandardMacros {
|
||||
* @see <a href="https://github.com/sp614x/optifine/blob/9c6a5b5326558ccc57c6490b66b3be3b2dc8cbef/OptiFineDoc/doc/shaders.txt#L716-L723">Optifine Doc</a>
|
||||
*/
|
||||
public static String getVendor() {
|
||||
String vendor = Objects.requireNonNull(GL11.glGetString(GL11.GL_VENDOR)).toLowerCase(Locale.ROOT);
|
||||
String vendor = Objects.requireNonNull(GLStateManager.glGetString(GL11.GL_VENDOR)).toLowerCase(Locale.ROOT);
|
||||
if (vendor.startsWith("ati")) {
|
||||
return "MC_GL_VENDOR_ATI";
|
||||
} else if (vendor.startsWith("intel")) {
|
||||
@@ -230,7 +231,7 @@ public class StandardMacros {
|
||||
* @see <a href="https://github.com/sp614x/optifine/blob/9c6a5b5326558ccc57c6490b66b3be3b2dc8cbef/OptiFineDoc/doc/shaders.txt#L725-L733">Optifine Doc</a>
|
||||
*/
|
||||
public static String getRenderer() {
|
||||
String renderer = Objects.requireNonNull(GL11.glGetString(GL11.GL_RENDERER)).toLowerCase(Locale.ROOT);
|
||||
String renderer = Objects.requireNonNull(GLStateManager.glGetString(GL11.GL_RENDERER)).toLowerCase(Locale.ROOT);
|
||||
if (renderer.startsWith("amd")) {
|
||||
return "MC_GL_RENDERER_RADEON";
|
||||
} else if (renderer.startsWith("ati")) {
|
||||
@@ -263,10 +264,10 @@ public class StandardMacros {
|
||||
* @see <a href="https://github.com/sp614x/optifine/blob/9c6a5b5326558ccc57c6490b66b3be3b2dc8cbef/OptiFineDoc/doc/shaders.txt#L735-L738">Optifine Doc</a>
|
||||
*/
|
||||
public static Set<String> getGlExtensions() {
|
||||
int numExtensions = GL11.glGetInteger(GL30.GL_NUM_EXTENSIONS);
|
||||
int numExtensions = GLStateManager.glGetInteger(GL30.GL_NUM_EXTENSIONS);
|
||||
String[] extensions = new String[numExtensions];
|
||||
for (int i = 0; i < numExtensions; i++) {
|
||||
extensions[i] = GL30.glGetStringi(GL11.GL_EXTENSIONS, i);
|
||||
extensions[i] = GLStateManager.glGetStringi(GL11.GL_EXTENSIONS, i);
|
||||
}
|
||||
|
||||
// TODO note that we do not add extensions based on if the shader uses them and if they are supported
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import net.coderbot.iris.gl.framebuffer.GlFramebuffer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL43;
|
||||
|
||||
public interface DepthCopyStrategy {
|
||||
// FB -> T
|
||||
@@ -73,7 +72,7 @@ public interface DepthCopyStrategy {
|
||||
|
||||
@Override
|
||||
public void copy(GlFramebuffer sourceFb, int sourceTexture, GlFramebuffer destFb, int destTexture, int width, int height) {
|
||||
GL43.glCopyImageSubData(sourceTexture, GL11.GL_TEXTURE_2D, 0, 0, 0, 0, destTexture, GL11.GL_TEXTURE_2D, 0, 0, 0, 0, width, height, 1);
|
||||
GLStateManager.glCopyImageSubData(sourceTexture, GL11.GL_TEXTURE_2D, 0, 0, 0, 0, destTexture, GL11.GL_TEXTURE_2D, 0, 0, 0, 0, width, height, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class GlTexture extends GlObject implements TextureAccess {
|
||||
private final TextureType target;
|
||||
|
||||
public GlTexture(TextureType target, int sizeX, int sizeY, int sizeZ, int internalFormat, int format, int pixelType, byte[] pixels, TextureFilteringData filteringData) {
|
||||
this.setHandle(GL11.glGenTextures());
|
||||
this.setHandle(GLStateManager.glGenTextures());
|
||||
bindTextureForSetup(target.getGlType(), handle());
|
||||
|
||||
TextureUploadHelper.resetTextureUploadState();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coderbot.iris.gl.texture;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TextureUploadHelper {
|
||||
@@ -14,9 +15,9 @@ public class TextureUploadHelper {
|
||||
// It is likely that this also avoids the crashes on AMD that I previously experienced with texture creation.
|
||||
//
|
||||
// This code is from Canvas: https://github.com/grondag/canvas/commit/f0ab652d7a8b7cc9febf0209bee15cffce9eac83
|
||||
GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0);
|
||||
GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, 0);
|
||||
GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, 0);
|
||||
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 4);
|
||||
GLStateManager.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0);
|
||||
GLStateManager.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, 0);
|
||||
GLStateManager.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, 0);
|
||||
GLStateManager.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 4);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@ package net.coderbot.iris.layer;
|
||||
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import net.coderbot.iris.gl.shader.ProgramCreator;
|
||||
import net.coderbot.iris.pipeline.WorldRenderingPhase;
|
||||
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
public class GbufferPrograms {
|
||||
private static boolean entities;
|
||||
@@ -67,10 +67,10 @@ public class GbufferPrograms {
|
||||
}
|
||||
|
||||
public static void setBlockEntityDefaults() {
|
||||
GL20.glVertexAttrib2s(ProgramCreator.MC_ENTITY, (short)-1, (short)-1);
|
||||
GL20.glVertexAttrib2f(ProgramCreator.MC_MID_TEX_COORD, 0.5f, 0.5f);
|
||||
GL20.glVertexAttrib4f(ProgramCreator.AT_TANGENT, 1.0f, 0.0f, 0.0f, 1.0f);
|
||||
GL20.glVertexAttrib4f(ProgramCreator.AT_MIDBLOCK, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
GLStateManager.glVertexAttrib2s(ProgramCreator.MC_ENTITY, (short)-1, (short)-1);
|
||||
GLStateManager.glVertexAttrib2f(ProgramCreator.MC_MID_TEX_COORD, 0.5f, 0.5f);
|
||||
GLStateManager.glVertexAttrib4f(ProgramCreator.AT_TANGENT, 1.0f, 0.0f, 0.0f, 1.0f);
|
||||
GLStateManager.glVertexAttrib4f(ProgramCreator.AT_MIDBLOCK, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
public static WorldRenderingPhase getCurrentPhase() {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ClearPass {
|
||||
GLStateManager.glClearColor(color.x, color.y, color.z, color.w);
|
||||
GLStateManager.glClear(clearFlags);
|
||||
if (Minecraft.isRunningOnMac) {
|
||||
GL11.glGetError();
|
||||
GLStateManager.glGetError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.coderbot.iris.shaderpack.PackShadowDirectives;
|
||||
import net.coderbot.iris.shadows.ShadowRenderTargets;
|
||||
import org.joml.Vector2i;
|
||||
import org.joml.Vector4f;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
@@ -21,7 +22,7 @@ import java.util.Map;
|
||||
public class ClearPassCreator {
|
||||
public static ImmutableList<ClearPass> createClearPasses(RenderTargets renderTargets, boolean fullClear,
|
||||
PackRenderTargetDirectives renderTargetDirectives) {
|
||||
final int maxDrawBuffers = GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
final int maxDrawBuffers = GLStateManager.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
|
||||
// Sort buffers by their clear color so we can group up glClear calls.
|
||||
Map<Vector2i, Map<ClearPassInformation, IntList>> clearByColor = new HashMap<>();
|
||||
@@ -81,7 +82,7 @@ public class ClearPassCreator {
|
||||
|
||||
public static ImmutableList<ClearPass> createShadowClearPasses(ShadowRenderTargets renderTargets, boolean fullClear,
|
||||
PackShadowDirectives renderTargetDirectives) {
|
||||
final int maxDrawBuffers = GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
final int maxDrawBuffers = GLStateManager.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS);
|
||||
|
||||
// Sort buffers by their clear color so we can group up glClear calls.
|
||||
Map<Vector4f, IntList> clearByColor = new HashMap<>();
|
||||
|
||||
@@ -164,7 +164,7 @@ public class CustomTextureManager {
|
||||
|
||||
final TextureFormat textureFormat = TextureFormatLoader.getFormat();
|
||||
if (textureFormat != null) {
|
||||
final int previousBinding = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
final int previousBinding = GLStateManager.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, pbrTexture.getGlTextureId());
|
||||
textureFormat.setupTextureParameters(pbrType, pbrTexture);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, previousBinding);
|
||||
|
||||
@@ -1134,7 +1134,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
shadowRenderTargets.getDepthSourceFb().bind();
|
||||
GLStateManager.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
if (Minecraft.isRunningOnMac) {
|
||||
GL11.glGetError();
|
||||
GLStateManager.glGetError();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ public class CenterDepthSampler {
|
||||
private boolean destroyed;
|
||||
|
||||
public CenterDepthSampler(IntSupplier depthSupplier, float halfLife) {
|
||||
this.texture = GL11.glGenTextures();
|
||||
this.altTexture = GL11.glGenTextures();
|
||||
this.texture = GLStateManager.glGenTextures();
|
||||
this.altTexture = GLStateManager.glGenTextures();
|
||||
this.framebuffer = new GlFramebuffer();
|
||||
|
||||
// Fall back to a less precise format if the system doesn't support OpenGL 3
|
||||
|
||||
@@ -36,7 +36,6 @@ import net.coderbot.iris.uniforms.CommonUniforms;
|
||||
import net.coderbot.iris.uniforms.FrameUpdateNotifier;
|
||||
import net.coderbot.iris.uniforms.custom.CustomUniforms;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -144,7 +143,7 @@ public class FinalPassRenderer {
|
||||
|
||||
this.swapPasses = swapPasses.build();
|
||||
|
||||
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_READ_FRAMEBUFFER, 0);
|
||||
GLStateManager.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
private static Map<PatchShaderType, String> getTransformed(ProgramSource source, CompletableFuture<Map<PatchShaderType, String>> precomputedTransformFuture, String stageName) {
|
||||
@@ -276,7 +275,7 @@ public class FinalPassRenderer {
|
||||
swapPass.from.bind();
|
||||
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, swapPass.targetTexture);
|
||||
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, swapPass.width, swapPass.height);
|
||||
GLStateManager.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, swapPass.width, swapPass.height);
|
||||
}
|
||||
|
||||
// Make sure to reset the viewport to how it was before... Otherwise weird issues could occur.
|
||||
|
||||
@@ -22,12 +22,12 @@ public class FullScreenQuadRenderer {
|
||||
public static final FullScreenQuadRenderer INSTANCE = new FullScreenQuadRenderer();
|
||||
|
||||
private FullScreenQuadRenderer() {
|
||||
this.vao = org.lwjgl.opengl.GL30.glGenVertexArrays();
|
||||
this.vao = GLStateManager.glGenVertexArrays();
|
||||
GLStateManager.glBindVertexArray(vao);
|
||||
this.quadBuffer = createQuad();
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, quadBuffer);
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, quadBuffer);
|
||||
DefaultVertexFormat.POSITION_TEXTURE.setupBufferState(0L);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GLStateManager.glBindVertexArray(0);
|
||||
}
|
||||
|
||||
@@ -79,14 +79,14 @@ public class FullScreenQuadRenderer {
|
||||
private static final Int2ObjectOpenHashMap<int[]> compositeLocCache = new Int2ObjectOpenHashMap<>();
|
||||
|
||||
public static void uploadCompositeMatrices() {
|
||||
final int program = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
|
||||
final int program = GLStateManager.glGetInteger(GL20.GL_CURRENT_PROGRAM);
|
||||
if (program == 0) return;
|
||||
|
||||
int[] locs = compositeLocCache.get(program);
|
||||
if (locs == null) {
|
||||
locs = new int[] {
|
||||
GL20.glGetUniformLocation(program, "iris_ModelViewMatrix"),
|
||||
GL20.glGetUniformLocation(program, "iris_ProjectionMatrix")
|
||||
GLStateManager.glGetUniformLocation(program, "iris_ModelViewMatrix"),
|
||||
GLStateManager.glGetUniformLocation(program, "iris_ProjectionMatrix")
|
||||
};
|
||||
compositeLocCache.put(program, locs);
|
||||
}
|
||||
@@ -94,13 +94,13 @@ public class FullScreenQuadRenderer {
|
||||
if (locs[0] != -1) {
|
||||
GLStateManager.getModelViewMatrix().get(matBuf);
|
||||
matBuf.rewind();
|
||||
GL20.glUniformMatrix4(locs[0], false, matBuf);
|
||||
GLStateManager.glUniformMatrix4(locs[0], false, matBuf);
|
||||
}
|
||||
|
||||
if (locs[1] != -1) {
|
||||
GLStateManager.getProjectionMatrix().get(matBuf);
|
||||
matBuf.rewind();
|
||||
GL20.glUniformMatrix4(locs[1], false, matBuf);
|
||||
GLStateManager.glUniformMatrix4(locs[1], false, matBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import net.coderbot.iris.gl.GlResource;
|
||||
import net.coderbot.iris.gl.texture.TextureUploadHelper;
|
||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ColorTexture extends GlResource {
|
||||
TextureUploadHelper.resetTextureUploadState();
|
||||
RenderSystem.texImage2D(texture, GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (ByteBuffer) null);
|
||||
|
||||
EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, texture, 0);
|
||||
GLStateManager.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture, 0);
|
||||
}
|
||||
|
||||
public int getTextureId() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.coderbot.iris.rendertarget;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.mojang.NativeImage;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -28,8 +29,8 @@ public class NativeImageBackedNoiseTexture extends DynamicTexture {
|
||||
|
||||
@Override
|
||||
public void updateDynamicTexture() {
|
||||
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);
|
||||
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);
|
||||
super.updateDynamicTexture();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class NoiseTexture extends GlResource {
|
||||
TextureUploadHelper.resetTextureUploadState();
|
||||
|
||||
// Since we're using tightly-packed RGB data, we must use an alignment of 1 byte instead of the usual 4 bytes.
|
||||
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
|
||||
GLStateManager.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
|
||||
RenderSystem.texImage2D(texture, GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, 0);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class RenderTarget {
|
||||
|
||||
try (MemoryStack stack = stackPush()) {
|
||||
IntBuffer textures = stack.mallocInt(2);
|
||||
GL11.glGenTextures(textures);
|
||||
GLStateManager.glGenTextures(textures);
|
||||
|
||||
this.mainTexture = textures.get(0);
|
||||
this.altTexture = textures.get(1);
|
||||
|
||||
@@ -77,7 +77,7 @@ public class PBRTextureManager {
|
||||
Class<? extends AbstractTexture> clazz = texture.getClass();
|
||||
PBRTextureLoader loader = PBRTextureLoaderRegistry.INSTANCE.getLoader(clazz);
|
||||
if (loader != null) {
|
||||
int previousTextureBinding = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
int previousTextureBinding = GLStateManager.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
consumer.clear();
|
||||
try {
|
||||
loader.load(texture, Minecraft.getMinecraft().getResourceManager(), consumer);
|
||||
|
||||
@@ -21,12 +21,12 @@ public class TextureManipulationUtil {
|
||||
colorFillFBO = OpenGlHelper.func_153165_e/*glGenFramebuffers*/();
|
||||
}
|
||||
|
||||
final int previousFramebufferId = GL11.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING);
|
||||
final int previousFramebufferId = GLStateManager.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING);
|
||||
final FloatBuffer previousClearColorBuffer = stack.mallocFloat(4);
|
||||
GL11.glGetFloat(GL11.GL_COLOR_CLEAR_VALUE, previousClearColorBuffer);
|
||||
final int previousTextureId = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
GLStateManager.glGetFloat(GL11.GL_COLOR_CLEAR_VALUE, previousClearColorBuffer);
|
||||
final int previousTextureId = GLStateManager.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
final IntBuffer previousViewportBuffer = stack.mallocInt(4);
|
||||
GL11.glGetInteger(GL11.GL_VIEWPORT, previousViewportBuffer);
|
||||
GLStateManager.glGetInteger(GL11.GL_VIEWPORT, previousViewportBuffer);
|
||||
|
||||
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_FRAMEBUFFER, colorFillFBO);
|
||||
GLStateManager.glClearColor(
|
||||
@@ -36,10 +36,10 @@ public class TextureManipulationUtil {
|
||||
(rgba & 0xFF) / 255.0f);
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
|
||||
for (int level = 0; level <= maxLevel; ++level) {
|
||||
final int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
|
||||
final int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
|
||||
final int width = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
|
||||
final int height = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
|
||||
GLStateManager.glViewport(0, 0, width, height);
|
||||
GL30.glFramebufferTexture2D(
|
||||
GLStateManager.glFramebufferTexture2D(
|
||||
GL30.GL_FRAMEBUFFER,
|
||||
GL30.GL_COLOR_ATTACHMENT0,
|
||||
GL11.GL_TEXTURE_2D,
|
||||
@@ -47,10 +47,10 @@ public class TextureManipulationUtil {
|
||||
level);
|
||||
GLStateManager.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
if (Minecraft.isRunningOnMac) {
|
||||
GL11.glGetError();
|
||||
GLStateManager.glGetError();
|
||||
}
|
||||
|
||||
GL30.glFramebufferTexture2D(
|
||||
GLStateManager.glFramebufferTexture2D(
|
||||
GL30.GL_FRAMEBUFFER,
|
||||
GL30.GL_COLOR_ATTACHMENT0,
|
||||
GL11.GL_TEXTURE_2D,
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.coderbot.iris.uniforms.custom.cached;
|
||||
import kroppeb.stareval.function.FunctionReturn;
|
||||
import kroppeb.stareval.function.Type;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class BooleanCachedUniform extends CachedUniform {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform1i(location, this.cached ? 1 : 0);
|
||||
GLStateManager.glUniform1i(location, this.cached ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package net.coderbot.iris.uniforms.custom.cached;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.parsing.VectorType;
|
||||
import org.joml.Vector2f;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Float2VectorCachedUniform extends VectorCachedUniform<Vector2f> {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform2f(location, this.cached.x, this.cached.y);
|
||||
GLStateManager.glUniform2f(location, this.cached.x, this.cached.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package net.coderbot.iris.uniforms.custom.cached;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.parsing.VectorType;
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Float3VectorCachedUniform extends VectorCachedUniform<Vector3f> {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform3f(location, this.cached.x, this.cached.y, this.cached.z);
|
||||
GLStateManager.glUniform3f(location, this.cached.x, this.cached.y, this.cached.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package net.coderbot.iris.uniforms.custom.cached;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.parsing.MatrixType;
|
||||
import org.joml.Matrix4f;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
@@ -26,7 +26,7 @@ public class Float4MatrixCachedUniform extends VectorCachedUniform<Matrix4f> {
|
||||
public void push(int location) {
|
||||
// `gets` the values from the matrix and put's them into a buffer
|
||||
this.cached.get(buffer);
|
||||
GL20.glUniformMatrix4(location, false, buffer);
|
||||
GLStateManager.glUniformMatrix4(location, false, buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package net.coderbot.iris.uniforms.custom.cached;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.parsing.VectorType;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Float4VectorCachedUniform extends VectorCachedUniform<Vector4f> {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform4f(location, this.cached.x, this.cached.y, this.cached.z, this.cached.w);
|
||||
GLStateManager.glUniform4f(location, this.cached.x, this.cached.y, this.cached.z, this.cached.w);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@ import kroppeb.stareval.function.FunctionReturn;
|
||||
import kroppeb.stareval.function.Type;
|
||||
import net.coderbot.iris.gl.uniform.FloatSupplier;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
public class FloatCachedUniform extends CachedUniform {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FloatCachedUniform extends CachedUniform {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform1f(location, this.cached);
|
||||
GLStateManager.glUniform1f(location, this.cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@ import kroppeb.stareval.function.FunctionReturn;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.parsing.VectorType;
|
||||
import org.joml.Vector2i;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Int2VectorCachedUniform extends VectorCachedUniform<Vector2i> {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform2i(location, this.cached.x, this.cached.y);
|
||||
GLStateManager.glUniform2i(location, this.cached.x, this.cached.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.coderbot.iris.uniforms.custom.cached;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import net.coderbot.iris.parsing.VectorType;
|
||||
import org.joml.Vector3i;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Int3VectorCachedUniform extends VectorCachedUniform<Vector3i> {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform3i(location, this.cached.x, this.cached.y, this.cached.z);
|
||||
GLStateManager.glUniform3i(location, this.cached.x, this.cached.y, this.cached.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.coderbot.iris.uniforms.custom.cached;
|
||||
import kroppeb.stareval.function.FunctionReturn;
|
||||
import kroppeb.stareval.function.Type;
|
||||
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class IntCachedUniform extends CachedUniform {
|
||||
|
||||
@Override
|
||||
public void push(int location) {
|
||||
GL20.glUniform1i(location, this.cached);
|
||||
GLStateManager.glUniform1i(location, this.cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user