Skip to content

Commit

Permalink
Fix morphing with WebGL.
Browse files Browse the repository at this point in the history
Fixes #1726
  • Loading branch information
prideout committed Oct 3, 2019
1 parent 489f3ff commit 89c6e1d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions filament/backend/src/opengl/OpenGLDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,11 @@ Handle<HwStream> OpenGLDriver::createStreamFromTextureIdS() noexcept {

void OpenGLDriver::createVertexBufferR(
Handle<HwVertexBuffer> vbh,
uint8_t bufferCount,
uint8_t attributeCount,
uint32_t elementCount,
AttributeArray attributes,
BufferUsage usage) {
uint8_t bufferCount,
uint8_t attributeCount,
uint32_t elementCount,
AttributeArray attributes,
BufferUsage usage) {
DEBUG_MARKER()

auto& gl = mContext;
Expand Down Expand Up @@ -2032,6 +2032,15 @@ void OpenGLDriver::setRenderPrimitiveBuffer(Handle<HwRenderPrimitive> rph,

gl.enableVertexAttribArray(GLuint(i));
} else {

// In some OpenGL implementation, (e.g. WebGL and maybe Angle), we must supply a
// properly-typed placeholder for every input that is declared in the vertex shader,
// similar to Vulkan and Metal.
const uint32_t kBoneIndicesLocation = 5; // VertexAttribute::BONE_INDICES
if (i == kBoneIndicesLocation) {
glVertexAttribI4ui(GLuint(i), 0, 0, 0, 0);
}

gl.disableVertexAttribArray(GLuint(i));
}
}
Expand Down

0 comments on commit 89c6e1d

Please sign in to comment.