Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. void Shader::loadFromFile(const string &filename)
  2. {
  3. std::ifstream file;
  4.  
  5. file.open(filename.c_str());
  6.  
  7. if (!file.good())
  8. {
  9. std::cout << "Failed to open file: " << filename << std::endl;
  10. return;
  11. }
  12.  
  13. std::stringstream stream;
  14.  
  15. stream << file.rdbuf();
  16.  
  17. file.close();
  18.  
  19. const char *sourceChars = stream.str.c_str();
  20.  
  21. glShaderSource(id, 1, &sourceChars, NULL);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement