- set up the texture matrix.

This commit is contained in:
Christoph Oelckers 2019-10-10 19:46:46 +02:00
parent 1407c18f8b
commit 179076c4b1
2 changed files with 8 additions and 3 deletions

View file

@ -165,9 +165,15 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
GlowMatrix.Init(hShader, "u_glowMatrix"); GlowMatrix.Init(hShader, "u_glowMatrix");
TextureMatrix.Init(hShader, "u_textureMatrix"); TextureMatrix.Init(hShader, "u_textureMatrix");
glUseProgram(hShader); glUseProgram(hShader);
VSMatrix identity(0);
TextureMatrix.Set(identity.get());
DetailMatrix.Set(identity.get());
GlowMatrix.Set(identity.get());
int SamplerLoc; int SamplerLoc;
SamplerLoc = glGetUniformLocation(hShader, "s_texture"); SamplerLoc = glGetUniformLocation(hShader, "s_texture");
glUniform1i(SamplerLoc, 0); glUniform1i(SamplerLoc, 0);

View file

@ -13,6 +13,7 @@ uniform mat4 u_modelMatrix;
uniform mat4 u_projectionMatrix; uniform mat4 u_projectionMatrix;
uniform mat4 u_detailMatrix; uniform mat4 u_detailMatrix;
uniform mat4 u_glowMatrix; uniform mat4 u_glowMatrix;
uniform mat4 u_textureMatrix;
in vec4 i_vertPos; in vec4 i_vertPos;
in vec4 i_texCoord; in vec4 i_texCoord;
@ -30,9 +31,7 @@ void main()
eyeCoordPosition.xyz /= eyeCoordPosition.w; eyeCoordPosition.xyz /= eyeCoordPosition.w;
v_texCoord = i_texCoord; v_texCoord = u_textureMatrix * i_texCoord;
//gl_TexCoord[0] = mix(gl_TexCoord[0].xyzw, gl_TexCoord[0].yxzw, u_usePalette); WTF is this???
v_detailCoord = u_detailMatrix * i_texCoord; v_detailCoord = u_detailMatrix * i_texCoord;
v_glowCoord = u_glowMatrix * i_texCoord; v_glowCoord = u_glowMatrix * i_texCoord;