[Libreoffice-commits] core.git: 5 commits - canvas/Library_oglcanvas.mk canvas/source slideshow/Library_OGLTrans.mk slideshow/Module_slideshow.mk slideshow/opengl slideshow/Package_opengl.mk slideshow/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Tue Aug 12 17:14:44 PDT 2014


 canvas/Library_oglcanvas.mk                                            |    1 
 canvas/source/opengl/ogl_canvasbitmap.cxx                              |    2 
 canvas/source/opengl/ogl_canvascustomsprite.cxx                        |    2 
 canvas/source/opengl/ogl_spritecanvas.cxx                              |    2 
 canvas/source/opengl/ogl_spritedevicehelper.cxx                        |    3 
 canvas/source/opengl/ogl_spritedevicehelper.hxx                        |    1 
 slideshow/Library_OGLTrans.mk                                          |    2 
 slideshow/Module_slideshow.mk                                          |    1 
 slideshow/Package_opengl.mk                                            |   18 
 slideshow/opengl/basicVertexShader.glsl                                |   37 +
 slideshow/opengl/dissolveFragmentShader.glsl                           |   48 ++
 slideshow/opengl/staticFragmentShader.glsl                             |   64 +++
 slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.cxx          |  191 ----------
 slideshow/source/engine/OGLTrans/generic/OGLTrans_Shaders.hxx          |   75 ---
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx   |  111 -----
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx |   11 
 16 files changed, 198 insertions(+), 371 deletions(-)

New commits:
commit 3c99db4ca0405ab74f0e327ef9444c6cfdb7fc5b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Aug 13 02:01:52 2014 +0200

    fix problems around shaders
    
    Change-Id: I1577fb81cb3cf1fac3f5ba5d560d96cb83d4483d

diff --git a/slideshow/Module_slideshow.mk b/slideshow/Module_slideshow.mk
index 3959028..5d9978b 100644
--- a/slideshow/Module_slideshow.mk
+++ b/slideshow/Module_slideshow.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,slideshow))
 $(eval $(call gb_Module_add_targets,slideshow,\
     $(if $(filter TRUE,$(ENABLE_OPENGL)),Library_OGLTrans) \
     Library_slideshow \
+	Package_opengl \
 ))
 
 # not working
