Add draw_indexed__raw - use glDrawElements instead of newer

function
This commit is contained in:
twinaphex 2017-03-28 12:39:20 +02:00
parent 731c7196ac
commit 8453e1a50f
2 changed files with 6 additions and 13 deletions

View File

@ -475,7 +475,7 @@ static void draw(GlRenderer *renderer)
if (opaque_triangle_len)
{
if (!DRAWBUFFER_IS_EMPTY(renderer->command_buffer))
renderer->command_buffer->draw_indexed_no_bind(GL_TRIANGLES,
draw_indexed__raw(GL_TRIANGLES,
opaque_triangle_indices,
opaque_triangle_len);
}
@ -488,7 +488,7 @@ static void draw(GlRenderer *renderer)
if (opaque_line_len)
{
if (!DRAWBUFFER_IS_EMPTY(renderer->command_buffer))
renderer->command_buffer->draw_indexed_no_bind(GL_LINES,
draw_indexed__raw(GL_LINES,
opaque_line_indices,
opaque_line_len);
}
@ -554,7 +554,7 @@ static void draw(GlRenderer *renderer)
GLushort *indices = renderer->semi_transparent_indices + cur_index;
if (!DRAWBUFFER_IS_EMPTY(renderer->command_buffer))
renderer->command_buffer->draw_indexed_no_bind(it->draw_mode,
draw_indexed__raw(it->draw_mode,
indices,
len);

View File

@ -13,6 +13,8 @@
#include "program.h"
#include "error.h"
#define draw_indexed__raw(mode, indices, count) glDrawElements(mode, count, GL_UNSIGNED_SHORT, indices)
#define DRAWBUFFER_IS_EMPTY(x) ((x)->active_next_index == (x)->active_command_index)
#define DRAWBUFFER_REMAINING_CAPACITY(x) ((x)->capacity - (x)->active_next_index)
#define DRAWBUFFER_NEXT_INDEX(x) ((x)->active_next_index)
@ -28,6 +30,7 @@
* have been done and we won't reference that data anymore) */
#define DRAWBUFFER_FINISH(x) ((x)->active_command_index = (x)->active_next_index)
template<typename T>
class DrawBuffer
{
@ -264,16 +267,6 @@ public:
glDrawArrays(mode, start, len);
}
void draw_indexed_no_bind(GLenum mode, GLushort *indices, GLsizei count)
{
GLint base = 0;
glDrawElementsBaseVertex(mode,
count,
GL_UNSIGNED_SHORT,
indices,
base);
}
};
#endif