Files
XCEngine/tests/OpenGL/OpenGLShader.h

35 lines
950 B
C
Raw Normal View History

#pragma once
#include <string>
#include <GLFW/glfw3.h>
namespace XCEngine {
namespace RHI {
class OpenGLShader {
public:
OpenGLShader();
~OpenGLShader();
bool CompileFromFile(const char* vertexPath, const char* fragmentPath);
bool Compile(const char* vertexSource, const char* fragmentSource);
void Shutdown();
void Use() const;
void SetInt(const std::string& name, int value) const;
void SetFloat(const std::string& name, float value) const;
void SetVec3(const std::string& name, float x, float y, float z) const;
void SetVec3(const std::string& name, const float* values) const;
void SetMat4(const std::string& name, const float* value) const;
unsigned int GetID() const { return m_program; }
private:
unsigned int m_program;
bool CheckCompileErrors(unsigned int shader, const char* type);
bool CheckLinkErrors(unsigned int program);
};
} // namespace RHI
} // namespace XCEngine