Skip to content

Instantly share code, notes, and snippets.

@MichaelEstes
Last active August 29, 2015 14:18
Show Gist options
  • Save MichaelEstes/634c9918daf82a1f045c to your computer and use it in GitHub Desktop.
Save MichaelEstes/634c9918daf82a1f045c to your computer and use it in GitHub Desktop.
Function for loading shaders in text files
#include <fstream>
#include <sstream>
char* LoadShader(string fileName)
{
char * shader;
stringstream buffer;
ifstream s(fileName);
buffer << s.rdbuf();
shader = new char[buffer.str().size() + 1];
strcpy(shader, buffer.str().c_str());
return shader;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment