add LineBuffer and change DebugFontBuffer naming
This commit is contained in:
@@ -6,20 +6,20 @@
|
||||
|
||||
using namespace llmr;
|
||||
|
||||
debug_font_buffer::debug_font_buffer()
|
||||
DebugFontBuffer::DebugFontBuffer()
|
||||
: buffer(0),
|
||||
dirty(true) {
|
||||
|
||||
}
|
||||
|
||||
debug_font_buffer::~debug_font_buffer() {
|
||||
DebugFontBuffer::~DebugFontBuffer() {
|
||||
if (buffer != 0) {
|
||||
glDeleteBuffers(1, &buffer);
|
||||
buffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void debug_font_buffer::addText(const char *text, double left, double baseline, double scale) {
|
||||
void DebugFontBuffer::addText(const char *text, double left, double baseline, double scale) {
|
||||
int32_t length = strlen(text);
|
||||
for (int32_t i = 0; i < length; i++) {
|
||||
if (text[i] < 32 || text[i] > 127) {
|
||||
@@ -52,24 +52,23 @@ void debug_font_buffer::addText(const char *text, double left, double baseline,
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
void debug_font_buffer::clear() {
|
||||
void DebugFontBuffer::clear() {
|
||||
array.clear();
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
uint32_t debug_font_buffer::length() {
|
||||
uint32_t DebugFontBuffer::length() {
|
||||
// We store 2 coordinates per vertex
|
||||
return array.size() / 2;
|
||||
}
|
||||
|
||||
void debug_font_buffer::bind() {
|
||||
void DebugFontBuffer::bind() {
|
||||
if (buffer == 0) {
|
||||
glGenBuffers(1, &buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
} else {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, buffer);
|
||||
|
||||
if (dirty) {
|
||||
glBufferData(GL_ARRAY_BUFFER, array.size() * sizeof(uint16_t), array.data(), GL_STATIC_DRAW);
|
||||
dirty = false;
|
||||
|
||||
Reference in New Issue
Block a user