diff options
author | David Tardon <dtardon@redhat.com> | 2016-07-19 09:53:19 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-07-19 10:51:00 +0200 |
commit | a0d3168ee4ac202790f1d4d0c95a6264cc8bf455 (patch) | |
tree | c9b7110c4e68fb57167d8370ee8fcb5275647649 /slideshow | |
parent | 90576b93244ea836714cb1b75dff16503a270772 (diff) |
tdf#97195 make diamond transition work again
Change-Id: I28236dd0c7dbd4e1798055229b2db2d0101a493e
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx | 56 | ||||
-rw-r--r-- | slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx | 2 |
2 files changed, 57 insertions, 1 deletions
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx index e755c7098c21..02cf96d11b96 100644 --- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx +++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx @@ -310,6 +310,36 @@ OGLTransitionImpl::displaySlide( CHECK_GL_ERROR(); } +void +OGLTransitionImpl::displayUnbufferedSlide( + const double nTime, + const sal_Int32 glSlideTex, const Primitives_t& primitives, + double SlideWidthScale, double SlideHeightScale ) +{ + CHECK_GL_ERROR(); + glPushMatrix(); + CHECK_GL_ERROR(); + glBindTexture(GL_TEXTURE_2D, glSlideTex); + CHECK_GL_ERROR(); + glBindVertexArray(0); + CHECK_GL_ERROR(); + glBindBuffer(GL_ARRAY_BUFFER, 0); + CHECK_GL_ERROR(); + if (m_nSceneTransformLocation != -1) { + glUniformMatrix4fv(m_nSceneTransformLocation, 1, false, glm::value_ptr(glm::mat4())); + CHECK_GL_ERROR(); + } + for (const Primitive& primitive: primitives) + primitive.display(m_nPrimitiveTransformLocation, nTime, SlideWidthScale, SlideHeightScale); + CHECK_GL_ERROR(); + glBindVertexArray(m_nVertexArrayObject); + CHECK_GL_ERROR(); + glBindBuffer(GL_ARRAY_BUFFER, m_nVertexBufferObject); + CHECK_GL_ERROR(); + glPopMatrix(); + CHECK_GL_ERROR(); +} + void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) { const SceneObjects_t& rSceneObjects(maScene.getSceneObjects()); @@ -319,6 +349,30 @@ void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double Sl CHECK_GL_ERROR(); } +void Primitive::display(GLint primitiveTransformLocation, double nTime, double WidthScale, double HeightScale) const +{ + glm::mat4 matrix; + applyOperations( matrix, nTime, WidthScale, HeightScale ); + + CHECK_GL_ERROR(); + if (primitiveTransformLocation != -1) { + glUniformMatrix4fv(primitiveTransformLocation, 1, false, glm::value_ptr(matrix)); + CHECK_GL_ERROR(); + } + + glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); + CHECK_GL_ERROR(); + glEnableClientState( GL_VERTEX_ARRAY ); + CHECK_GL_ERROR(); + glVertexPointer( 3, GL_FLOAT, sizeof(Vertex), &Vertices[0] ); + CHECK_GL_ERROR(); + glDrawArrays( GL_TRIANGLES, 0, getVerticesSize() ); + CHECK_GL_ERROR(); + glPopClientAttrib(); + + CHECK_GL_ERROR(); +} + void Primitive::display(GLint primitiveTransformLocation, double nTime, double WidthScale, double HeightScale, int first) const { glm::mat4 matrix; @@ -1173,7 +1227,7 @@ void DiamondTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTe applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale ); CHECK_GL_ERROR(); - displaySlide( nTime, glLeavingSlideTex, makeLeavingSlide(nTime), SlideWidthScale, SlideHeightScale ); + displayUnbufferedSlide( nTime, glLeavingSlideTex, makeLeavingSlide(nTime), SlideWidthScale, SlideHeightScale ); displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale ); CHECK_GL_ERROR(); } diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx index 488a035adef8..2a7c472ada69 100644 --- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx +++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx @@ -166,6 +166,7 @@ protected: } void displaySlide( double nTime, sal_Int32 glSlideTex, const Primitives_t& primitives, double SlideWidthScale, double SlideHeightScale ); + void displayUnbufferedSlide( double nTime, sal_Int32 glSlideTex, const Primitives_t& primitives, double SlideWidthScale, double SlideHeightScale ); void displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight); void applyOverallOperations( double nTime, double SlideWidthScale, double SlideHeightScale ); @@ -314,6 +315,7 @@ public: void swap(Primitive& rOther); void applyOperations(glm::mat4& matrix, double nTime, double SlideWidthScale, double SlideHeightScale) const; + void display(GLint primitiveTransformLocation, double nTime, double WidthScale, double HeightScale) const; void display(GLint primitiveTransformLocation, double nTime, double WidthScale, double HeightScale, int first) const; /** PushBack a vertex,normal, and tex coord. Each SlideLocation is where on the slide is mapped to this location ( from (0,0) to (1,1) ). This will make sure the correct aspect ratio is used, and helps to make slides begin and end at the correct position. (0,0) is the top left of the slide, and (1,1) is the bottom right. |