39 if (Src)
delete [] Src;
40 if (Id) glDeleteShader(Id);
43 FILE * f = fopen(filename,
"rb");
if (f ==
nullptr)
PLFATAL(
"Failed to read file " << filename);
44 fseek(f, 0, SEEK_END);
46 fseek(f, 0, SEEK_SET);
47 Src =
new GLchar[sz+1];
48 size_t got = fread(Src, 1, sz, f);
if (got != sz)
PLFATAL(
"Failed to read file " << filename);
54 GL_CHECK(glShaderSource(Id, 1, (
const GLchar**)&Src, 0));
58 GLint compiled; glGetShaderiv(Id, GL_COMPILE_STATUS, &compiled);
61 GLint loglen = 2048;
char log[loglen];
62 glGetShaderInfoLog(Id, loglen, &loglen, &log[0]); log[loglen] =
'\0';
63 LERROR(
"Failed to compile shader from file " << filename <<
", Log: " << &log[0]);
66 LINFO(
"Compiled shader from file " << filename);