41 lines
833 B
C++
Executable File
41 lines
833 B
C++
Executable File
#ifndef INCLUDE_SHADER_PROGRAM_DATA_IMPLEMENTATION
|
|
# error Never include this file directly include 'shader_program_data.hpp'
|
|
#endif
|
|
|
|
#include <glm/gtc/type_ptr.hpp>
|
|
|
|
#include "util/for_each.hpp"
|
|
#include "util/logger.hpp"
|
|
#include "opengl/error.hpp"
|
|
|
|
namespace zgl
|
|
{
|
|
inline shader_program_data::shader_program_data(GLuint program_id)
|
|
: handle{ program_id } {}
|
|
|
|
|
|
inline shader_program_data::shader_program_data(shader_program_data&& other) noexcept
|
|
{
|
|
handle = other.handle;
|
|
other.handle.id = 0;
|
|
}
|
|
|
|
inline shader_program_data& shader_program_data::operator=(shader_program_data&& other) noexcept
|
|
{
|
|
if (&other != this)
|
|
{
|
|
this->~shader_program_data();
|
|
handle = other.handle;
|
|
other.handle.id = 0;
|
|
}
|
|
return *this;
|
|
}
|
|
|
|
inline shader_program_data::~shader_program_data()
|
|
{
|
|
if (handle.id) {
|
|
glDeleteProgram(handle.id);
|
|
}
|
|
}
|
|
}
|