gpu optimization done
This commit is contained in:
@@ -11,6 +11,7 @@ import org.joml.Matrix4f;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
@@ -77,6 +78,11 @@ public class AccumulationBuffer {
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
RenderSystem.setShaderTexture(0, srcColorTex);
|
||||
|
||||
int prevTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, srcColorTex);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL33.GL_TEXTURE_SWIZZLE_A, GL11.GL_ONE);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, prevTex);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bb = tessellator.getBuffer();
|
||||
bb.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE);
|
||||
@@ -86,12 +92,19 @@ public class AccumulationBuffer {
|
||||
bb.vertex(-1f, 1f, 0f).texture(0f, 1f).next();
|
||||
tessellator.draw();
|
||||
|
||||
prevTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, srcColorTex);
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL33.GL_TEXTURE_SWIZZLE_A, GL11.GL_ALPHA);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, prevTex);
|
||||
|
||||
RenderSystem.getModelViewStack().pop();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
RenderSystem.setProjectionMatrix(savedProj, savedSorter);
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}
|
||||
|
||||
public ByteBuffer finishAveraged(int samples) {
|
||||
|
||||
Reference in New Issue
Block a user