Advertisement
Benjamin_Loison

Shader load

Jul 1st, 2018
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1.     fShaderFile.exceptions (ifstream::failbit | ifstream::badbit);
  2.     try
  3.     {
  4.         // open files
  5.         vShaderFile.open(vertexPath);
  6.         fShaderFile.open(fragmentPath);
  7.         stringstream vShaderStream, fShaderStream;
  8.         // read file's buffer contents into streams
  9.         vShaderStream << vShaderFile.rdbuf();
  10.         fShaderStream << fShaderFile.rdbuf();
  11.         // close file handlers
  12.         vShaderFile.close();
  13.         fShaderFile.close();
  14.         // convert stream into string
  15.         vertexCode   = vShaderStream.str();
  16.         fragmentCode = fShaderStream.str();
  17.     print("ac");
  18.     }
  19.     catch (ifstream::failure e)
  20.     {
  21.         cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << endl;
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement