diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 93d2ebb5da..290aaff820 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -968,9 +968,10 @@ bool AvatarData::hasIdentityChangedAfterParsing(const QByteArray& data) { bool hasIdentityChanged = false; - if (skeletonModelURL != _skeletonModelURL) { + if (_firstSkeletonCheck || (skeletonModelURL != _skeletonModelURL)) { setSkeletonModelURL(skeletonModelURL); hasIdentityChanged = true; + _firstSkeletonCheck = false; } if (displayName != _displayName) { diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index 8a6b558383..900da38ffa 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -368,7 +368,8 @@ protected: HeadData* _headData; - QUrl _skeletonModelURL; // These need to be empty so that on first time setting them they will not short circuit + QUrl _skeletonModelURL; + bool _firstSkeletonCheck { true }; QUrl _skeletonFBXURL; QVector<AttachmentData> _attachmentData; QString _displayName; diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index c3364f90f8..65acedfc96 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -78,10 +78,14 @@ bool FBXGeometry::convexHullContains(const glm::vec3& point) const { auto checkEachPrimitive = [=](FBXMesh& mesh, QVector<int> indices, int primitiveSize) -> bool { // Check whether the point is "behind" all the primitives. + int verticesSize = mesh.vertices.size(); for (int j = 0; j < indices.size() - 2; // -2 in case the vertices aren't the right size -- we access j + 2 below j += primitiveSize) { - if (!isPointBehindTrianglesPlane(point, + if (indices[j] < verticesSize && + indices[j + 1] < verticesSize && + indices[j + 2] < verticesSize && + !isPointBehindTrianglesPlane(point, mesh.vertices[indices[j]], mesh.vertices[indices[j + 1]], mesh.vertices[indices[j + 2]])) { diff --git a/libraries/gl/src/gl/OffscreenGLCanvas.cpp b/libraries/gl/src/gl/OffscreenGLCanvas.cpp index 7406577814..31bbc84cb2 100644 --- a/libraries/gl/src/gl/OffscreenGLCanvas.cpp +++ b/libraries/gl/src/gl/OffscreenGLCanvas.cpp @@ -44,12 +44,6 @@ bool OffscreenGLCanvas::create(QOpenGLContext* sharedContext) { return true; } - qWarning() << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); - qWarning() << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); - qWarning() << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); - qWarning() << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); - qWarning() << "Failed to create OffscreenGLCanvas"; - return false; } diff --git a/libraries/gl/src/gl/OffscreenQmlSurface.cpp b/libraries/gl/src/gl/OffscreenQmlSurface.cpp index 0a3598e840..563c590874 100644 --- a/libraries/gl/src/gl/OffscreenQmlSurface.cpp +++ b/libraries/gl/src/gl/OffscreenQmlSurface.cpp @@ -187,6 +187,15 @@ bool OffscreenQmlRenderThread::event(QEvent *e) { void OffscreenQmlRenderThread::setupFbo() { using namespace oglplus; _textures.setSize(_size); + + // Before making any ogl calls, clear any outstanding errors + // FIXME: Something upstream is polluting the context with a GL_INVALID_ENUM, + // likely from glewExperimental = true + GLenum err = glGetError(); + if (err != GL_NO_ERROR) { + qDebug() << "Clearing outstanding GL error to set up QML FBO:" << glewGetErrorString(err); + } + _depthStencil.reset(new Renderbuffer()); Context::Bound(Renderbuffer::Target::Renderbuffer, *_depthStencil) .Storage( diff --git a/libraries/gpu/src/gpu/GLBackend.cpp b/libraries/gpu/src/gpu/GLBackend.cpp index 14e4397b83..2c25255a80 100644 --- a/libraries/gpu/src/gpu/GLBackend.cpp +++ b/libraries/gpu/src/gpu/GLBackend.cpp @@ -87,18 +87,15 @@ void GLBackend::init() { static std::once_flag once; std::call_once(once, [] { qCDebug(gpulogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); - qCDebug(gpulogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION)); - qCDebug(gpulogging) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR)); - qCDebug(gpulogging) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER)); glewExperimental = true; GLenum err = glewInit(); - glGetError(); + glGetError(); // clear the potential error from glewExperimental if (GLEW_OK != err) { - /* Problem: glewInit failed, something is seriously wrong. */ + // glewInit failed, something is seriously wrong. qCDebug(gpulogging, "Error: %s\n", glewGetErrorString(err)); } qCDebug(gpulogging, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION)); diff --git a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp index 9d0838606e..29fc014a64 100644 --- a/plugins/oculus/src/OculusBaseDisplayPlugin.cpp +++ b/plugins/oculus/src/OculusBaseDisplayPlugin.cpp @@ -30,7 +30,7 @@ bool OculusBaseDisplayPlugin::isSupported() const { void OculusBaseDisplayPlugin::customizeContext() { glewExperimental = true; GLenum err = glewInit(); - glGetError(); + glGetError(); // clear the potential error from glewExperimental Parent::customizeContext(); } diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index 843b70807d..0cd9bac15f 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -101,7 +101,7 @@ void OpenVrDisplayPlugin::customizeContext() { std::call_once(once, []{ glewExperimental = true; GLenum err = glewInit(); - glGetError(); + glGetError(); // clear the potential error from glewExperimental }); Parent::customizeContext(); }