[Libreoffice-commits] core.git: 3 commits - slideshow/opengl slideshow/Package_opengl.mk slideshow/source

Emmanuel Gil Peyrot emmanuel.peyrot at collabora.com
Fri Nov 20 12:49:59 PST 2015


 slideshow/Package_opengl.mk                                          |    5 
 slideshow/opengl/basicFragmentShader.glsl                            |   39 
 slideshow/opengl/fadeBlackFragmentShader.glsl                        |   50 
 slideshow/opengl/fadeFragmentShader.glsl                             |   42 
 slideshow/opengl/reflectionFragmentShader.glsl                       |   47 
 slideshow/opengl/reflectionVertexShader.glsl                         |   41 
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |  514 +++++-----
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx |   10 
 8 files changed, 489 insertions(+), 259 deletions(-)

New commits:
commit b3ce63e5a5899088def6458ae80a354c926f9891
Author: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>
Date:   Fri Nov 20 20:13:05 2015 +0000

    slideshow: Reimplement reflections in shaders, and port Rochade and TurnAround
    
    This removes the hack reflections were previously, where a black quad
    was drawn on top of a mirror version of the first primitive only.
    
    Change-Id: I8c0863ab30e85d0130a8d7e838f3514e9be93788

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index 82fb3b9..1293c05 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -15,6 +15,8 @@ $(eval $(call gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
 		dissolveFragmentShader.glsl \
 		fadeBlackFragmentShader.glsl \
 		fadeFragmentShader.glsl \
+		reflectionVertexShader.glsl \
+		reflectionFragmentShader.glsl \
 		staticFragmentShader.glsl \
 		vortexFragmentShader.glsl \
 		vortexVertexShader.glsl \
diff --git a/slideshow/opengl/reflectionFragmentShader.glsl b/slideshow/opengl/reflectionFragmentShader.glsl
new file mode 100644
index 0000000..9bf8ecb
--- /dev/null
+++ b/slideshow/opengl/reflectionFragmentShader.glsl
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2015 by Collabora, Ltd.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 130
+
+uniform sampler2D slideTexture;
+varying float v_isShadow;
+varying vec2 v_texturePosition;
+
+void main() {
+    vec4 fragment = texture2D(slideTexture, v_texturePosition);
+    if (v_isShadow > 0.5) {
+        if (v_texturePosition.y > 1.0 - 0.3)
+            gl_FragColor = mix(fragment, vec4(0.0, 0.0, 0.0, 0.0), (1.0 - v_texturePosition.y) / 0.3);
+        else
+            discard;
+    } else {
+        gl_FragColor = fragment;
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/reflectionVertexShader.glsl b/slideshow/opengl/reflectionVertexShader.glsl
new file mode 100644
index 0000000..b08d0cc
--- /dev/null
+++ b/slideshow/opengl/reflectionVertexShader.glsl
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 130
+
+varying float v_isShadow;
+varying vec2 v_texturePosition;
+
+void main( void )
+{
+    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+    v_texturePosition = gl_MultiTexCoord0.xy;
+    v_isShadow = float(gl_VertexID >= 6);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 1f4cf9f..dd791ae 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -93,53 +93,6 @@ void OGLTransitionImpl::finish()
     finishTransition();
 }
 
-static void blendSlide( double depth )
-{
-    CHECK_GL_ERROR();
-    double showHeight = -1 + depth*2;
-    GLfloat reflectionColor[] = {0, 0, 0, 0.25};
-
-    glDisable( GL_DEPTH_TEST );
-    glBegin( GL_QUADS );
-    glColor4fv( reflectionColor );
-    glVertex3f( -1, -1, 0 );
-    glColor4f( 0, 0, 0, 1 );
-    glVertex3f(-1,  showHeight, 0 );
-    glVertex3f( 1,  showHeight, 0 );
-    glColor4fv( reflectionColor );
-    glVertex3f( 1, -1, 0 );
-    glEnd();
-
-    glBegin( GL_QUADS );
-    glColor4f( 0, 0, 0, 1 );
-    glVertex3f( -1, showHeight, 0 );
-    glVertex3f( -1,  1, 0 );
-    glVertex3f(  1,  1, 0 );
-    glVertex3f(  1, showHeight, 0 );
-    glEnd();
-    glEnable( GL_DEPTH_TEST );
-    CHECK_GL_ERROR();
-}
-
-static void slideShadow( double nTime, const Primitive& primitive, double sw, double sh )
-{
-    CHECK_GL_ERROR();
-    double reflectionDepth = 0.3;
-
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    glDisable(GL_LIGHTING);
-
-    glPushMatrix();
-    primitive.applyOperations( nTime, sw, sh );
-    blendSlide( reflectionDepth );
-    glPopMatrix();
-
-    glDisable(GL_BLEND);
-    glEnable(GL_LIGHTING);
-    CHECK_GL_ERROR();
-}
-
 void OGLTransitionImpl::prepare( double, double, double, double, double )
 {
 }
@@ -256,33 +209,8 @@ OGLTransitionImpl::displaySlide(
         double SlideWidthScale, double SlideHeightScale )
 {
     CHECK_GL_ERROR();
-    //TODO change to foreach
     glBindTexture(GL_TEXTURE_2D, glSlideTex);
     CHECK_GL_ERROR();
-
-    // display slide reflection
-    // note that depth test is turned off while blending the shadow
-    // so the slides has to be rendered in right order, see rochade as example
-    if( maSettings.mbReflectSlides ) {
-        double surfaceLevel = -0.04;
-
-        /* reflected slides */
-        glPushMatrix();
-
-        glm::mat4 matrix;
-        matrix = glm::scale(matrix, glm::vec3(1, -1, 1));
-        matrix = glm::translate(matrix, glm::vec3(0, 2 - surfaceLevel, 0));
-        glMultMatrixf(glm::value_ptr(matrix));
-
-        glCullFace(GL_FRONT);
-        display_primitives(primitives, nTime, SlideWidthScale, SlideHeightScale);
-        glCullFace(GL_BACK);
-
-        slideShadow( nTime, primitives[0], SlideWidthScale, SlideHeightScale );
-
-        glPopMatrix();
-    }
-
     display_primitives(primitives, nTime, SlideWidthScale, SlideHeightScale);
     CHECK_GL_ERROR();
 }
@@ -493,6 +421,69 @@ void ShaderTransition::impl_setTextureUniforms()
 namespace
 {
 
+class ReflectionTransition : public ShaderTransition
+{
+public:
+    ReflectionTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
+        : ShaderTransition(rScene, rSettings)
+    {}
+
+private:
+    virtual GLuint makeShader() const override;
+    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
+
+    virtual void impl_prepareTransition() override {
+        glDisable(GL_CULL_FACE);
+    }
+
+    virtual void impl_finishTransition() override {
+        glEnable(GL_CULL_FACE);
+    }
+};
+
+GLuint ReflectionTransition::makeShader() const
+{
+    return OpenGLHelper::LoadShaders( "reflectionVertexShader", "reflectionFragmentShader" );
+}
+
+void ReflectionTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
+                                              double SlideWidthScale, double SlideHeightScale )
+{
+    CHECK_GL_ERROR();
+    applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
+
+    sal_Int32 texture;
+    Primitives_t slide;
+    if (nTime < 0.5) {
+        texture = glLeavingSlideTex;
+        slide = getScene().getLeavingSlide();
+    } else {
+        texture = glEnteringSlideTex;
+        slide = getScene().getEnteringSlide();
+    }
+
+    displaySlide( nTime, texture, slide, SlideWidthScale, SlideHeightScale );
+    CHECK_GL_ERROR();
+}
+
+std::shared_ptr<OGLTransitionImpl>
+makeReflectionTransition(
+        const Primitives_t& rLeavingSlidePrimitives,
+        const Primitives_t& rEnteringSlidePrimitives,
+        const Operations_t& rOverallOperations,
+        const TransitionSettings& rSettings = TransitionSettings())
+{
+    return std::make_shared<ReflectionTransition>(
+            TransitionScene(rLeavingSlidePrimitives, rEnteringSlidePrimitives, rOverallOperations, SceneObjects_t()),
+            rSettings)
+        ;
+}
+
+}
+
+namespace
+{
+
 class SimpleTransition : public ShaderTransition
 {
 public:
@@ -639,25 +630,30 @@ std::shared_ptr<OGLTransitionImpl> makeFallLeaving()
 std::shared_ptr<OGLTransitionImpl> makeTurnAround()
 {
     Primitive Slide;
-
     TransitionSettings aSettings;
-    aSettings.mbReflectSlides = true;
 
     Slide.pushTriangle(glm::vec2(0,0),glm::vec2(1,0),glm::vec2(0,1));
     Slide.pushTriangle(glm::vec2(1,0),glm::vec2(0,1),glm::vec2(1,1));
     Primitives_t aLeavingPrimitives;
     aLeavingPrimitives.push_back(Slide);
 
+    Slide.Operations.push_back(makeSScale(glm::vec3(1, -1, 1), glm::vec3(0, -1.02, 0), false, -1, 0));
+    aLeavingPrimitives.push_back(Slide);
+
+    Slide.Operations.clear();
     Slide.Operations.push_back(makeRotateAndScaleDepthByWidth(glm::vec3(0,1,0),glm::vec3(0,0,0),-180,false,0.0,1.0));
     Primitives_t aEnteringPrimitives;
     aEnteringPrimitives.push_back(Slide);
 
+    Slide.Operations.push_back(makeSScale(glm::vec3(1, -1, 1), glm::vec3(0, -1.02, 0), false, -1, 0));
+    aEnteringPrimitives.push_back(Slide);
+
     Operations_t aOperations;
     aOperations.push_back(makeSTranslate(glm::vec3(0, 0, -1.5),true, 0, 0.5));
     aOperations.push_back(makeSTranslate(glm::vec3(0, 0, 1.5), true, 0.5, 1));
     aOperations.push_back(makeRotateAndScaleDepthByWidth(glm::vec3(0, 1, 0),glm::vec3(0, 0, 0), -180, true, 0.0, 1.0));
 
-    return makeSimpleTransition(aLeavingPrimitives, aEnteringPrimitives, aOperations, aSettings);
+    return makeReflectionTransition(aLeavingPrimitives, aEnteringPrimitives, aOperations, aSettings);
 }
 
 std::shared_ptr<OGLTransitionImpl> makeTurnDown()
@@ -755,15 +751,15 @@ std::shared_ptr<OGLTransitionImpl> makeIris()
 namespace
 {
 
-class RochadeTransition : public SimpleTransition
+class RochadeTransition : public ReflectionTransition
 {
 public:
     RochadeTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : SimpleTransition(rScene, rSettings)
+        : ReflectionTransition(rScene, rSettings)
     {}
 
 private:
-    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
+    virtual void displaySlides_(double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale) override;
 };
 
 void RochadeTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
@@ -798,9 +794,7 @@ makeRochadeTransition(
 std::shared_ptr<OGLTransitionImpl> makeRochade()
 {
     Primitive Slide;
-
     TransitionSettings aSettings;
-    aSettings.mbReflectSlides = true;
 
     double w, h;
 
@@ -815,6 +809,9 @@ std::shared_ptr<OGLTransitionImpl> makeRochade()
     Primitives_t aLeavingSlide;
     aLeavingSlide.push_back(Slide);
 
+    Slide.Operations.push_back(makeSScale(glm::vec3(1, -1, 1), glm::vec3(0, -1.02, 0), false, -1, 0));
+    aLeavingSlide.push_back(Slide);
+
     Slide.Operations.clear();
     Slide.Operations.push_back(makeSEllipseTranslate(w, h, 0.75, 0.25, true, 0, 1));
     Slide.Operations.push_back(makeSTranslate(glm::vec3(0, 0, -h), false, -1, 0));
@@ -823,6 +820,9 @@ std::shared_ptr<OGLTransitionImpl> makeRochade()
     Primitives_t aEnteringSlide;
     aEnteringSlide.push_back(Slide);
 
+    Slide.Operations.push_back(makeSScale(glm::vec3(1, -1, 1), glm::vec3(0, -1.02, 0), false, -1, 0));
+    aEnteringSlide.push_back(Slide);
+
     return makeRochadeTransition(aLeavingSlide, aEnteringSlide, aSettings);
 }
 
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
index a9f8b62..4238f8e 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
@@ -51,8 +51,7 @@ struct TransitionSettings
     TransitionSettings() :
         mbUseMipMapLeaving( true ),
         mbUseMipMapEntering( true ),
-        mnRequiredGLVersion( 1.0 ),
-        mbReflectSlides( false )
+        mnRequiredGLVersion( 1.0 )
     {
     }
 
@@ -64,11 +63,6 @@ struct TransitionSettings
     /** which GL version does the transition require
      */
     float mnRequiredGLVersion;
-
-    /** Whether to reflect slides, the reflection happens on flat surface beneath the slides.
-     ** Now it only works with slides which keep their rectangular shape together.
-     */
-    bool mbReflectSlides;
 };
 
 typedef std::vector<Primitive> Primitives_t;
commit f62990a835e4751366f0e499f2f9c9b92889c039
Author: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>
Date:   Fri Nov 20 20:13:04 2015 +0000

    slideshow: Reimplement both Fade transitions in shaders
    
    Change-Id: I94187b9316a206578bb738411053afe070703f09

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index dc03ff6..82fb3b9 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -13,6 +13,8 @@ $(eval $(call gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/op
 		basicVertexShader.glsl \
 		basicFragmentShader.glsl \
 		dissolveFragmentShader.glsl \
+		fadeBlackFragmentShader.glsl \
+		fadeFragmentShader.glsl \
 		staticFragmentShader.glsl \
 		vortexFragmentShader.glsl \
 		vortexVertexShader.glsl \
diff --git a/slideshow/opengl/fadeBlackFragmentShader.glsl b/slideshow/opengl/fadeBlackFragmentShader.glsl
new file mode 100644
index 0000000..7f80cc5
--- /dev/null
+++ b/slideshow/opengl/fadeBlackFragmentShader.glsl
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2015 by Collabora, Ltd.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 120
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+void main() {
+    vec4 black = vec4(0.0, 0.0, 0.0, 1.0);
+    vec4 texel;
+    float amount;
+    if (time < 0.5) {
+        texel = texture2D(leavingSlideTexture, v_texturePosition);
+        amount = time * 2;
+    } else {
+        texel = texture2D(enteringSlideTexture, v_texturePosition);
+        amount = (1.0 - time) * 2;
+    }
+    gl_FragColor = mix(texel, black, amount);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/fadeFragmentShader.glsl b/slideshow/opengl/fadeFragmentShader.glsl
new file mode 100644
index 0000000..aab848e
--- /dev/null
+++ b/slideshow/opengl/fadeFragmentShader.glsl
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2015 by Collabora, Ltd.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 120
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+void main() {
+    vec4 leavingFragment = texture2D(leavingSlideTexture, v_texturePosition);
+    vec4 enteringFragment = texture2D(enteringSlideTexture, v_texturePosition);
+    gl_FragColor = mix(leavingFragment, enteringFragment, time);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 6575da2..1f4cf9f 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -1367,51 +1367,22 @@ std::shared_ptr<OGLTransitionImpl> makeVenetianBlinds( bool vertical, int parts
 namespace
 {
 
-class FadeSmoothlyTransition : public SimpleTransition
+class FadeSmoothlyTransition : public ShaderTransition
 {
 public:
     FadeSmoothlyTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : SimpleTransition(rScene, rSettings)
+        : ShaderTransition(rScene, rSettings)
     {}
 
 private:
-    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
+    virtual GLuint makeShader() const override;
+    virtual void impl_prepareTransition() override {}
+    virtual void impl_finishTransition() override {}
 };
 
-void FadeSmoothlyTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
+GLuint FadeSmoothlyTransition::makeShader() const
 {
-    CHECK_GL_ERROR();
-    applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-
-    CHECK_GL_ERROR();
-    glDisable(GL_DEPTH_TEST);
-
-    CHECK_GL_ERROR();
-    displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
-    CHECK_GL_ERROR();
-
-    CHECK_GL_ERROR();
-    glDisable(GL_LIGHTING);
-    CHECK_GL_ERROR();
-    glEnable(GL_BLEND);
-    CHECK_GL_ERROR();
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    CHECK_GL_ERROR();
-    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-    CHECK_GL_ERROR();
-    glColor4f( 1, 1, 1, nTime );
-    CHECK_GL_ERROR();
-    displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
-    CHECK_GL_ERROR();
-    glDisable(GL_BLEND);
-    CHECK_GL_ERROR();
-    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-    CHECK_GL_ERROR();
-    glEnable(GL_LIGHTING);
-    CHECK_GL_ERROR();
-
-    glEnable(GL_DEPTH_TEST);
-    CHECK_GL_ERROR();
+    return OpenGLHelper::LoadShaders( "basicVertexShader", "fadeFragmentShader" );
 }
 
 std::shared_ptr<OGLTransitionImpl>
@@ -1448,41 +1419,22 @@ std::shared_ptr<OGLTransitionImpl> makeFadeSmoothly()
 namespace
 {
 
-class FadeThroughBlackTransition : public SimpleTransition
+class FadeThroughBlackTransition : public ShaderTransition
 {
 public:
     FadeThroughBlackTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : SimpleTransition(rScene, rSettings)
+        : ShaderTransition(rScene, rSettings)
     {}
 
 private:
-    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
+    virtual GLuint makeShader() const override;
+    virtual void impl_prepareTransition() override {}
+    virtual void impl_finishTransition() override {}
 };
 
-void FadeThroughBlackTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
+GLuint FadeThroughBlackTransition::makeShader() const
 {
-    CHECK_GL_ERROR();
-    applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-
-    glDisable(GL_DEPTH_TEST);
-
-    glDisable(GL_LIGHTING);
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-    if( nTime < 0.5 ) {
-        glColor4f( 1, 1, 1, 1 - nTime*2 );
-        displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
-    } else {
-        glColor4f( 1, 1, 1, (nTime - 0.5)*2 );
-        displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
-    }
-    glDisable(GL_BLEND);
-    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-    glEnable(GL_LIGHTING);
-
-    glEnable(GL_DEPTH_TEST);
-    CHECK_GL_ERROR();
+    return OpenGLHelper::LoadShaders( "basicVertexShader", "fadeBlackFragmentShader" );
 }
 
 std::shared_ptr<OGLTransitionImpl>
commit 1f91c05c55a32375d27eb23219928d0f01d4bc00
Author: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>
Date:   Fri Nov 20 20:13:03 2015 +0000

    slideshow: Make SimpleTransition inherit from ShaderTransition
    
    Many transitions don’t like the simplistic default shader, especially
    since it doesn’t handle lighting or reflections properly.
    
    Those issues are addressed in the following commits.  TODO: except
    lighting.
    
    Change-Id: Ia99308deb87c97d9bbe1da32aac64d0437061a84

diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index a312622..dc03ff6 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -11,6 +11,7 @@ $(eval $(call gb_Package_Package,slideshow_opengl_shader,$(SRCDIR)/slideshow/ope
 
 $(eval $(call gb_Package_add_files,slideshow_opengl_shader,$(LIBO_ETC_FOLDER)/opengl,\
 		basicVertexShader.glsl \
+		basicFragmentShader.glsl \
 		dissolveFragmentShader.glsl \
 		staticFragmentShader.glsl \
 		vortexFragmentShader.glsl \
diff --git a/slideshow/opengl/basicFragmentShader.glsl b/slideshow/opengl/basicFragmentShader.glsl
new file mode 100644
index 0000000..7744432
--- /dev/null
+++ b/slideshow/opengl/basicFragmentShader.glsl
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2015 by Collabora, Ltd.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#version 120
+
+uniform sampler2D slideTexture;
+varying vec2 v_texturePosition;
+
+void main() {
+     // TODO: handle lighting.
+     gl_FragColor = texture2D(slideTexture, v_texturePosition);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 0298eba..6575da2 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -397,24 +397,137 @@ void Iris::finish()
 namespace
 {
 
-class SimpleTransition : public OGLTransitionImpl
+class ShaderTransition : public OGLTransitionImpl
 {
-public:
-    SimpleTransition()
-        : OGLTransitionImpl()
-    {
+protected:
+    ShaderTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
+        : OGLTransitionImpl(rScene, rSettings)
+    {}
+
+private:
+    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
+    virtual void prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex ) override;
+    virtual void finishTransition() override;
+    virtual GLuint makeShader() const;
+
+    void impl_setTextureUniforms();
+    virtual void impl_prepareTransition() = 0;
+    virtual void impl_finishTransition() = 0;
+
+protected:
+    /** GLSL program object
+     */
+    GLuint m_nProgramObject = 0;
+};
+
+void ShaderTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
+                                              double SlideWidthScale, double SlideHeightScale )
+{
+    CHECK_GL_ERROR();
+    applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
+
+    if( m_nProgramObject ) {
+        GLint location = glGetUniformLocation( m_nProgramObject, "time" );
+        if( location != -1 ) {
+            glUniform1f( location, nTime );
+        }
     }
 
+    glActiveTexture( GL_TEXTURE2 );
+    glBindTexture( GL_TEXTURE_2D, glEnteringSlideTex );
+    glActiveTexture( GL_TEXTURE0 );
+
+    displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
+    CHECK_GL_ERROR();
+}
+
+GLuint ShaderTransition::makeShader() const
+{
+    return OpenGLHelper::LoadShaders( "basicVertexShader", "basicFragmentShader" );
+}
+
+void ShaderTransition::prepareTransition( sal_Int32 /* glLeavingSlideTex */, sal_Int32 /* glEnteringSlideTex */ )
+{
+    m_nProgramObject = makeShader();
+
+    impl_setTextureUniforms();
+    impl_prepareTransition();
+}
+
+void ShaderTransition::finishTransition()
+{
+    CHECK_GL_ERROR();
+    impl_finishTransition();
+    CHECK_GL_ERROR();
+    if( m_nProgramObject ) {
+        glDeleteProgram( m_nProgramObject );
+        m_nProgramObject = 0;
+    }
+    CHECK_GL_ERROR();
+}
+
+void ShaderTransition::impl_setTextureUniforms()
+{
+    CHECK_GL_ERROR();
+    if( m_nProgramObject ) {
+        glUseProgram( m_nProgramObject );
+        CHECK_GL_ERROR();
+
+        GLint location = glGetUniformLocation( m_nProgramObject, "leavingSlideTexture" );
+        if( location != -1 ) {
+            glUniform1i( location, 0 );  // texture unit 0
+            CHECK_GL_ERROR();
+        }
+
+        location = glGetUniformLocation( m_nProgramObject, "enteringSlideTexture" );
+        if( location != -1 ) {
+            glUniform1i( location, 2 );  // texture unit 2
+            CHECK_GL_ERROR();
+        }
+    }
+    CHECK_GL_ERROR();
+}
+
+}
+
+namespace
+{
+
+class SimpleTransition : public ShaderTransition
+{
+public:
     SimpleTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : OGLTransitionImpl(rScene, rSettings)
+        : ShaderTransition(rScene, rSettings)
     {
     }
+
+private:
+    virtual void impl_finishTransition() override {}
+    virtual void impl_prepareTransition() override {}
+
+    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
 };
 
-std::shared_ptr<OGLTransitionImpl>
-makeSimpleTransition()
+void SimpleTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
+                                              double SlideWidthScale, double SlideHeightScale )
 {
-    return std::make_shared<SimpleTransition>();
+    CHECK_GL_ERROR();
+    applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
+
+    glActiveTexture( GL_TEXTURE2 );
+    glBindTexture( GL_TEXTURE_2D, glEnteringSlideTex );
+    glActiveTexture( GL_TEXTURE0 );
+
+    GLint location = -1;
+    if( m_nProgramObject )
+        location = glGetUniformLocation( m_nProgramObject, "slideTexture" );
+    if( location != -1 )
+        glUniform1f( location, 2 );
+    displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
+    if( location != -1 )
+        glUniform1f( location, 0 );
+    displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
+    CHECK_GL_ERROR();
 }
 
 std::shared_ptr<OGLTransitionImpl>
@@ -642,11 +755,11 @@ std::shared_ptr<OGLTransitionImpl> makeIris()
 namespace
 {
 
-class RochadeTransition : public OGLTransitionImpl
+class RochadeTransition : public SimpleTransition
 {
 public:
     RochadeTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : OGLTransitionImpl(rScene, rSettings)
+        : SimpleTransition(rScene, rSettings)
     {}
 
 private:
@@ -735,10 +848,7 @@ std::shared_ptr<OGLTransitionImpl> makeRevolvingCircles( sal_uInt16 nCircles , s
 {
     double dAngle(2*3.1415926/static_cast<double>( nPointsOnCircles ));
     if(nCircles < 2 || nPointsOnCircles < 4)
-    {
-        makeNByMTileFlip(1,1);
-        return makeSimpleTransition();
-    }
+        return makeNByMTileFlip(1,1);
     float Radius(1.0/static_cast<double>( nCircles ));
     float dRadius(Radius);
     float LastRadius(0.0);
@@ -1155,16 +1265,15 @@ void Primitive::pushTriangle(const glm::vec2& SlideLocation0,const glm::vec2& Sl
 namespace
 {
 
-class DiamondTransition : public OGLTransitionImpl
+class DiamondTransition : public SimpleTransition
 {
 public:
     DiamondTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : OGLTransitionImpl(rScene, rSettings)
+        : SimpleTransition(rScene, rSettings)
         {}
 
 private:
     virtual void prepare( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) override;
-    // mmPrepare = &OGLTransitionImpl::prepareDiamond;
 };
 
 void DiamondTransition::prepare( double nTime, double /* SlideWidth */, double /* SlideHeight */, double /* DispWidth */, double /* DispHeight */ )
@@ -1258,11 +1367,11 @@ std::shared_ptr<OGLTransitionImpl> makeVenetianBlinds( bool vertical, int parts
 namespace
 {
 
-class FadeSmoothlyTransition : public OGLTransitionImpl
+class FadeSmoothlyTransition : public SimpleTransition
 {
 public:
     FadeSmoothlyTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : OGLTransitionImpl(rScene, rSettings)
+        : SimpleTransition(rScene, rSettings)
     {}
 
 private:
@@ -1339,11 +1448,11 @@ std::shared_ptr<OGLTransitionImpl> makeFadeSmoothly()
 namespace
 {
 
-class FadeThroughBlackTransition : public OGLTransitionImpl
+class FadeThroughBlackTransition : public SimpleTransition
 {
 public:
     FadeThroughBlackTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : OGLTransitionImpl(rScene, rSettings)
+        : SimpleTransition(rScene, rSettings)
     {}
 
 private:
@@ -1410,67 +1519,25 @@ std::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack()
 namespace
 {
 
-class ShaderTransition : public OGLTransitionImpl
+class PermTextureTransition : public ShaderTransition
 {
 protected:
-    ShaderTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : OGLTransitionImpl(rScene, rSettings)
-        , m_nProgramObject(0)
+    PermTextureTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
+        : ShaderTransition(rScene, rSettings)
         , m_nHelperTexture(0)
     {}
 
-private:
-    virtual void displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale ) override;
-    virtual void prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex ) override;
-    virtual void finishTransition() override;
-    virtual GLuint makeShader() = 0;
-
-    void impl_preparePermShader();
+    virtual void impl_finishTransition() override;
+    virtual void impl_prepareTransition() override;
 
 private:
-    /** GLSL program object
-     */
-    GLuint m_nProgramObject;
-
     /** various data */
     GLuint m_nHelperTexture;
 };
 
-void ShaderTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTex, sal_Int32 glEnteringSlideTex,
-                                              double SlideWidthScale, double SlideHeightScale )
+void PermTextureTransition::impl_finishTransition()
 {
     CHECK_GL_ERROR();
-    applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-
-    if( m_nProgramObject ) {
-        GLint location = glGetUniformLocation( m_nProgramObject, "time" );
-        if( location != -1 ) {
-            glUniform1f( location, nTime );
-        }
-    }
-
-    glActiveTexture( GL_TEXTURE2 );
-    glBindTexture( GL_TEXTURE_2D, glEnteringSlideTex );
-    glActiveTexture( GL_TEXTURE0 );
-
-    displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
-    CHECK_GL_ERROR();
-}
-
-void ShaderTransition::prepareTransition( sal_Int32 /* glLeavingSlideTex */, sal_Int32 /* glEnteringSlideTex */ )
-{
-    m_nProgramObject = makeShader();
-
-    impl_preparePermShader();
-}
-
-void ShaderTransition::finishTransition()
-{
-    CHECK_GL_ERROR();
-    if( m_nProgramObject ) {
-        glDeleteProgram( m_nProgramObject );
-        m_nProgramObject = 0;
-    }
     if ( m_nHelperTexture )
     {
         glDeleteTextures( 1, &m_nHelperTexture );
@@ -1514,7 +1581,7 @@ int permutation256 [256]= {
 116, 171,  99, 202,   7, 107, 253, 108
 };
 
-void initPermTexture(GLuint *texID)
+static void initPermTexture(GLuint *texID)
 {
     CHECK_GL_ERROR();
   glGenTextures(1, texID);
@@ -1538,20 +1605,11 @@ void initPermTexture(GLuint *texID)
     CHECK_GL_ERROR();
 }
 
-void ShaderTransition::impl_preparePermShader()
+void PermTextureTransition::impl_prepareTransition()
 {
     CHECK_GL_ERROR();
     if( m_nProgramObject ) {
-        glUseProgram( m_nProgramObject );
-        CHECK_GL_ERROR();
-
-        GLint location = glGetUniformLocation( m_nProgramObject, "leavingSlideTexture" );
-        if( location != -1 ) {
-            glUniform1i( location, 0 );  // texture unit 0
-            CHECK_GL_ERROR();
-        }
-
-        location = glGetUniformLocation( m_nProgramObject, "permTexture" );
+        GLint location = glGetUniformLocation( m_nProgramObject, "permTexture" );
         if( location != -1 ) {
             glActiveTexture(GL_TEXTURE1);
             CHECK_GL_ERROR();
@@ -1564,12 +1622,6 @@ void ShaderTransition::impl_preparePermShader()
             glUniform1i( location, 1 );  // texture unit 1
             CHECK_GL_ERROR();
         }
-
-        location = glGetUniformLocation( m_nProgramObject, "enteringSlideTexture" );
-        if( location != -1 ) {
-            glUniform1i( location, 2 );  // texture unit 2
-            CHECK_GL_ERROR();
-        }
     }
     CHECK_GL_ERROR();
 }
@@ -1579,18 +1631,18 @@ void ShaderTransition::impl_preparePermShader()
 namespace
 {
 
-class StaticNoiseTransition : public ShaderTransition
+class StaticNoiseTransition : public PermTextureTransition
 {
 public:
     StaticNoiseTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : ShaderTransition(rScene, rSettings)
+        : PermTextureTransition(rScene, rSettings)
     {}
 
 private:
-    virtual GLuint makeShader() override;
+    virtual GLuint makeShader() const override;
 };
 
-GLuint StaticNoiseTransition::makeShader()
+GLuint StaticNoiseTransition::makeShader() const
 {
     return OpenGLHelper::LoadShaders( "basicVertexShader", "staticFragmentShader" );
 }
@@ -1630,18 +1682,18 @@ std::shared_ptr<OGLTransitionImpl> makeStatic()
 namespace
 {
 
-class DissolveTransition : public ShaderTransition
+class DissolveTransition : public PermTextureTransition
 {
 public:
     DissolveTransition(const TransitionScene& rScene, const TransitionSettings& rSettings)
-        : ShaderTransition(rScene, rSettings)
+        : PermTextureTransition(rScene, rSettings)
     {}
 
 private:
-    virtual GLuint makeShader() override;
+    virtual GLuint makeShader() const override;
 };
 
-GLuint DissolveTransition::makeShader()
+GLuint DissolveTransition::makeShader() const
 {
     return OpenGLHelper::LoadShaders( "basicVertexShader", "dissolveFragmentShader" );
 }
@@ -1681,11 +1733,11 @@ std::shared_ptr<OGLTransitionImpl> makeDissolve()
 namespace
 {
 
-class VortexTransition : public ShaderTransition
+class VortexTransition : public PermTextureTransition
 {
 public:
     VortexTransition(const TransitionScene& rScene, const TransitionSettings& rSettings, int nNX, int nNY)
-        : ShaderTransition(rScene, rSettings)
+        : PermTextureTransition(rScene, rSettings)
         , mnTileInfoLocation(0)
         , mnTileInfoBuffer(0)
         , maNumTiles(nNX,nNY)
@@ -1698,7 +1750,9 @@ private:
 
     virtual void finish( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) override;
 
-    virtual GLuint makeShader() override;
+    virtual GLuint makeShader() const override;
+
+    virtual void impl_prepareTransition() override;
 
     GLint mnTileInfoLocation;
     GLuint mnTileInfoBuffer;
@@ -1728,19 +1782,26 @@ void VortexTransition::finish( double, double, double, double, double )
     glEnable(GL_CULL_FACE);
 }
 
-GLuint VortexTransition::makeShader()
+GLuint VortexTransition::makeShader() const
 {
-    GLuint nProgram = OpenGLHelper::LoadShaders( "vortexVertexShader", "vortexFragmentShader" );
+    return OpenGLHelper::LoadShaders( "vortexVertexShader", "vortexFragmentShader" );
+}
 
-    if (nProgram)
+void VortexTransition::impl_prepareTransition()
+{
+    CHECK_GL_ERROR();
+    PermTextureTransition::impl_prepareTransition();
+    CHECK_GL_ERROR();
+
+    if (m_nProgramObject)
     {
-        mnTileInfoLocation = glGetAttribLocation(nProgram, "tileInfo");
+        mnTileInfoLocation = glGetAttribLocation(m_nProgramObject, "tileInfo");
         CHECK_GL_ERROR();
 
-        glUseProgram(nProgram);
+        glUseProgram(m_nProgramObject);
         CHECK_GL_ERROR();
 
-        GLint nNumTilesLocation = glGetUniformLocation(nProgram, "numTiles");
+        GLint nNumTilesLocation = glGetUniformLocation(m_nProgramObject, "numTiles");
         CHECK_GL_ERROR();
 
         glUniform2iv(nNumTilesLocation, 1, glm::value_ptr(maNumTiles));
@@ -1777,8 +1838,6 @@ GLuint VortexTransition::makeShader()
 
     glBindBuffer(GL_ARRAY_BUFFER, 0);
     CHECK_GL_ERROR();
-
-    return nProgram;
 }
 
 std::shared_ptr<OGLTransitionImpl>
@@ -1833,28 +1892,31 @@ public:
     }
 
 private:
-    virtual GLuint makeShader() override;
+    virtual GLuint makeShader() const override;
+    virtual void impl_prepareTransition() override;
+    virtual void impl_finishTransition() override {}
 
     glm::vec2 maCenter;
 };
 
-GLuint RippleTransition::makeShader()
+GLuint RippleTransition::makeShader() const
 {
-    GLuint nProgram = OpenGLHelper::LoadShaders( "basicVertexShader", "rippleFragmentShader" );
+    return OpenGLHelper::LoadShaders( "basicVertexShader", "rippleFragmentShader" );
+}
 
-    if (nProgram)
+void RippleTransition::impl_prepareTransition()
+{
+    if (m_nProgramObject)
     {
-        glUseProgram(nProgram);
+        glUseProgram(m_nProgramObject);
         CHECK_GL_ERROR();
 
-        GLint nCenterLocation = glGetUniformLocation(nProgram, "center");
+        GLint nCenterLocation = glGetUniformLocation(m_nProgramObject, "center");
         CHECK_GL_ERROR();
 
         glUniform2fv(nCenterLocation, 1, glm::value_ptr(maCenter));
         CHECK_GL_ERROR();
     }
-
-    return nProgram;
 }
 
 std::shared_ptr<OGLTransitionImpl>
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
index 41e32ca..a9f8b62 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.hxx
@@ -168,8 +168,6 @@ protected:
         , maSettings(rSettings)
     {}
 
-    OGLTransitionImpl() {}
-
     TransitionScene const& getScene() const
     {
         return maScene;


More information about the Libreoffice-commits mailing list