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

This reverts commit 86a1d3a07a.
This commit is contained in:
Deve 2016-07-12 22:50:59 +02:00
parent 131dfb2fc0
commit 32cd942760
4 changed files with 14 additions and 15 deletions

View File

@ -62,6 +62,8 @@ extern "C" {
#define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE
extern PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR;
extern PFNGLDRAWELEMENTSBASEVERTEXOESPROC pglDrawElementsBaseVertexOES;
#define glDrawElementsBaseVertex pglDrawElementsBaseVertexOES
#define glDebugMessageCallbackARB pglDebugMessageCallbackKHR
#endif

View File

@ -34,6 +34,7 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
PFNGLDRAWELEMENTSBASEVERTEXOESPROC pglDrawElementsBaseVertexOES = 0;
PFNGLDEBUGMESSAGECALLBACKKHRPROC pglDebugMessageCallbackKHR = 0;
#endif
@ -192,6 +193,7 @@ void initGL()
if (GLEW_OK != err)
Log::fatal("GLEW", "Glew initialisation failed with error %s", glewGetErrorString(err));
#else
glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXOESPROC)eglGetProcAddress("glDrawElementsBaseVertexOES");
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKKHRPROC)eglGetProcAddress("glDebugMessageCallbackKHR");
#endif

View File

@ -989,9 +989,9 @@ void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
}
Shader->setUniforms(Args...);
glDrawRangeElements(ptype, (int)mesh->vaoBaseVertex,
(int)mesh->vaoBaseVertex + count - 1,
count, itype, (GLvoid *)mesh->vaoOffset);
glDrawElementsBaseVertex(ptype, (int)count, itype,
(GLvoid *)mesh->vaoOffset,
(int)mesh->vaoBaseVertex);
if (need_change_hue)
{
@ -1645,9 +1645,8 @@ void IrrDriver::renderTransparent()
DisplaceMaskShader::getInstance()->use();
DisplaceMaskShader::getInstance()->setUniforms(AbsoluteTransformation);
glDrawRangeElements(ptype, (int)mesh.vaoBaseVertex,
(int)mesh.vaoBaseVertex + count - 1,
count, itype, (GLvoid *)mesh.vaoOffset);
glDrawElementsBaseVertex(ptype, (int)count, itype,
(GLvoid *)mesh.vaoOffset, (int)mesh.vaoBaseVertex);
}
irr_driver->getFBO(FBO_DISPLACE).bind();
@ -1678,9 +1677,8 @@ void IrrDriver::renderTransparent()
core::vector2df(cb->getDirX(), cb->getDirY()),
core::vector2df(cb->getDir2X(), cb->getDir2Y()));
glDrawRangeElements(ptype, (int)mesh.vaoBaseVertex,
(int)mesh.vaoBaseVertex + count - 1,
count, itype, (GLvoid *)mesh.vaoOffset);
glDrawElementsBaseVertex(ptype, (int)count, itype, (GLvoid *)mesh.vaoOffset,
(int)mesh.vaoBaseVertex);
}
irr_driver->getFBO(FBO_COLORS).bind();
@ -1702,9 +1700,8 @@ void drawShadow(const T *Shader, unsigned cascade, const GLMesh *mesh, uniforms.
size_t count = mesh->IndexCount;
Shader->setUniforms(cascade, Args...);
glDrawRangeElements(ptype, (int)mesh->vaoBaseVertex,
(int)mesh->vaoBaseVertex + count - 1,
count, itype, (GLvoid *)mesh->vaoOffset);
glDrawElementsBaseVertex(ptype, (int)count, itype,
(GLvoid *)mesh->vaoOffset, (int)mesh->vaoBaseVertex);
} // drawShadow
// ----------------------------------------------------------------------------

View File

@ -136,9 +136,7 @@ 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));
glDrawRangeElements(ptype, (int)mesh.vaoBaseVertex,
(int)mesh.vaoBaseVertex + count - 1,
count, itype, (GLvoid *)mesh.vaoOffset);
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex);
}
void STKMeshSceneNode::updatevbo()