- use explicitly declared matrix uniforms.

The builtin matrices are no longer available in modern GLSL, preventing an upgrade of the shader.
Also perform better reporting of shader compilation errors.
This commit is contained in:
Christoph Oelckers 2019-10-06 10:19:51 +02:00
parent 8fd8d0858c
commit 71d132b470
9 changed files with 56 additions and 46 deletions

View file

@ -99,8 +99,8 @@ bool FShader::Load(const char * name, const char * vert_prog, const char * frag_
if (linked == 0)
{
// only print message if there's an error.
initprintf("Init Shader '%s':\n%s\n", name, error.GetChars());
return false;
FStringf err("Init Shader '%s':\n%s\n", name, error.GetChars());
throw std::runtime_error(err); // Failing to compile a shader is fatal.
}
return true;
}
@ -158,6 +158,11 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset");
Brightness.Init(hShader, "u_brightness");
RotMatrix.Init(hShader, "u_rotMatrix");
ModelMatrix.Init(hShader, "u_modelMatrix");
ProjectionMatrix.Init(hShader, "u_projectionMatrix");
DetailMatrix.Init(hShader, "u_detailMatrix");
GlowMatrix.Init(hShader, "u_glowMatrix");
ShadeInterpolate.Init(hShader, "u_shadeInterpolate");
glUseProgram(hShader);