#include "Shader.h"
Shader::Shader(const char* vertexPath, const char* fragmentPath):ID(0) {
//will hold the code as a string
std::string vertexCode;
std::string fragmentCode;
//file readers
std::ifstream vertexFile;
std::ifstream fragmentFile;
//set the exceptions that will cause failure when filereading
vertexFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
fragmentFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
//open the files
vertexFile.open(vertexPath);
fragmentFile.open(fragmentPath);
//stringStreams to hold the file's contents
std::stringstream vertexStringStream, fragmentStringStream;
//read each file buffer into the stringStream
vertexStringStream
Подробнее здесь: [url]https://stackoverflow.com/questions/79856017/linking-errors-when-creating-a-shader-class[/url]
//set the exceptions that will cause failure when filereading vertexFile.exceptions(std::ifstream::failbit | std::ifstream::badbit); fragmentFile.exceptions(std::ifstream::failbit | std::ifstream::badbit); try { //open the files vertexFile.open(vertexPath); fragmentFile.open(fragmentPath);
//stringStreams to hold the file's contents std::stringstream vertexStringStream, fragmentStringStream;
//read each file buffer into the stringStream vertexStringStream