summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slideshow/Library_OGLTrans.mk2
-rw-r--r--slideshow/Package_opengl.mk18
-rw-r--r--slideshow/opengl/basicVertexShader.glsl37
-rw-r--r--slideshow/opengl/dissolveFragmentShader.glsl48
-rw-r--r--slideshow/opengl/staticFragmentShader.glsl64
-rw-r--r--slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.cxx191
-rw-r--r--slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.hxx75
-rw-r--r--slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx111
8 files changed, 186 insertions, 360 deletions
diff --git a/slideshow/Library_OGLTrans.mk b/slideshow/Library_OGLTrans.mk
index a539847d776b..80879efe429b 100644
--- a/slideshow/Library_OGLTrans.mk
+++ b/slideshow/Library_OGLTrans.mk
@@ -70,14 +70,12 @@ $(eval $(call gb_Library_use_system_win32_libs,OGLTrans,\
))
$(eval $(call gb_Library_add_exception_objects,OGLTrans,\
- slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders \
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl \
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl \
))
else
$(eval $(call gb_Library_add_exception_objects,OGLTrans,\
- slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders \
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl \
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl \
))
diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
new file mode 100644
index 000000000000..866bfd0b94a8
--- /dev/null
+++ b/slideshow/Package_opengl.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Package_Package,slideshow_opengl_shader,$(SRCDIR)/slideshow/opengl))
+
+$(eval $(call gb_Package_add_files,slideshow_opengl_shader,$(LIBO_BIN_FOLDER)/opengl,\
+ slideshow/opengl/basicVertexShader.glsl \
+ slideshow/opengl/dissolveFragmentShader.glsl \
+ slideshow/opengl/staticFragmentShader.glsl \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/slideshow/opengl/basicVertexShader.glsl b/slideshow/opengl/basicVertexShader.glsl
new file mode 100644
index 000000000000..4ca615a57689
--- /dev/null
+++ b/slideshow/opengl/basicVertexShader.glsl
@@ -0,0 +1,37 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+
+varying vec2 v_texturePosition;
+
+void main( void )
+{
+ gl_Position = ftransform();
+ v_texturePosition = gl_MultiTexCoord0.xy;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/dissolveFragmentShader.glsl b/slideshow/opengl/dissolveFragmentShader.glsl
new file mode 100644
index 000000000000..1ceb13f69863
--- /dev/null
+++ b/slideshow/opengl/dissolveFragmentShader.glsl
@@ -0,0 +1,48 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform sampler2D permTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+float snoise(vec2 P) {
+
+ return texture2D(permTexture, P).r;
+}
+
+void main() {
+ float sn = snoise(10.0*v_texturePosition);
+ if( sn < time)
+ gl_FragColor = texture2D(enteringSlideTexture, v_texturePosition);
+ else
+ gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/opengl/staticFragmentShader.glsl b/slideshow/opengl/staticFragmentShader.glsl
new file mode 100644
index 000000000000..c3cb6693ab21
--- /dev/null
+++ b/slideshow/opengl/staticFragmentShader.glsl
@@ -0,0 +1,64 @@
+/* -*- 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.
+ *
+ ************************************************************************/
+
+uniform sampler2D leavingSlideTexture;
+uniform sampler2D enteringSlideTexture;
+uniform sampler2D permTexture;
+uniform float time;
+varying vec2 v_texturePosition;
+
+float snoise(vec2 P) {
+
+ return texture2D(permTexture, P).r;
+}
+
+
+#define PART 0.5
+#define START 0.4
+#define END 0.9
+
+void main() {
+ float sn = snoise(10.0*v_texturePosition+time*0.07);
+ if( time < PART ) {
+ float sn1 = snoise(vec2(time*15.0, 20.0*v_texturePosition.y));
+ float sn2 = snoise(v_texturePosition);
+ if (sn1 > 1.0 - time*time && sn2 < 2.0*time+0.1)
+ gl_FragColor = vec4(sn, sn, sn, 1.0);
+ else if (time > START )
+ gl_FragColor = ((time-START)/(PART - START))*vec4(sn, sn, sn, 1.0) + (1.0 - (time - START)/(PART - START))*texture2D(leavingSlideTexture, v_texturePosition);
+ else
+ gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);
+ } else if ( time < PART ) {
+ gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);
+ } else if ( time > END ) {
+ gl_FragColor = ((1.0 - time)/(1.0 - END))*vec4(sn, sn, sn, 1.0) + ((time - END)/(1.0 - END))*texture2D(enteringSlideTexture, v_texturePosition);
+ } else
+ gl_FragColor = vec4(sn, sn, sn, 1.0);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.cxx
deleted file mode 100644
index 191bca8893b7..000000000000
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.cxx
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- 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.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- ************************************************************************/
-
-#include <config_lgpl.h>
-
-#include <osl/diagnose.hxx>
-
-#include "OGLTrans_Shaders.hxx"
-
-#ifdef _WIN32
-
-#elif defined(MACOSX)
-
-#else // UNX == X11
-
-#define GLX_GLXEXT_PROTOTYPES 1
-#include <GL/glx.h>
-#include <GL/glxext.h>
-
-#endif
-
-namespace
-{
-
-typedef void (*GLFunction_t)();
-
-#ifdef _WIN32
-
-GLFunction_t lcl_glGetProcAddress(const char *const name)
-{
- return wglGetProcAddress(name);
-}
-
-#elif defined(MACOSX)
-
-GLFunction_t lcl_glGetProcAddress(const char *const name)
-{
- return 0;
-}
-
-#else // UNX == X11
-
-GLFunction_t lcl_glGetProcAddress(const char *const name)
-{
- return glXGetProcAddress(reinterpret_cast<const GLubyte*>(name));
-}
-
-#endif
-
-}
-
-bool OGLShaders::cbInitialized = false;
-
-#ifdef GL_VERSION_2_0
-
-PFNGLACTIVETEXTUREPROC OGLShaders::glActiveTexture = NULL;
-PFNGLCREATESHADERPROC OGLShaders::glCreateShader = NULL;
-PFNGLSHADERSOURCEPROC OGLShaders::glShaderSource = NULL;
-PFNGLCOMPILESHADERPROC OGLShaders::glCompileShader = NULL;
-PFNGLGETSHADERIVPROC OGLShaders::glGetShaderiv = NULL;
-PFNGLGETSHADERINFOLOGPROC OGLShaders::glGetShaderInfoLog = NULL;
-PFNGLDELETESHADERPROC OGLShaders::glDeleteShader = NULL;
-PFNGLCREATEPROGRAMPROC OGLShaders::glCreateProgram = NULL;
-PFNGLATTACHSHADERPROC OGLShaders::glAttachShader = NULL;
-PFNGLLINKPROGRAMPROC OGLShaders::glLinkProgram = NULL;
-PFNGLGETPROGRAMIVPROC OGLShaders::glGetProgramiv = NULL;
-PFNGLGETPROGRAMINFOLOGPROC OGLShaders::glGetProgramInfoLog = NULL;
-PFNGLUSEPROGRAMPROC OGLShaders::glUseProgram = NULL;
-PFNGLDELETEPROGRAMPROC OGLShaders::glDeleteProgram = NULL;
-PFNGLGETUNIFORMLOCATIONPROC OGLShaders::glGetUniformLocation = NULL;
-PFNGLUNIFORM1IPROC OGLShaders::glUniform1i = NULL;
-PFNGLUNIFORM1FPROC OGLShaders::glUniform1f = NULL;
-#endif
-
-bool OGLShaders::Initialize()
-{
-#ifdef GL_VERSION_2_0
- if( !cbInitialized ) {
- glActiveTexture = (PFNGLACTIVETEXTUREPROC) lcl_glGetProcAddress( "glActiveTexture" );
- glCreateShader = (PFNGLCREATESHADERPROC) lcl_glGetProcAddress( "glCreateShader" );
- glShaderSource = (PFNGLSHADERSOURCEPROC) lcl_glGetProcAddress( "glShaderSource" );
- glCompileShader = (PFNGLCOMPILESHADERPROC) lcl_glGetProcAddress( "glCompileShader" );
- glGetShaderiv = (PFNGLGETSHADERIVPROC) lcl_glGetProcAddress( "glGetShaderiv" );
- glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) lcl_glGetProcAddress( "glGetShaderInfoLog" );
- glDeleteShader = (PFNGLDELETESHADERPROC) lcl_glGetProcAddress( "glDeleteShader" );
- glCreateProgram = (PFNGLCREATEPROGRAMPROC) lcl_glGetProcAddress( "glCreateProgram" );
- glAttachShader = (PFNGLATTACHSHADERPROC) lcl_glGetProcAddress( "glAttachShader" );
- glLinkProgram = (PFNGLLINKPROGRAMPROC) lcl_glGetProcAddress( "glLinkProgram" );
- glGetProgramiv = (PFNGLGETPROGRAMIVPROC) lcl_glGetProcAddress( "glGetProgramiv" );
- glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) lcl_glGetProcAddress( "glGetProgramInfoLog" );
- glUseProgram = (PFNGLUSEPROGRAMPROC) lcl_glGetProcAddress( "glUseProgram" );
- glDeleteProgram = (PFNGLDELETEPROGRAMPROC) lcl_glGetProcAddress( "glDeleteProgram" );
- glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) lcl_glGetProcAddress( "glGetUniformLocation" );
- glUniform1i = (PFNGLUNIFORM1IPROC) lcl_glGetProcAddress( "glUniform1i" );
- glUniform1f = (PFNGLUNIFORM1FPROC) lcl_glGetProcAddress( "glUniform1f" );
- cbInitialized = true;
- }
-
- return glCreateShader != NULL;
-#else
- return false;
-#endif
-}
-
-GLuint OGLShaders::LinkProgram( const char *vertexShader, const char *fragmentShader )
-{
-#ifdef GL_VERSION_2_0
- if( !Initialize() )
- return 0;
-
- GLhandleARB vertexObject, fragmentObject, programObject;
- GLint vertexCompiled, fragmentCompiled, programLinked;
- char log[1024];
-
- vertexObject = glCreateShader( GL_VERTEX_SHADER );
- fragmentObject = glCreateShader( GL_FRAGMENT_SHADER );
- SAL_INFO("slideshow.opengl", "checkpoint 1: shaders created (" << (glGetError() == GL_NO_ERROR) << ") vertex: " << vertexObject << " fragment: " << fragmentObject);
-
-
- glShaderSource( vertexObject, 1, &vertexShader, NULL );
- glShaderSource( fragmentObject, 1, &fragmentShader, NULL );
-
- glCompileShader( vertexObject );
- glGetShaderInfoLog( vertexObject, sizeof( log ), NULL, log );
- SAL_INFO("slideshow.opengl", "vertex compile log: " << log);
- glGetShaderiv( vertexObject, GL_COMPILE_STATUS, &vertexCompiled );
- glCompileShader( fragmentObject );
- glGetShaderInfoLog( fragmentObject, sizeof( log ), NULL, log );
- SAL_INFO("slideshow.opengl", "fragment compile log: " << log);
- glGetShaderiv( fragmentObject, GL_COMPILE_STATUS, &fragmentCompiled );
-
- if( !vertexCompiled || !fragmentCompiled )
- return 0;
-
- SAL_INFO("slideshow.opengl", "checkpoint 2: shaders compiled (" << (glGetError() == GL_NO_ERROR) << ')');
-
- programObject = glCreateProgram();
- glAttachShader( programObject, vertexObject );
- glAttachShader( programObject, fragmentObject );
-
- glLinkProgram( programObject );
- glGetProgramInfoLog( programObject, sizeof( log ), NULL, log );
- SAL_INFO("slideshow.opengl", "program link log: " << log);
- glGetProgramiv( programObject, GL_LINK_STATUS, &programLinked );
-
- if( !programLinked )
- return 0;
-
- SAL_INFO("slideshow.opengl", "checkpoint 3: program linked (" << (glGetError() == GL_NO_ERROR) << ')');
-
- return programObject;
-#else
- return 0;
-#endif
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.hxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.hxx
deleted file mode 100644
index bb2aa9d13847..000000000000
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- 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.
- *
- ************************************************************************/
-
-#ifndef INCLUDED_OGLTRANS_SHADERS_HXX_
-#define INCLUDED_OGLTRANS_SHADERS_HXX_
-
-#include <config_lgpl.h>
-
-#define GL_GLEXT_PROTOTYPES 1
-#include <GL/gl.h>
-#include <GL/glext.h>
-
-class OGLShaders {
- static bool Initialize();
- static bool cbInitialized;
-
-public:
-
- static GLuint LinkProgram( const char *vertexShader, const char *fragmentShader );
-
- /** GL shader functions
- */
-#ifdef GL_VERSION_2_0
-
- static PFNGLACTIVETEXTUREPROC glActiveTexture;
-
- static PFNGLCREATESHADERPROC glCreateShader;
- static PFNGLSHADERSOURCEPROC glShaderSource;
- static PFNGLCOMPILESHADERPROC glCompileShader;
- static PFNGLGETSHADERIVPROC glGetShaderiv;
- static PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
- static PFNGLDELETESHADERPROC glDeleteShader;
-
- static PFNGLCREATEPROGRAMPROC glCreateProgram;
- static PFNGLATTACHSHADERPROC glAttachShader;
- static PFNGLLINKPROGRAMPROC glLinkProgram;
- static PFNGLGETPROGRAMIVPROC glGetProgramiv;
- static PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
- static PFNGLUSEPROGRAMPROC glUseProgram;
- static PFNGLDELETEPROGRAMPROC glDeleteProgram;
-
- static PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
- static PFNGLUNIFORM1IPROC glUniform1i;
- static PFNGLUNIFORM1FPROC glUniform1f;
-#endif
-};
-
-#endif
-
-/* 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 56a080bd5c1e..63d5753ecc18 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -26,13 +26,14 @@
*
************************************************************************/
+#include <GL/glew.h>
+#include <vcl/opengl/OpenGLHelper.hxx>
+
#include <utility>
#include <boost/make_shared.hpp>
#include "OGLTrans_TransitionImpl.hxx"
-#include "OGLTrans_Shaders.hxx"
-#include <GL/gl.h>
#include <math.h>
using boost::make_shared;
@@ -1302,74 +1303,6 @@ boost::shared_ptr<OGLTransitionImpl> makeFadeThroughBlack()
return makeFadeThroughBlackTransition(aLeavingSlide, aEnteringSlide, aSettings);
}
-static const char* basicVertexShader = "\n\
-varying vec2 v_texturePosition;\n\
-\n\
-void main( void )\n\
-{\n\
- gl_Position = ftransform();\n\
- v_texturePosition = gl_MultiTexCoord0.xy;\n\
-}\n\
-";
-
-static const char* staticFragmentShader = "\n\
-uniform sampler2D leavingSlideTexture;\n\
-uniform sampler2D enteringSlideTexture;\n\
-uniform sampler2D permTexture;\n\
-uniform float time;\n\
-varying vec2 v_texturePosition;\n\
-\n\
-float snoise(vec2 P) {\n\
-\n\
- return texture2D(permTexture, P).r;\n\
-}\n\
-\n\
-\n\
-#define PART 0.5\n\
-#define START 0.4\n\
-#define END 0.9\n\
-\n\
-void main() {\n\
- float sn = snoise(10.0*v_texturePosition+time*0.07);\n\
- if( time < PART ) {\n\
- float sn1 = snoise(vec2(time*15.0, 20.0*v_texturePosition.y));\n\
- float sn2 = snoise(v_texturePosition);\n\
- if (sn1 > 1.0 - time*time && sn2 < 2.0*time+0.1)\n\
- gl_FragColor = vec4(sn, sn, sn, 1.0);\n\
- else if (time > START )\n\
- gl_FragColor = ((time-START)/(PART - START))*vec4(sn, sn, sn, 1.0) + (1.0 - (time - START)/(PART - START))*texture2D(leavingSlideTexture, v_texturePosition);\n\
- else\n\
- gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);\n\
- } else if ( time < PART ) {\n\
- gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);\n\
- } else if ( time > END ) {\n\
- gl_FragColor = ((1.0 - time)/(1.0 - END))*vec4(sn, sn, sn, 1.0) + ((time - END)/(1.0 - END))*texture2D(enteringSlideTexture, v_texturePosition);\n\
- } else \n\
- gl_FragColor = vec4(sn, sn, sn, 1.0);\n\
-}\n\
-";
-
-static const char* dissolveFragmentShader = "\n\
-uniform sampler2D leavingSlideTexture;\n\
-uniform sampler2D enteringSlideTexture;\n\
-uniform sampler2D permTexture;\n\
-uniform float time;\n\
-varying vec2 v_texturePosition;\n\
-\n\
-float snoise(vec2 P) {\n\
-\n\
- return texture2D(permTexture, P).r;\n\
-}\n\
-\n\
-void main() {\n\
- float sn = snoise(10.0*v_texturePosition);\n\
- if( sn < time)\n\
- gl_FragColor = texture2D(enteringSlideTexture, v_texturePosition);\n\
- else\n\
- gl_FragColor = texture2D(leavingSlideTexture, v_texturePosition);\n\
-}\n\
-";
-
namespace
{
@@ -1404,18 +1337,16 @@ void ShaderTransition::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideT
{
applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
-#ifdef GL_VERSION_2_0
if( m_nProgramObject ) {
- GLint location = OGLShaders::glGetUniformLocation( m_nProgramObject, "time" );
+ GLint location = glGetUniformLocation( m_nProgramObject, "time" );
if( location != -1 ) {
- OGLShaders::glUniform1f( location, nTime );
+ glUniform1f( location, nTime );
}
}
- OGLShaders::glActiveTexture( GL_TEXTURE2 );
+ glActiveTexture( GL_TEXTURE2 );
glBindTexture( GL_TEXTURE_2D, glEnteringSlideTex );
- OGLShaders::glActiveTexture( GL_TEXTURE0 );
-#endif
+ glActiveTexture( GL_TEXTURE0 );
displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
}
@@ -1429,9 +1360,8 @@ void ShaderTransition::prepareTransition_( ::sal_Int32 /* glLeavingSlideTex */,
void ShaderTransition::finishTransition_()
{
-#ifdef GL_VERSION_2_0
if( m_nProgramObject ) {
- OGLShaders::glDeleteProgram( m_nProgramObject );
+ glDeleteProgram( m_nProgramObject );
m_nProgramObject = 0;
}
if ( m_nHelperTexture )
@@ -1439,7 +1369,6 @@ void ShaderTransition::finishTransition_()
glDeleteTextures( 1, &m_nHelperTexture );
m_nHelperTexture = 0;
}
-#endif
}
int permutation256 [256]= {
@@ -1501,31 +1430,29 @@ void initPermTexture(GLuint *texID)
void ShaderTransition::impl_preparePermShader()
{
-#ifdef GL_VERSION_2_0
if( m_nProgramObject ) {
- OGLShaders::glUseProgram( m_nProgramObject );
+ glUseProgram( m_nProgramObject );
- GLint location = OGLShaders::glGetUniformLocation( m_nProgramObject, "leavingSlideTexture" );
+ GLint location = glGetUniformLocation( m_nProgramObject, "leavingSlideTexture" );
if( location != -1 ) {
- OGLShaders::glUniform1i( location, 0 ); // texture unit 0
+ glUniform1i( location, 0 ); // texture unit 0
}
- OGLShaders::glActiveTexture(GL_TEXTURE1);
+ glActiveTexture(GL_TEXTURE1);
if( !m_nHelperTexture )
initPermTexture( &m_nHelperTexture );
- OGLShaders::glActiveTexture(GL_TEXTURE0);
+ glActiveTexture(GL_TEXTURE0);
- location = OGLShaders::glGetUniformLocation( m_nProgramObject, "permTexture" );
+ location = glGetUniformLocation( m_nProgramObject, "permTexture" );
if( location != -1 ) {
- OGLShaders::glUniform1i( location, 1 ); // texture unit 1
+ glUniform1i( location, 1 ); // texture unit 1
}
- location = OGLShaders::glGetUniformLocation( m_nProgramObject, "enteringSlideTexture" );
+ location = glGetUniformLocation( m_nProgramObject, "enteringSlideTexture" );
if( location != -1 ) {
- OGLShaders::glUniform1i( location, 2 ); // texture unit 2
+ glUniform1i( location, 2 ); // texture unit 2
}
}
-#endif
}
}
@@ -1546,7 +1473,7 @@ private:
GLuint StaticNoiseTransition::makeShader_()
{
- return OGLShaders::LinkProgram( basicVertexShader, staticFragmentShader );
+ return OpenGLHelper::LoadShaders( "basicVertexShader.glsl", "staticFragmentShader.glsl" );
}
shared_ptr<OGLTransitionImpl>
@@ -1597,7 +1524,7 @@ private:
GLuint DissolveTransition::makeShader_()
{
- return OGLShaders::LinkProgram( basicVertexShader, dissolveFragmentShader );
+ return OpenGLHelper::LoadShaders( "basicVertexShader.glsl", "dissolveFragmentShader.glsl" );
}
shared_ptr<OGLTransitionImpl>