diff --git a/slideshow/Package_opengl.mk b/slideshow/Package_opengl.mk
index 866bfd0..a7e9a8c 100644
--- a/slideshow/Package_opengl.mk
+++ b/slideshow/Package_opengl.mk
@@ -10,9 +10,9 @@
 $(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 \
+		basicVertexShader.glsl \
+		dissolveFragmentShader.glsl \
+		staticFragmentShader.glsl \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 63d5753..222590c 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -1473,7 +1473,7 @@ private:
 
 GLuint StaticNoiseTransition::makeShader_()
 {
-    return OpenGLHelper::LoadShaders( "basicVertexShader.glsl", "staticFragmentShader.glsl" );
+    return OpenGLHelper::LoadShaders( "basicVertexShader", "staticFragmentShader" );
 }
 
 shared_ptr<OGLTransitionImpl>
@@ -1524,7 +1524,7 @@ private:
 
 GLuint DissolveTransition::makeShader_()
 {
-    return OpenGLHelper::LoadShaders( "basicVertexShader.glsl", "dissolveFragmentShader.glsl" );
+    return OpenGLHelper::LoadShaders( "basicVertexShader", "dissolveFragmentShader" );
 }
 
 shared_ptr<OGLTransitionImpl>
commit b4ed7cc37eb50380b3eccfba12edf08805dc25b5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Aug 12 05:56:45 2014 +0200

    make OGLTrans build on windows
    
    We still need to fix a number of issues around pixmap to make it really useful.
    
    Change-Id: I747d735d043d91d51809801edd9b778622b6063c

diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index 361ad13..673d72a 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -383,7 +383,9 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta
 
     GLWindow& rGLWindow(mpContext->getOpenGLWindow());
 
+#ifdef UNX
     mbTextureFromPixmap = rGLWindow.HasGLXExtension( "GLX_EXT_texture_from_pixmap" );
+#endif
     mbGenerateMipmap = rGLWindow.HasGLExtension( "GL_SGIS_generate_mipmap" );
 
     glEnable(GL_CULL_FACE);
commit 140b031935da665c3cd75d89d2dc685d82f04b1c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 11 21:44:10 2014 +0200

    we always have GLX 1.3, even on the baseline
    
    Change-Id: I381aca6e09a63d21bcbdf2625c4d829f84819bf8

diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index f90ddc8..361ad13 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -284,10 +284,6 @@ public:
      */
     float mnGLVersion;
 
-#ifdef UNX
-    float mnGLXVersion;
-#endif
-
     /**
        Whether the display has GLX extension on X11, always true otherwise (?)
      */
@@ -448,7 +444,7 @@ void OGLTransitionerImpl::impl_prepareSlides()
 
 #if defined( GLX_EXT_texture_from_pixmap )
 
-    if( mnGLXVersion >= 1.2999 && mbTextureFromPixmap && xLeavingSet.is() && xEnteringSet.is() && mbHasTFPVisual ) {
+    if( mbTextureFromPixmap && xLeavingSet.is() && xEnteringSet.is() && mbHasTFPVisual ) {
         Sequence< Any > leaveArgs;
         Sequence< Any > enterArgs;
         if( (xLeavingSet->getFastPropertyValue( 1 ) >>= leaveArgs) &&
@@ -1358,9 +1354,6 @@ OGLTransitionerImpl::OGLTransitionerImpl()
     , maSlideSize()
     , mbBrokenTexturesATI(false)
     , mnGLVersion(0)
-#ifdef UNX
-    , mnGLXVersion(0.0)
-#endif
     , mbGLXPresent(false)
     , mbMesa(false)
     , mbTextureFromPixmap(false)
commit 69e95b394616d0384e70dc6dad335eefce6a2dc2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 11 21:25:06 2014 +0200

    remove useless OGL transition shader code
    
    Change-Id: I8930aab2b4d3fd00916f12b86fa06b5e011542ac

diff --git a/slideshow/Library_OGLTrans.mk b/slideshow/Library_OGLTrans.mk
index a539847..80879ef 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 0000000..866bfd0
--- /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 0000000..4ca615a
--- /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 0000000..1ceb13f
--- /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 0000000..c3cb669
--- /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 191bca8..0000000
--- 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 bb2aa9d..0000000
--- 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 56a080b..63d5753 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>
commit 282c16a3713e23b3a594e7d3fbaa5b36491b86f6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 11 21:04:20 2014 +0200

    fix OpenGL canvas windows build
    
    Change-Id: Ic6ed9c69003fa79a60310dc0b010ffc0ca868791

diff --git a/canvas/Library_oglcanvas.mk b/canvas/Library_oglcanvas.mk
index a5efb6b..b5d3377 100644
--- a/canvas/Library_oglcanvas.mk
+++ b/canvas/Library_oglcanvas.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_add_exception_objects,oglcanvas,\
 $(eval $(call gb_Library_use_externals,oglcanvas,\
 	boost_headers \
 	glew \
+	mesa_headers \
 ))
 
 ifeq ($(strip $(OS)),MACOSX)
diff --git a/canvas/source/opengl/ogl_canvasbitmap.cxx b/canvas/source/opengl/ogl_canvasbitmap.cxx
index d78baf5..b7c5d9b 100644
--- a/canvas/source/opengl/ogl_canvasbitmap.cxx
+++ b/canvas/source/opengl/ogl_canvasbitmap.cxx
@@ -38,7 +38,7 @@ namespace oglcanvas
         maCanvasHelper = rSrc.maCanvasHelper;
     }
 
-    void SAL_CALL CanvasBitmap::disposeThis()
+    void CanvasBitmap::disposeThis()
     {
         mpDevice.clear();
 
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
index 2f2853e..f088180 100644
--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
@@ -50,7 +50,7 @@ namespace oglcanvas
                              rDeviceHelper );
     }
 
-    void SAL_CALL CanvasCustomSprite::disposeThis()
+    void CanvasCustomSprite::disposeThis()
     {
         ::osl::MutexGuard aGuard( m_aMutex );
 
diff --git a/canvas/source/opengl/ogl_spritecanvas.cxx b/canvas/source/opengl/ogl_spritecanvas.cxx
index 3073e2b..c965b9f 100644
--- a/canvas/source/opengl/ogl_spritecanvas.cxx
+++ b/canvas/source/opengl/ogl_spritecanvas.cxx
@@ -80,7 +80,7 @@ namespace oglcanvas
         maArguments.realloc(0);
     }
 
-    void SAL_CALL SpriteCanvas::disposeThis()
+    void SpriteCanvas::disposeThis()
     {
         ::osl::MutexGuard aGuard( m_aMutex );
 
diff --git a/canvas/source/opengl/ogl_spritedevicehelper.cxx b/canvas/source/opengl/ogl_spritedevicehelper.cxx
index 76da6e1..72df0e9 100644
--- a/canvas/source/opengl/ogl_spritedevicehelper.cxx
+++ b/canvas/source/opengl/ogl_spritedevicehelper.cxx
@@ -90,6 +90,9 @@ namespace oglcanvas
         mnRectangularMultiColorGradientProgram(0)
     {}
 
+    SpriteDeviceHelper::~SpriteDeviceHelper()
+    {}
+
     void SpriteDeviceHelper::init( Window&               rWindow,
                                    SpriteCanvas&         rSpriteCanvas,
                                    const awt::Rectangle& rViewArea )
diff --git a/canvas/source/opengl/ogl_spritedevicehelper.hxx b/canvas/source/opengl/ogl_spritedevicehelper.hxx
index f43a3af..bb4a976 100644
--- a/canvas/source/opengl/ogl_spritedevicehelper.hxx
+++ b/canvas/source/opengl/ogl_spritedevicehelper.hxx
@@ -41,6 +41,7 @@ namespace oglcanvas
     {
     public:
         SpriteDeviceHelper();
+        ~SpriteDeviceHelper();
 
         void init( Window&                                 rWindow,
                    SpriteCanvas&                           rSpriteCanvas,


More information about the Libreoffice-commits mailing list