diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-01-10 14:55:33 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-01-10 14:59:40 +0200 |
commit | 6312695ad694598951f2cdd4ac26c53457fedb79 (patch) | |
tree | 8a441057feb4b5291fb9baca410035c44b3df147 | |
parent | - fdo#46460 - Missing Circles and Ovals toolbar (diff) | |
download | core-6312695ad694598951f2cdd4ac26c53457fedb79.tar.gz core-6312695ad694598951f2cdd4ac26c53457fedb79.zip |
The "unx" and "win" OGLTrans_Shaders.cxx files were effectively identical
Just some OSL_TRACE/SAL_INFO changes in the "unx" one. And it isn't
like the "win" one would actually compile for Windows as is anyway, as
it unconditionally uses glX stuff. So certainly it is better to have
just one copy, and if we want to make the OpenGL transitions build on
Windows then add ifdefs for Windows to it.
Change-Id: If6887e24a0fc03c7e0e77f003d08feb51c264f30
-rw-r--r-- | slideshow/Library_OGLTrans.mk | 2 | ||||
-rw-r--r-- | slideshow/source/engine/OGLTrans/win/OGLTrans_Shaders.cxx | 142 |
2 files changed, 1 insertions, 143 deletions
diff --git a/slideshow/Library_OGLTrans.mk b/slideshow/Library_OGLTrans.mk index bae4d99946f8..44db60bdf289 100644 --- a/slideshow/Library_OGLTrans.mk +++ b/slideshow/Library_OGLTrans.mk @@ -86,7 +86,7 @@ $(eval $(call gb_Library_use_system_win32_libs,OGLTrans,\ )) $(eval $(call gb_Library_add_exception_objects,OGLTrans,\ - slideshow/source/engine/OGLTrans/win/OGLTrans_Shaders \ + slideshow/source/engine/OGLTrans/unx/OGLTrans_Shaders \ slideshow/source/engine/OGLTrans/win/OGLTrans_TransitionerImpl \ slideshow/source/engine/OGLTrans/win/OGLTrans_TransitionImpl \ )) diff --git a/slideshow/source/engine/OGLTrans/win/OGLTrans_Shaders.cxx b/slideshow/source/engine/OGLTrans/win/OGLTrans_Shaders.cxx deleted file mode 100644 index c1beae1230b0..000000000000 --- a/slideshow/source/engine/OGLTrans/win/OGLTrans_Shaders.cxx +++ /dev/null @@ -1,142 +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. - * - ************************************************************************/ - -#include <osl/diagnose.hxx> - -#include "OGLTrans_Shaders.hxx" - -namespace unx -{ -#include <GL/glx.h> -#include <GL/glxext.h> -} - -bool OGLShaders::cbInitialized = false; - -#ifdef GL_VERSION_2_0 - -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 ) { - glCreateShader = (PFNGLCREATESHADERPROC) unx::glXGetProcAddress( (unsigned char *) "glCreateShader" ); - glShaderSource = (PFNGLSHADERSOURCEPROC) unx::glXGetProcAddress( (unsigned char *) "glShaderSource" ); - glCompileShader = (PFNGLCOMPILESHADERPROC) unx::glXGetProcAddress( (unsigned char *) "glCompileShader" ); - glGetShaderiv = (PFNGLGETSHADERIVPROC) unx::glXGetProcAddress( (unsigned char *) "glGetShaderiv" ); - glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) unx::glXGetProcAddress( (unsigned char *) "glGetShaderInfoLog" ); - glDeleteShader = (PFNGLDELETESHADERPROC) unx::glXGetProcAddress( (unsigned char *) "glDeleteShader" ); - glCreateProgram = (PFNGLCREATEPROGRAMPROC) unx::glXGetProcAddress( (unsigned char *) "glCreateProgram" ); - glAttachShader = (PFNGLATTACHSHADERPROC) unx::glXGetProcAddress( (unsigned char *) "glAttachShader" ); - glLinkProgram = (PFNGLLINKPROGRAMPROC) unx::glXGetProcAddress( (unsigned char *) "glLinkProgram" ); - glGetProgramiv = (PFNGLGETPROGRAMIVPROC) unx::glXGetProcAddress( (unsigned char *) "glGetProgramiv" ); - glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) unx::glXGetProcAddress( (unsigned char *) "glGetProgramInfoLog" ); - glUseProgram = (PFNGLUSEPROGRAMPROC) unx::glXGetProcAddress( (unsigned char *) "glUseProgram" ); - glDeleteProgram = (PFNGLDELETEPROGRAMPROC) unx::glXGetProcAddress( (unsigned char *) "glDeleteProgram" ); - glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) unx::glXGetProcAddress( (unsigned char *) "glGetUniformLocation" ); - glUniform1i = (PFNGLUNIFORM1IPROC) unx::glXGetProcAddress( (unsigned char *) "glUniform1i" ); - glUniform1f = (PFNGLUNIFORM1FPROC) unx::glXGetProcAddress( (unsigned char *) "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 ); - OSL_TRACE("checkpoint 1: shaders created (%d) vertex: %d fragment: %d", glGetError() == GL_NO_ERROR, vertexObject, fragmentObject ); - - - glShaderSource( vertexObject, 1, &vertexShader, NULL ); - glShaderSource( fragmentObject, 1, &fragmentShader, NULL ); - - glCompileShader( vertexObject ); - glGetShaderInfoLog( vertexObject, sizeof( log ), NULL, log ); - OSL_TRACE("vertex compile log: %s", log); - glGetShaderiv( vertexObject, GL_COMPILE_STATUS, &vertexCompiled ); - glCompileShader( fragmentObject ); - glGetShaderInfoLog( fragmentObject, sizeof( log ), NULL, log ); - OSL_TRACE("fragment compile log: %s", log); - glGetShaderiv( fragmentObject, GL_COMPILE_STATUS, &fragmentCompiled ); - - if( !vertexCompiled || !fragmentCompiled ) - return 0; - - OSL_TRACE("checkpoint 2: shaders compiled (%d)", glGetError() == GL_NO_ERROR); - - programObject = glCreateProgram(); - glAttachShader( programObject, vertexObject ); - glAttachShader( programObject, fragmentObject ); - - glLinkProgram( programObject ); - glGetProgramInfoLog( programObject, sizeof( log ), NULL, log ); - OSL_TRACE("program link log: %s", log); - glGetProgramiv( programObject, GL_LINK_STATUS, &programLinked ); - - if( !programLinked ) - return 0; - - OSL_TRACE("checkpoint 3: program linked (%d)", glGetError() == GL_NO_ERROR); - - return programObject; -#else - return 0; -#endif -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |