Связывание ошибок при создании класса шейдераC++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Связывание ошибок при создании класса шейдера

Сообщение Anonymous »

Я пытался создать класс шейдера для чтения файлов и создания программы шейдера:
Заголовок:

Код: Выделить всё

#pragma once

#include 
#include 
#include 
#include 

class Shader
{
public:
unsigned int ID;

Shader(const char* vertexPath, const char* fragmentPath);

void use();

void setInt(std::string& name, int value) const;
void setFloat(std::string& name, float value) const;
void setBool(std::string& name, bool value) const;
};
Реализация:

Код: Выделить всё

#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]
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»