Browse Source

Re-add glDrawRangeElements() workaround for Emscripten.

This reverts commit f6ba4111e1, which in
turn reverts commit 4ce2875262 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).
pull/284/head
Vladimír Vondruš 8 years ago
parent
commit
6bb0179c65
  1. 2
      doc/changelog.dox
  2. 5
      src/Magnum/GL/Mesh.cpp

2
doc/changelog.dox

@ -198,8 +198,6 @@ See also:
possible as well possible as well
- The @ref GL::BufferUsage parameter in @ref GL::Buffer::setData() is now - The @ref GL::BufferUsage parameter in @ref GL::Buffer::setData() is now
optional, defaults to @ref GL::BufferUsage::StaticDraw 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() - Restored backwards compatibility to the templated @ref GL::Buffer::map()
overload --- it was not possible to call it with @cpp void @ce template overload --- it was not possible to call it with @cpp void @ce template
parameter parameter

5
src/Magnum/GL/Mesh.cpp

@ -411,7 +411,10 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
/* Indexed mesh */ /* Indexed mesh */
} else { } 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 */ /* Indexed mesh with specified range */
if(indexEnd) { if(indexEnd) {
glDrawRangeElements(GLenum(_primitive), indexStart, indexEnd, count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexOffset)); glDrawRangeElements(GLenum(_primitive), indexStart, indexEnd, count, GLenum(_indexType), reinterpret_cast<GLvoid*>(indexOffset));

Loading…
Cancel
Save