16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 14:49:19 +02:00

use DrawElementsBaseVertexOES if available

This commit is contained in:
milek7
2021-01-20 19:39:05 +01:00
parent f0b364bafe
commit 5aa8dfe1a1
3 changed files with 47 additions and 14 deletions

View File

@@ -133,12 +133,6 @@ opengl33_vaogeometrybank::draw_( gfx::geometry_handle const &Geometry, gfx::stre
}
// render
if( chunkrecord.index_count > 0 ) {
/*
::glDrawElementsBaseVertex(
chunk.type,
chunkrecord.index_count, GL_UNSIGNED_INT, reinterpret_cast<void const *>( chunkrecord.index_offset * sizeof( gfx::basic_index ) ),
chunkrecord.vertex_offset );
*/
if (GLAD_GL_VERSION_3_3 || GLAD_GL_ES_VERSION_3_2) {
m_vao->bind();
::glDrawRangeElementsBaseVertex(
@@ -147,6 +141,13 @@ opengl33_vaogeometrybank::draw_( gfx::geometry_handle const &Geometry, gfx::stre
chunkrecord.index_count, GL_UNSIGNED_INT, reinterpret_cast<void const *>( chunkrecord.index_offset * sizeof( gfx::basic_index ) ),
chunkrecord.vertex_offset );
}
else if (GLAD_GL_OES_draw_elements_base_vertex) {
m_vao->bind();
::glDrawElementsBaseVertexOES(
chunk.type,
chunkrecord.index_count, GL_UNSIGNED_INT, reinterpret_cast<void const *>( chunkrecord.index_offset * sizeof( gfx::basic_index ) ),
chunkrecord.vertex_offset );
}
else {
setup_attrib(chunkrecord.vertex_offset);
m_vao->bind();