0% found this document useful (0 votes)
5 views

Shader Program

Uploaded by

barcamyluv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Shader Program

Uploaded by

barcamyluv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#pragma once

#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include "vect/vect.h"
#include <string>
#include <unordered_map>
#include <vector>

class ShaderProgram
{
private:
GLuint GetUniformLocation(std::string name);

protected:
GLuint vertex_shader;
GLuint fragment_shader;
GLuint shader_program;
std::unordered_map<std::string, GLuint> uniform_locations;

std::string shader_program_name;
bool InitVertexShader();
bool InitFragmentShader();

public:
virtual std::string GetFragmentShaderCode() = 0;
virtual std::string GetVertexShaderCode() = 0;
bool Init();
void SetUniformValue(std::string name, float value);
void SetUniformValue(std::string name, Vect value);
void SetUniformValue(std::string name, std::vector<Vect> values);
void SetUniformValue(std::string name, int value);
void SetUniformValue(std::string name, glm::mat4 value);
void SelectForDrawing();
};

You might also like