Use function compatible with GLES 3.0 for drawing elements with offset.

This commit is contained in:
Deve 2016-07-08 00:20:08 +02:00
parent 2b734a9579
commit 86a1d3a07a
4 changed files with 16 additions and 14 deletions

View File

@ -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

View File

@ -35,7 +35,6 @@
#include <EGL/eglext.h>
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");

View File

@ -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
// ----------------------------------------------------------------------------

View File

@ -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()