39 lines
1.0 KiB
C
39 lines
1.0 KiB
C
|
#pragma once
|
||
|
|
||
|
#include "TextTypes.h"
|
||
|
|
||
|
namespace charcoal
|
||
|
{
|
||
|
namespace builtin
|
||
|
{
|
||
|
namespace text
|
||
|
{
|
||
|
class Batch : public PoseableBatch<Vertex, Index, 2, Renderable>
|
||
|
{
|
||
|
public:
|
||
|
using PoseableBatch<Vertex, Index, 2, Renderable>::PoseableBatch;
|
||
|
protected:
|
||
|
void setup_vao_vertex() override
|
||
|
{
|
||
|
glBindBuffer(GL_ARRAY_BUFFER, m_vertex_vbo);
|
||
|
|
||
|
glEnableVertexAttribArray(0);
|
||
|
glEnableVertexAttribArray(1);
|
||
|
|
||
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, position));
|
||
|
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, uv));
|
||
|
|
||
|
glVertexAttribDivisor(0, 0); // Divisor of 0 specifies to treat this element as model-specific
|
||
|
glVertexAttribDivisor(1, 0);
|
||
|
}
|
||
|
|
||
|
void preprender() const override
|
||
|
{
|
||
|
glActiveTexture(GL_TEXTURE0);
|
||
|
glBindTexture(GL_TEXTURE_2D, m_p_renderable->get_texture()->get_texture());
|
||
|
glBindSampler(0, m_p_renderable->get_sampler()->get_sampler());
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|