Last active
August 29, 2015 14:18
-
-
Save MichaelEstes/634c9918daf82a1f045c to your computer and use it in GitHub Desktop.
Function for loading shaders in text files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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