11 bool Shader::load(const char *fname, SType type)
19 fprintf(stderr, "Invalid shader type used in loading.\n");
26 if(!(fp = fopen(fname, "rb"))) {
27 fprintf(stderr, "Failed to open shader: %s.\n", fname);
31 fseek(fp, 0, SEEK_END);
36 if(!(buf = new char[fsz + 1])) {
37 fprintf(stderr, "Failed to allocate %u buffers.\n", fsz + 1);
43 if(fread(buf, 1, fsz, fp) < fsz) {
44 fprintf(stderr, "Failed to read shader: %s.\n", fname);
53 create(buf, fsz, fname);
57 ShaderProgram::ShaderProgram()
59 int len = sizeof shaders / sizeof *shaders;
60 for(int i=0; i<len; ++i) {
65 ShaderProgram::~ShaderProgram()
67 int len = sizeof shaders / sizeof *shaders;
69 for(int i=0; i<len; ++i) {