charcoal/OpenGLEngine/MyShaderProgram.cpp

24 lines
685 B
C++

#include "MyShaderProgram.h"
#include "Util.h"
MyShaderProgram::MyShaderProgram()
// TEMP Hardcode in the path
: m_vertex_shader(Util::load_file("D:\\Development\\C++\\OpenGLEngine\\OpenGLEngine\\MyVertexShader.glsl"), VERTEX_SHADER),
m_fragment_shader(Util::load_file("D:\\Development\\C++\\OpenGLEngine\\OpenGLEngine\\MyFragmentShader.glsl"), FRAGMENT_SHADER)
{
attach_shader(m_vertex_shader);
attach_shader(m_fragment_shader);
link();
}
GLuint MyShaderProgram::gen_vao() const
{
GLuint vao;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glBindVertexArray(0);
return vao;
}