FIXED RAINBOW GLITCH!!!

This commit is contained in:
LAX1DUDE 2022-03-30 17:14:38 -07:00
parent b56976955b
commit 259f93ccd5
4 changed files with 38 additions and 33 deletions

View File

@ -60,6 +60,7 @@ import de.cuina.fireandfuel.CodecJLayerMP3;
import net.lax1dude.eaglercraft.AssetRepository; import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.EarlyLoadScreen; import net.lax1dude.eaglercraft.EarlyLoadScreen;
import net.lax1dude.eaglercraft.ServerQuery; import net.lax1dude.eaglercraft.ServerQuery;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ProgramGL;
import net.lax1dude.eaglercraft.adapter.lwjgl.GameWindowListener; import net.lax1dude.eaglercraft.adapter.lwjgl.GameWindowListener;
import net.minecraft.src.MathHelper; import net.minecraft.src.MathHelper;
import paulscode.sound.SoundSystem; import paulscode.sound.SoundSystem;
@ -593,6 +594,9 @@ public class EaglerAdapterImpl2 {
public static final float _wglGetTexParameterf(int p1) { public static final float _wglGetTexParameterf(int p1) {
return GL11.glGetTexParameterf(GL11.GL_TEXTURE_2D, p1); return GL11.glGetTexParameterf(GL11.GL_TEXTURE_2D, p1);
} }
public static final int _wglGetAttribLocation(ProgramGL p1, String p2) {
return GL20.glGetAttribLocation(p1.obj, p2);
}
// ======================================================================================= // =======================================================================================

View File

@ -55,6 +55,7 @@ public class EarlyLoadScreen {
_wglAttachShader(program, vert); _wglAttachShader(program, vert);
_wglAttachShader(program, frag); _wglAttachShader(program, frag);
_wglBindAttributeLocation(program, 0, "a_pos");
_wglLinkProgram(program); _wglLinkProgram(program);
_wglDetachShader(program, vert); _wglDetachShader(program, vert);
_wglDetachShader(program, frag); _wglDetachShader(program, frag);
@ -68,7 +69,6 @@ public class EarlyLoadScreen {
} }
_wglUseProgram(program); _wglUseProgram(program);
_wglBindAttributeLocation(program, 0, "a_pos");
_wglUniform1i(_wglGetUniformLocation(program, "tex"), 0); _wglUniform1i(_wglGetUniformLocation(program, "tex"), 0);
int width = getCanvasWidth(); int width = getCanvasWidth();

View File

@ -426,6 +426,7 @@ public class EffectPipeline {
_wglAttachShader(prog, pvert_shader); _wglAttachShader(prog, pvert_shader);
_wglAttachShader(prog, f); _wglAttachShader(prog, f);
_wglBindAttributeLocation(prog, 0, "a_pos");
_wglLinkProgram(prog); _wglLinkProgram(prog);
_wglDetachShader(prog, pvert_shader); _wglDetachShader(prog, pvert_shader);
_wglDetachShader(prog, f); _wglDetachShader(prog, f);
@ -444,7 +445,6 @@ public class EffectPipeline {
UniformGL d = _wglGetUniformLocation(prog, "f_depth"); UniformGL d = _wglGetUniformLocation(prog, "f_depth");
if(d != null) _wglUniform1i(d, 1); if(d != null) _wglUniform1i(d, 1);
_wglBindAttributeLocation(prog, 0, "a_pos");
if(_wglGetUniformLocation(prog, "ssao_kernel[0]") != null) { if(_wglGetUniformLocation(prog, "ssao_kernel[0]") != null) {
EaglercraftRandom r = new EaglercraftRandom("eeeaglerrENOPHILEr".hashCode()); EaglercraftRandom r = new EaglercraftRandom("eeeaglerrENOPHILEr".hashCode());

View File

@ -200,6 +200,38 @@ public class FixedFunctionShader {
globject = _wglCreateProgram(); globject = _wglCreateProgram();
_wglAttachShader(globject, v); _wglAttachShader(globject, v);
_wglAttachShader(globject, f); _wglAttachShader(globject, f);
int i = 0;
a_position = i++;
_wglBindAttributeLocation(globject, a_position, "a_position");
if(enable_texture0) {
a_texture0 = i++;
_wglBindAttributeLocation(globject, a_texture0, "a_texture0");
}else {
a_texture0 = -1;
}
if(enable_color) {
a_color = i++;
_wglBindAttributeLocation(globject, a_color, "a_color");
}else {
a_color = -1;
}
if(enable_normal) {
a_normal = i++;
_wglBindAttributeLocation(globject, a_normal, "a_normal");
}else {
a_normal = -1;
}
if(enable_texture1) {
a_texture1 = i++;
_wglBindAttributeLocation(globject, a_texture1, "a_texture1");
}else {
a_texture1 = -1;
}
attributeIndexesToEnable = i;
_wglLinkProgram(globject); _wglLinkProgram(globject);
_wglDetachShader(globject, v); _wglDetachShader(globject, v);
@ -263,37 +295,6 @@ public class FixedFunctionShader {
u_texCoordV0 = _wglGetUniformLocation(globject, "texCoordV0"); u_texCoordV0 = _wglGetUniformLocation(globject, "texCoordV0");
u_texCoordV1 = _wglGetUniformLocation(globject, "texCoordV1"); u_texCoordV1 = _wglGetUniformLocation(globject, "texCoordV1");
int i = 0;
a_position = i++;
_wglBindAttributeLocation(globject, a_position, "a_position");
if(enable_texture0) {
a_texture0 = i++;
_wglBindAttributeLocation(globject, a_texture0, "a_texture0");
}else {
a_texture0 = -1;
}
if(enable_color) {
a_color = i++;
_wglBindAttributeLocation(globject, a_color, "a_color");
}else {
a_color = -1;
}
if(enable_normal) {
a_normal = i++;
_wglBindAttributeLocation(globject, a_normal, "a_normal");
}else {
a_normal = -1;
}
if(enable_texture1) {
a_texture1 = i++;
_wglBindAttributeLocation(globject, a_texture1, "a_texture1");
}else {
a_texture1 = -1;
}
attributeIndexesToEnable = i;
genericArray = _wglCreateVertexArray(); genericArray = _wglCreateVertexArray();
genericBuffer = _wglCreateBuffer(); genericBuffer = _wglCreateBuffer();
_wglBindVertexArray(genericArray); _wglBindVertexArray(genericArray);