mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-27 01:14:46 +00:00
Fetch MVP matrix in monitor shader instead (#454)
This commit is contained in:
parent
d929c02d2a
commit
4ff33f165d
@ -13,7 +13,6 @@ import dan200.computercraft.shared.util.Palette;
|
|||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
import org.lwjgl.opengl.GL13;
|
import org.lwjgl.opengl.GL13;
|
||||||
import org.lwjgl.opengl.GL20;
|
import org.lwjgl.opengl.GL20;
|
||||||
|
|
||||||
@ -27,12 +26,8 @@ class MonitorTextureBufferShader
|
|||||||
{
|
{
|
||||||
static final int TEXTURE_INDEX = GL13.GL_TEXTURE3;
|
static final int TEXTURE_INDEX = GL13.GL_TEXTURE3;
|
||||||
|
|
||||||
private static final FloatBuffer MATRIX_BUFFER = BufferUtils.createFloatBuffer( 16 );
|
|
||||||
private static final FloatBuffer PALETTE_BUFFER = BufferUtils.createFloatBuffer( 16 * 3 );
|
private static final FloatBuffer PALETTE_BUFFER = BufferUtils.createFloatBuffer( 16 * 3 );
|
||||||
|
|
||||||
private static int uniformMv;
|
|
||||||
private static int uniformP;
|
|
||||||
|
|
||||||
private static int uniformFont;
|
private static int uniformFont;
|
||||||
private static int uniformWidth;
|
private static int uniformWidth;
|
||||||
private static int uniformHeight;
|
private static int uniformHeight;
|
||||||
@ -45,16 +40,6 @@ class MonitorTextureBufferShader
|
|||||||
|
|
||||||
static void setupUniform( int width, int height, Palette palette, boolean greyscale )
|
static void setupUniform( int width, int height, Palette palette, boolean greyscale )
|
||||||
{
|
{
|
||||||
MATRIX_BUFFER.rewind();
|
|
||||||
GL11.glGetFloat( GL11.GL_MODELVIEW_MATRIX, MATRIX_BUFFER );
|
|
||||||
MATRIX_BUFFER.rewind();
|
|
||||||
OpenGlHelper.glUniformMatrix4( uniformMv, false, MATRIX_BUFFER );
|
|
||||||
|
|
||||||
MATRIX_BUFFER.rewind();
|
|
||||||
GL11.glGetFloat( GL11.GL_PROJECTION_MATRIX, MATRIX_BUFFER );
|
|
||||||
MATRIX_BUFFER.rewind();
|
|
||||||
OpenGlHelper.glUniformMatrix4( uniformP, false, MATRIX_BUFFER );
|
|
||||||
|
|
||||||
OpenGlHelper.glUniform1i( uniformWidth, width );
|
OpenGlHelper.glUniform1i( uniformWidth, width );
|
||||||
OpenGlHelper.glUniform1i( uniformHeight, height );
|
OpenGlHelper.glUniform1i( uniformHeight, height );
|
||||||
|
|
||||||
@ -123,9 +108,6 @@ class MonitorTextureBufferShader
|
|||||||
|
|
||||||
if( !ok ) return false;
|
if( !ok ) return false;
|
||||||
|
|
||||||
uniformMv = getUniformLocation( program, "u_mv" );
|
|
||||||
uniformP = getUniformLocation( program, "u_p" );
|
|
||||||
|
|
||||||
uniformFont = getUniformLocation( program, "u_font" );
|
uniformFont = getUniformLocation( program, "u_font" );
|
||||||
uniformWidth = getUniformLocation( program, "u_width" );
|
uniformWidth = getUniformLocation( program, "u_width" );
|
||||||
uniformHeight = getUniformLocation( program, "u_height" );
|
uniformHeight = getUniformLocation( program, "u_height" );
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
#version 140
|
#version 140
|
||||||
|
|
||||||
uniform mat4 u_mv;
|
|
||||||
uniform mat4 u_p;
|
|
||||||
|
|
||||||
in vec3 v_pos;
|
in vec3 v_pos;
|
||||||
|
|
||||||
out vec2 f_pos;
|
out vec2 f_pos;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = u_p * u_mv * vec4(v_pos.x, v_pos.y, 0, 1);
|
gl_Position = gl_ModelViewProjectionMatrix * vec4(v_pos.x, v_pos.y, 0, 1);
|
||||||
f_pos = v_pos.xy;
|
f_pos = v_pos.xy;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user