2019-08-12 06:33:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "RenderDevice.h"
|
|
|
|
|
|
|
|
class Shader
|
|
|
|
{
|
|
|
|
public:
|
2019-08-14 05:55:21 +00:00
|
|
|
Shader() = default;
|
|
|
|
void ReleaseResources();
|
2019-08-12 06:33:40 +00:00
|
|
|
|
|
|
|
bool Compile(const std::string& vertexShader, const std::string& fragmentShader);
|
|
|
|
const char* GetErrors() const { return mErrors.c_str(); }
|
|
|
|
|
|
|
|
GLuint GetProgram() const { return mProgram; }
|
|
|
|
|
|
|
|
GLuint TransformLocations[(int)TransformState::NumTransforms] = { 0 };
|
2019-08-14 10:36:33 +00:00
|
|
|
GLuint UniformLocations[(int)UniformName::NumUniforms] = { 0 };
|
2019-08-12 06:33:40 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
GLuint CompileShader(const std::string& code, GLenum type);
|
|
|
|
|
|
|
|
GLuint mProgram = 0;
|
|
|
|
GLuint mVertexShader = 0;
|
|
|
|
GLuint mFragmentShader = 0;
|
|
|
|
std::string mErrors;
|
|
|
|
|
|
|
|
Shader(const Shader&) = delete;
|
|
|
|
Shader& operator=(const Shader&) = delete;
|
|
|
|
};
|