Kaydet (Commit) 540b64d8 authored tarafından Emmanuel Gil Peyrot's avatar Emmanuel Gil Peyrot Kaydeden (comit) Tomaž Vajngerl

slideshow: Don’t upload matrices to inexistent uniforms

Change-Id: I1572e101be0f5d9267dd48e96212689d80d1d023
(cherry picked from commit c5228bd0)
üst 0ab9db17
...@@ -286,8 +286,10 @@ void OGLTransitionImpl::applyOverallOperations( double nTime, double SlideWidthS ...@@ -286,8 +286,10 @@ void OGLTransitionImpl::applyOverallOperations( double nTime, double SlideWidthS
for(size_t i(0); i != rOverallOperations.size(); ++i) for(size_t i(0); i != rOverallOperations.size(); ++i)
rOverallOperations[i]->interpolate(matrix, nTime, SlideWidthScale, SlideHeightScale); rOverallOperations[i]->interpolate(matrix, nTime, SlideWidthScale, SlideHeightScale);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glUniformMatrix4fv(m_nOperationsTransformLocation, 1, false, glm::value_ptr(matrix)); if (m_nOperationsTransformLocation != -1) {
CHECK_GL_ERROR(); glUniformMatrix4fv(m_nOperationsTransformLocation, 1, false, glm::value_ptr(matrix));
CHECK_GL_ERROR();
}
} }
static void displayPrimitives(const Primitives_t& primitives, GLint primitiveTransformLocation, double nTime, double WidthScale, double HeightScale, std::vector<int>::const_iterator first) static void displayPrimitives(const Primitives_t& primitives, GLint primitiveTransformLocation, double nTime, double WidthScale, double HeightScale, std::vector<int>::const_iterator first)
...@@ -305,8 +307,10 @@ OGLTransitionImpl::displaySlide( ...@@ -305,8 +307,10 @@ OGLTransitionImpl::displaySlide(
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glBindTexture(GL_TEXTURE_2D, glSlideTex); glBindTexture(GL_TEXTURE_2D, glSlideTex);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glUniformMatrix4fv(m_nSceneTransformLocation, 1, false, glm::value_ptr(glm::mat4())); if (m_nSceneTransformLocation != -1) {
CHECK_GL_ERROR(); glUniformMatrix4fv(m_nSceneTransformLocation, 1, false, glm::value_ptr(glm::mat4()));
CHECK_GL_ERROR();
}
displayPrimitives(primitives, m_nPrimitiveTransformLocation, nTime, SlideWidthScale, SlideHeightScale, m_nFirstIndices.cbegin()); displayPrimitives(primitives, m_nPrimitiveTransformLocation, nTime, SlideWidthScale, SlideHeightScale, m_nFirstIndices.cbegin());
CHECK_GL_ERROR(); CHECK_GL_ERROR();
} }
...@@ -326,8 +330,10 @@ void Primitive::display(GLint primitiveTransformLocation, double nTime, double W ...@@ -326,8 +330,10 @@ void Primitive::display(GLint primitiveTransformLocation, double nTime, double W
applyOperations( matrix, nTime, WidthScale, HeightScale ); applyOperations( matrix, nTime, WidthScale, HeightScale );
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glUniformMatrix4fv(primitiveTransformLocation, 1, false, glm::value_ptr(matrix)); if (primitiveTransformLocation != -1) {
CHECK_GL_ERROR(); glUniformMatrix4fv(primitiveTransformLocation, 1, false, glm::value_ptr(matrix));
CHECK_GL_ERROR();
}
glDrawArrays( GL_TRIANGLES, first, Vertices.size() ); glDrawArrays( GL_TRIANGLES, first, Vertices.size() );
CHECK_GL_ERROR(); CHECK_GL_ERROR();
...@@ -350,8 +356,10 @@ void SceneObject::display(GLint sceneTransformLocation, GLint primitiveTransform ...@@ -350,8 +356,10 @@ void SceneObject::display(GLint sceneTransformLocation, GLint primitiveTransform
else else
matrix = glm::scale(matrix, glm::vec3(1, DispWidth/DispHeight, 1)); matrix = glm::scale(matrix, glm::vec3(1, DispWidth/DispHeight, 1));
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glUniformMatrix4fv(sceneTransformLocation, 1, false, glm::value_ptr(matrix)); if (sceneTransformLocation != -1) {
CHECK_GL_ERROR(); glUniformMatrix4fv(sceneTransformLocation, 1, false, glm::value_ptr(matrix));
CHECK_GL_ERROR();
}
displayPrimitives(maPrimitives, primitiveTransformLocation, nTime, 1, 1, maFirstIndices.cbegin()); displayPrimitives(maPrimitives, primitiveTransformLocation, nTime, 1, 1, maFirstIndices.cbegin());
CHECK_GL_ERROR(); CHECK_GL_ERROR();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment