charcoal/OpenGLEngine/MyBatch.cpp
elipzer b494f68d0c A Working Triangle
Now using GLFW3 instead of the custom window class. This library
looks like it will make development much simpler and will make it
so that I am less worried about my windows code breaking. Currently
setup the http://antongerdelan.net/opengl/hellotriangle.html
tutorial in the MySimpleScene. Will probably create another scene
file to try to get the object oriented stuff working.
2018-09-05 16:26:50 -04:00

33 lines
601 B
C++

#include "MyBatch.h"
MyBatch::MyBatch(const MyTriangle& triangle)
: m_triangle(&triangle)
{
}
void MyBatch::render() const
{
// For now, just render everything!
glBindVertexArray(m_vao);
glDrawArrays(GL_TRIANGLES, 0, 3);
}
void MyBatch::populate_vbos()
{
glGenBuffers(1, &m_vbo);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
m_triangle->populate_vbo();
}
void MyBatch::setup_vao()
{
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
glBindVertexArray(0);
}