40617c8953
to specify the batch pipeline specified at StackOverflow See https://stackoverflow.com/questions/8923174/opengl-vao-best-practices#8923298
39 lines
582 B
C++
39 lines
582 B
C++
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include <type_traits>
|
|
|
|
#include "Mesh.h"
|
|
|
|
template <typename VertexType, typename IndexType>
|
|
class Renderable
|
|
{
|
|
public:
|
|
typedef VertexType VertexType;
|
|
typedef IndexType IndexType;
|
|
typedef Mesh<VertexType, IndexType> MeshType;
|
|
|
|
virtual ~Renderable() { };
|
|
|
|
void init()
|
|
{
|
|
m_vbo = gen_vbo();
|
|
}
|
|
|
|
const MeshType* get_mesh() const
|
|
{
|
|
return m_p_mesh;
|
|
}
|
|
|
|
GLuint get_vbo() const
|
|
{
|
|
return m_vbo;
|
|
}
|
|
|
|
protected:
|
|
virtual GLuint gen_vbo() const = 0;// TODO: A VBO for every object?
|
|
|
|
const MeshType* m_p_mesh = nullptr;
|
|
GLuint m_vbo = 0;
|
|
}; |