From 6bb0179c65b3813203d2caf12d75e58f650da87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 11 Sep 2018 12:09:30 +0200 Subject: [PATCH] Re-add glDrawRangeElements() workaround for Emscripten. This reverts commit f6ba4111e1669b254da8f0dafdbb5d9cb6df364a, which in turn reverts commit 4ce28752626102a2acfcc8a72e057eb2e86b4ad4 from 2015. Turns out glDrawRangeElements() *is* fixed now in Firefox, but is broken in Emscripten because their function dependency handling doesn't work correctly. Related PR: https://github.com/kripken/emscripten/pull/7112 Reverting this until the Emscripten PR is integrated and a version released with this patch is widespread enough (assuming a year-long delay could do). --- doc/changelog.dox | 2 -- src/Magnum/GL/Mesh.cpp | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 4e3c31611..f645a21e7 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -198,8 +198,6 @@ See also: possible as well - The @ref GL::BufferUsage parameter in @ref GL::Buffer::setData() is now optional, defaults to @ref GL::BufferUsage::StaticDraw -- Re-enabled @fn_gl{DrawRangeElements} for WebGL 2 (see - [mosra/magnum#97](https://github.com/mosra/magnum/issues/97)) - Restored backwards compatibility to the templated @ref GL::Buffer::map() overload --- it was not possible to call it with @cpp void @ce template parameter diff --git a/src/Magnum/GL/Mesh.cpp b/src/Magnum/GL/Mesh.cpp index a9148da50..465f03e13 100644 --- a/src/Magnum/GL/Mesh.cpp +++ b/src/Magnum/GL/Mesh.cpp @@ -411,7 +411,10 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i /* Indexed mesh */ } else { - #ifndef MAGNUM_TARGET_GLES2 + /** @todo re-enable once https://github.com/kripken/emscripten/pull/7112 + is merged and Emscripten versions with this change are + widespread enough */ + #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) /* Indexed mesh with specified range */ if(indexEnd) { glDrawRangeElements(GLenum(_primitive), indexStart, indexEnd, count, GLenum(_indexType), reinterpret_cast(indexOffset));