Recently I was trying to add shaders to my game.
I have gotten it to work but I feel like this code is too "shonky" and too C-style.
Any suggestions for ways to clean this code up and remove the dangerous C-style casts would be welcome.
std::string shader_file;
std::ifstream is(shader_src);
is >> shader_file;
is.close();
GLchar *shader_file_c = new GLchar[shader_file.length() + 1];
std::strcpy(shader_file_c, shader_file.c_str());
delete[] shader_file_c;
GLint len = shader_file.length();
glShaderSourceARB(shader_frag, 1, (const GLchar **) &shader_file_c, &len);
glCompileShaderARB(shader_frag);
glAttachObjectARB(shader_prog, shader_frag);
glLinkProgramARB(shader_prog);