charcoal/OpenGLEngine/ShaderProgram.cpp
Elipzer 90bac19849 3D Cube
Finally got a 3D cube to be rendered. While doing it, fixed a
bug in MeshFactory that caused it to allocate the incorrect amount
of memory for each mesh.
2018-09-11 16:49:34 -04:00

32 lines
483 B
C++

#include "ShaderProgram.h"
ShaderProgram::ShaderProgram()
: m_program(glCreateProgram())
{}
ShaderProgram::~ShaderProgram()
{
glDeleteProgram(m_program);
}
void ShaderProgram::attach_shader(const Shader& shader)
{
glAttachShader(m_program, shader.get_shader());
}
void ShaderProgram::link()
{
glLinkProgram(m_program);
// TODO: Error handling
}
void ShaderProgram::use() const
{
glUseProgram(m_program);
}
GLuint ShaderProgram::get_program() const
{
return m_program;
}