handmade/include/shader.h
Bubblegumdrop 764ebe4ce2 Another Buffer_To_UDPPacketV. Yet to test.
Split UDPbase out.

Change ShaderProgram to std::unique_ptr<ShaderProgram>.

I think I may change Buffer_To_UDPPacketV  to some kind of RAII style code.
2022-01-08 21:23:42 -05:00

37 lines
1.2 KiB
C++

#pragma once
#include <map>
#include <string>
#include <GL/glew.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
class ShaderProgram
{
bool mUniformLocationsNeedRefresh;
std::map<const std::string, GLint> UniformLocationCache;
static GLint my_checkCompileSuccess (const GLuint, const GLenum);
public:
GLuint ID;
ShaderProgram (const std::string&, const std::string&, const std::string&);
GLint getCachedLoc (const std::string&);
void RefreshUniformLocations (void);
void Use (void);
void Bool (const std::string&, const bool&);
void Float (const std::string&, const float&);
void Int (const std::string&, const int&);
void Vec2 (const std::string&, const glm::vec2&);
void Vec3 (const std::string&, const glm::vec3&);
void Vec4 (const std::string&, const glm::vec4&);
void Mat2 (const std::string&, const glm::mat2&);
void Mat3 (const std::string&, const glm::mat3&);
void Mat4 (const std::string&, const glm::mat4&);
GLuint CompileShaderBuffer (const std::string&, const GLenum);
GLuint Compile3ShaderBuffers (const std::string&, const std::string&, const std::string&);
GLuint CompileShaderPath (const std::string&, const GLenum);
GLint LinkProgram (void);
};