diff --git a/src/graphics/gl_headers.hpp b/src/graphics/gl_headers.hpp index 183aebbcd..57899bf65 100644 --- a/src/graphics/gl_headers.hpp +++ b/src/graphics/gl_headers.hpp @@ -65,13 +65,11 @@ extern "C" { #define GL_SRGB_ALPHA GL_SRGB_ALPHA_EXT extern PFNGLUNIFORMHANDLEUI64NVPROC pglUniformHandleui64NV; -extern PFNGLDRAWELEMENTSBASEVERTEXOESPROC pglDrawElementsBaseVertexOES; extern PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR; extern PFNGLTEXBUFFEROESPROC pglTexBufferOES; extern PFNGLTEXTUREVIEWOESPROC pglTextureViewOES; #define glUniformHandleui64ARB pglUniformHandleui64NV -#define glDrawElementsBaseVertex pglDrawElementsBaseVertexOES #define glDebugMessageCallbackARB pglDebugMessageCallbackKHR #define glTexBuffer pglTexBufferOES #define glTextureView pglTextureViewOES diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index 5d97562c2..f425e7bfd 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -35,7 +35,6 @@ #include PFNGLUNIFORMHANDLEUI64NVPROC pglUniformHandleui64NV = 0; -PFNGLDRAWELEMENTSBASEVERTEXOESPROC pglDrawElementsBaseVertexOES = 0; PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR = 0; PFNGLTEXBUFFEROESPROC pglTexBufferOES = 0; PFNGLTEXTUREVIEWOESPROC pglTextureViewOES = 0; @@ -199,7 +198,6 @@ void initGL() #if defined(USE_GLES2) glUniformHandleui64ARB = (PFNGLUNIFORMHANDLEUI64NVPROC)eglGetProcAddress("pglUniformHandleui64NV"); - glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXOESPROC)eglGetProcAddress("glDrawElementsBaseVertexOES"); glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)eglGetProcAddress("glDebugMessageCallbackKHR"); glTexBuffer = (PFNGLTEXBUFFEROESPROC)eglGetProcAddress("glTexBufferOES"); glTextureView = (PFNGLTEXTUREVIEWOESPROC)eglGetProcAddress("glTextureViewOES"); diff --git a/src/graphics/render_geometry.cpp b/src/graphics/render_geometry.cpp index 5a01c0760..540eb7915 100644 --- a/src/graphics/render_geometry.cpp +++ b/src/graphics/render_geometry.cpp @@ -968,9 +968,10 @@ void draw(const T *Shader, const GLMesh *mesh, uniforms... Args) size_t count = mesh->IndexCount; Shader->setUniforms(Args...); - glDrawElementsBaseVertex(ptype, (int)count, itype, - (GLvoid *)mesh->vaoOffset, - (int)mesh->vaoBaseVertex); + glDrawRangeElements(ptype, (int)mesh->vaoBaseVertex, + (int)mesh->vaoBaseVertex + count - 1, + count, itype, (GLvoid *)mesh->vaoOffset); + } // draw // ---------------------------------------------------------------------------- @@ -1608,8 +1609,9 @@ void IrrDriver::renderTransparent() DisplaceMaskShader::getInstance()->use(); DisplaceMaskShader::getInstance()->setUniforms(AbsoluteTransformation); - glDrawElementsBaseVertex(ptype, (int)count, itype, - (GLvoid *)mesh.vaoOffset, (int)mesh.vaoBaseVertex); + glDrawRangeElements(ptype, (int)mesh.vaoBaseVertex, + (int)mesh.vaoBaseVertex + count - 1, + count, itype, (GLvoid *)mesh.vaoOffset); } irr_driver->getFBO(FBO_DISPLACE).bind(); @@ -1640,8 +1642,9 @@ void IrrDriver::renderTransparent() core::vector2df(cb->getDirX(), cb->getDirY()), core::vector2df(cb->getDir2X(), cb->getDir2Y())); - glDrawElementsBaseVertex(ptype, (int)count, itype, (GLvoid *)mesh.vaoOffset, - (int)mesh.vaoBaseVertex); + glDrawRangeElements(ptype, (int)mesh.vaoBaseVertex, + (int)mesh.vaoBaseVertex + count - 1, + count, itype, (GLvoid *)mesh.vaoOffset); } irr_driver->getFBO(FBO_COLORS).bind(); @@ -1662,8 +1665,9 @@ void drawShadow(const T *Shader, unsigned cascade, const GLMesh *mesh, uniforms. size_t count = mesh->IndexCount; Shader->setUniforms(cascade, Args...); - glDrawElementsBaseVertex(ptype, (int)count, itype, - (GLvoid *)mesh->vaoOffset, (int)mesh->vaoBaseVertex); + glDrawRangeElements(ptype, (int)mesh->vaoBaseVertex, + (int)mesh->vaoBaseVertex + count - 1, + count, itype, (GLvoid *)mesh->vaoOffset); } // drawShadow // ---------------------------------------------------------------------------- diff --git a/src/graphics/stk_mesh_scene_node.cpp b/src/graphics/stk_mesh_scene_node.cpp index fe47d0dde..7096ab6f8 100644 --- a/src/graphics/stk_mesh_scene_node.cpp +++ b/src/graphics/stk_mesh_scene_node.cpp @@ -127,7 +127,9 @@ void STKMeshSceneNode::drawGlow(const GLMesh &mesh) GLenum itype = mesh.IndexType; size_t count = mesh.IndexCount; ColorizeShader::getInstance()->setUniforms(AbsoluteTransformation, video::SColorf(glowcolor.getRed() / 255.f, glowcolor.getGreen() / 255.f, glowcolor.getBlue() / 255.f)); - glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex); + glDrawRangeElements(ptype, (int)mesh.vaoBaseVertex, + (int)mesh.vaoBaseVertex + count - 1, + count, itype, (GLvoid *)mesh.vaoOffset); } void STKMeshSceneNode::updatevbo()