Repository.mk | 1 chart2/Library_chartopengl.mk | 22 chart2/Module_chart2.mk | 1 chart2/Package_opengl.mk | 25 chart2/opengl/backgroundFragmentShader.glsl | 17 chart2/opengl/backgroundVertexShader.glsl | 21 chart2/opengl/commonFragmentShader.glsl | 17 chart2/opengl/commonVertexShader.glsl | 21 chart2/opengl/debugFragmentShader.glsl | 17 chart2/opengl/debugVertexShader.glsl | 19 chart2/opengl/symbolFragmentShader.glsl | 101 chart2/opengl/symbolVertexShader.glsl | 23 chart2/opengl/textFragmentShader.glsl | 17 chart2/opengl/textVertexShader.glsl | 20 chart2/source/view/inc/DummyXShape.hxx | 39 chart2/source/view/main/DummyXShape.cxx | 407 --- chart2/source/view/main/OpenGLRender.cxx | 1688 ---------------- chart2/source/view/main/OpenGLRender.hxx | 298 -- include/sal/log-areas.dox | 1 include/vcl/OpenGLContext.hxx | 31 include/vcl/OpenGLRender.hxx | 303 ++ vcl/Library_vclopengl.mk | 59 vcl/Module_vcl.mk | 4 vcl/Package_opengl.mk | 25 vcl/source/opengl/OpenGLContext.cxx | 417 +++ vcl/source/opengl/OpenGLRender.cxx | 1687 +++++++++++++++ vcl/source/opengl/shaders/backgroundFragmentShader.glsl | 17 vcl/source/opengl/shaders/backgroundVertexShader.glsl | 21 vcl/source/opengl/shaders/commonFragmentShader.glsl | 17 vcl/source/opengl/shaders/commonVertexShader.glsl | 21 vcl/source/opengl/shaders/debugFragmentShader.glsl | 17 vcl/source/opengl/shaders/debugVertexShader.glsl | 19 vcl/source/opengl/shaders/symbolFragmentShader.glsl | 101 vcl/source/opengl/shaders/symbolVertexShader.glsl | 23 vcl/source/opengl/shaders/textFragmentShader.glsl | 17 vcl/source/opengl/shaders/textVertexShader.glsl | 20 36 files changed, 2809 insertions(+), 2745 deletions(-)
New commits: commit 62c2fa48de6e2a77f42568b6378c4cc9aa4605a7 Author: Zolnai Tamás <[email protected]> Date: Fri Mar 14 18:52:30 2014 +0100 Remove unused include Change-Id: I029b43b29a7fba500cfe2c74e3e66274612f3524 diff --git a/vcl/Library_vclopengl.mk b/vcl/Library_vclopengl.mk index f65f895..270cbd6 100644 --- a/vcl/Library_vclopengl.mk +++ b/vcl/Library_vclopengl.mk @@ -27,7 +27,6 @@ $(eval $(call gb_Library_use_libraries,vclopengl,\ comphelper \ cppu \ cppuhelper \ - editeng \ sal \ vcl \ $(gb_UWINAPI) \ diff --git a/vcl/source/opengl/OpenGLRender.cxx b/vcl/source/opengl/OpenGLRender.cxx index a4fb1b9..5a88e7a 100755 --- a/vcl/source/opengl/OpenGLRender.cxx +++ b/vcl/source/opengl/OpenGLRender.cxx @@ -32,7 +32,6 @@ #include <com/sun/star/drawing/TextureProjectionMode.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/uno/Any.hxx> -#include <editeng/unoprnms.hxx> #include <vcl/virdev.hxx> #include <vcl/dibtools.hxx> commit a5d178b424d55f61bb3502bb9cbc7ea96aee2cd7 Author: Zolnai Tamás <[email protected]> Date: Fri Mar 14 18:51:06 2014 +0100 Introduce OpenGLContext in vclopengl Move DummyChart::initOpengl() and DummyChart::initWindow into this class. Change-Id: If3c1bb52cb2819019f0dda626612a164709b17ac diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk index db3dc29..15260d4 100644 --- a/chart2/Library_chartopengl.mk +++ b/chart2/Library_chartopengl.mk @@ -18,7 +18,6 @@ $(eval $(call gb_Library_set_include,chartopengl,\ )) $(eval $(call gb_Library_use_externals,chartopengl,\ - boost_headers \ mdds_headers \ glm_headers \ mesa_headers \ @@ -56,23 +55,4 @@ $(eval $(call gb_Library_add_exception_objects,chartopengl,\ chart2/source/view/main/DummyXShape \ )) -ifeq ($(strip $(OS)),WNT) -$(eval $(call gb_Library_use_system_win32_libs,chartopengl,\ - opengl32 \ - gdi32 \ - glu32 \ -)) -else ifeq ($(OS),MACOSX) -$(eval $(call gb_Library_use_system_darwin_frameworks,chartopengl,\ - OpenGL \ -)) -else ifeq ($(OS),LINUX) -$(eval $(call gb_Library_add_libs,chartopengl,\ - -ldl \ - -lGL \ - -lGLU \ - -lX11 \ -)) -endif - # vim: set noet sw=4 ts=4: diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx index 553b4e1..2862b23 100644 --- a/chart2/source/view/inc/DummyXShape.hxx +++ b/chart2/source/view/inc/DummyXShape.hxx @@ -13,6 +13,7 @@ #include <cppuhelper/implbase6.hxx> #include <vcl/OpenGLRender.hxx> +#include <vcl/OpenGLContext.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShapes.hpp> @@ -59,34 +60,8 @@ #include <vector> #include <map> -#include <boost/scoped_ptr.hpp> #include <boost/unordered_map.hpp> -#if defined( MACOSX ) -#include <OpenGL/gl.h> -#include <OpenGL/glu.h> -#else -#include <GL/gl.h> -#include <GL/glu.h> -#endif - -#include <vcl/window.hxx> -#include <vcl/syschild.hxx> -#include <vcl/sysdata.hxx> - -#if defined( _WIN32 ) - #include <GL/glu.h> - #include <GL/glext.h> - #include <GL/wglext.h> -#elif defined( MACOSX ) -#elif defined( UNX ) - #include <GL/glu.h> - #include <GL/glext.h> -#endif - -class SystemWindow; -class SystemChildWindow; - using namespace com::sun::star; @@ -431,15 +406,9 @@ public: private: - GLWindow GLWin; /// Holds the information of our new child window - - void createGLContext(); - - bool initWindow(); - bool initOpengl(); - boost::scoped_ptr<Window> mpWindow; - boost::scoped_ptr<SystemChildWindow> pWindow; TextCache maTextCache; + OpenGLContext m_aGLContext; + public: OpenGLRender m_GLRender; }; diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 35716c3..0416ea9 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -1145,412 +1145,12 @@ void DummyXShapes::render() } } -#if defined( WNT ) - -bool DummyChart::initWindow() -{ - const SystemEnvData* sysData(mpWindow->GetSystemData()); - GLWin.hWnd = sysData->hWnd; - SystemWindowData winData; - winData.nSize = sizeof(winData); - pWindow.reset(new SystemChildWindow(mpWindow.get(), 0, &winData, sal_False)); - - - if( pWindow ) - { - pWindow->SetMouseTransparent( sal_True ); - pWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - pWindow->EnableEraseBackground( sal_False ); - pWindow->SetControlForeground(); - pWindow->SetControlBackground(); - pWindow->EnablePaint(sal_False); - GLWin.hWnd = sysData->hWnd; - } - - return true; -} - -#elif defined( MACOSX ) - -bool DummyChart::initWindow() -{ - return false; -} - -#elif defined( UNX ) - -namespace { - -// we need them before glew can initialize them -// glew needs an OpenGL context so we need to get the address manually -void initOpenGLFunctionPointers() -{ - glXChooseFBConfig = (GLXFBConfig*(*)(Display *dpy, int screen, const int *attrib_list, int *nelements))glXGetProcAddressARB((GLubyte*)"glXChooseFBConfig"); - glXGetVisualFromFBConfig = (XVisualInfo*(*)(Display *dpy, GLXFBConfig config))glXGetProcAddressARB((GLubyte*)"glXGetVisualFromFBConfig"); // try to find a visual for the current set of attributes - glXGetFBConfigAttrib = (int(*)(Display *dpy, GLXFBConfig config, int attribute, int* value))glXGetProcAddressARB((GLubyte*)"glXGetFBConfigAttrib"); - -} - -} - -bool DummyChart::initWindow() -{ - const SystemEnvData* sysData(mpWindow->GetSystemData()); - - GLWin.dpy = reinterpret_cast<Display*>(sysData->pDisplay); - - if( !glXQueryExtension( GLWin.dpy, NULL, NULL ) ) - return false; - - GLWin.win = sysData->aWindow; - - OSL_TRACE("parent window: %d", GLWin.win); - - XWindowAttributes xattr; - XGetWindowAttributes( GLWin.dpy, GLWin.win, &xattr ); - - GLWin.screen = XScreenNumberOfScreen( xattr.screen ); - - static int visual_attribs[] = - { - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, - GLX_ALPHA_SIZE, 8, - GLX_DEPTH_SIZE, 24, - GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, - None - }; - - const SystemEnvData* pChildSysData = NULL; - pWindow.reset(); - - initOpenGLFunctionPointers(); - - int fbCount = 0; - GLXFBConfig* pFBC = glXChooseFBConfig( GLWin.dpy, - GLWin.screen, - visual_attribs, &fbCount ); - - if(!pFBC) - { - SAL_WARN("chart2.opengl", "no suitable fb format found"); - return false; - } - - int best_fbc = -1, best_num_samp = -1; - for(int i = 0; i < fbCount; ++i) - { - XVisualInfo* pVi = glXGetVisualFromFBConfig( GLWin.dpy, pFBC[i] ); - if(pVi) - { - // pick the one with the most samples per pixel - int nSampleBuf = 0; - int nSamples = 0; - glXGetFBConfigAttrib( GLWin.dpy, pFBC[i], GLX_SAMPLE_BUFFERS, &nSampleBuf ); - glXGetFBConfigAttrib( GLWin.dpy, pFBC[i], GLX_SAMPLES , &nSamples ); - - if ( best_fbc < 0 || (nSampleBuf && ( nSamples > best_num_samp )) ) - { - best_fbc = i; - best_num_samp = nSamples; - } - } - XFree( pVi ); - } - - XVisualInfo* vi = glXGetVisualFromFBConfig( GLWin.dpy, pFBC[best_fbc] ); - if( vi ) - { - SystemWindowData winData; - winData.nSize = sizeof(winData); - OSL_TRACE("using VisualID %08X", vi->visualid); - winData.pVisual = (void*)(vi->visual); - pWindow.reset(new SystemChildWindow(mpWindow.get(), 0, &winData, false)); - pChildSysData = pWindow->GetSystemData(); - } - - if (!pWindow || !pChildSysData) - return false; - - pWindow->SetMouseTransparent( true ); - pWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP ); - pWindow->EnableEraseBackground( false ); - pWindow->SetControlForeground(); - pWindow->SetControlBackground(); - - GLWin.dpy = reinterpret_cast<Display*>(pChildSysData->pDisplay); - GLWin.win = pChildSysData->aWindow; - GLWin.vi = vi; - GLWin.GLXExtensions = glXQueryExtensionsString( GLWin.dpy, GLWin.screen ); - OSL_TRACE("available GLX extensions: %s", GLWin.GLXExtensions); - - return true; -} - -namespace { - -static bool errorTriggered; -int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ ) -{ - errorTriggered = true; - - return 0; -} - -} - -#endif - -#ifdef DBG_UTIL - -namespace { - -const char* getSeverityString(GLenum severity) -{ - switch(severity) - { - case GL_DEBUG_SEVERITY_LOW: - return "low"; - case GL_DEBUG_SEVERITY_MEDIUM: - return "medium"; - case GL_DEBUG_SEVERITY_HIGH: - return "high"; - default: - ; - } - - return "unknown"; -} - -const char* getSourceString(GLenum source) -{ - switch(source) - { - case GL_DEBUG_SOURCE_API: - return "API"; - case GL_DEBUG_SOURCE_SHADER_COMPILER: - return "shader compiler"; - case GL_DEBUG_SOURCE_WINDOW_SYSTEM: - return "window system"; - case GL_DEBUG_SOURCE_THIRD_PARTY: - return "third party"; - case GL_DEBUG_SOURCE_APPLICATION: - return "Libreoffice"; - case GL_DEBUG_SOURCE_OTHER: - return "unknown"; - default: - ; - } - - return "unknown"; -} - -const char* getTypeString(GLenum type) -{ - switch(type) - { - case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: - return "deprecated behavior"; - case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: - return "undefined behavior"; - case GL_DEBUG_TYPE_PERFORMANCE: - return "performance"; - case GL_DEBUG_TYPE_PORTABILITY: - return "portability"; - case GL_DEBUG_TYPE_MARKER: - return "marker"; - case GL_DEBUG_TYPE_PUSH_GROUP: - return "push group"; - case GL_DEBUG_TYPE_POP_GROUP: - return "pop group"; - case GL_DEBUG_TYPE_OTHER: - return "other"; - default: - ; - } - - return "unkown"; -} - -extern "C" void -#if defined _WIN32 -APIENTRY -#endif -debug_callback(GLenum source, GLenum type, GLuint id, - GLenum severity, GLsizei , const GLchar* message, GLvoid* ) -{ - SAL_WARN("chart2.opengl", "OpenGL debug message: source: " << getSourceString(source) << ", type: " - << getTypeString(type) << ", id: " << id << ", severity: " << getSeverityString(severity) << " with message: " << message); -} - -} - -#endif - -bool DummyChart::initOpengl() -{ - SAL_INFO("chart2.opengl", "DummyChart::initOpengl----start"); - initWindow(); - mpWindow->setPosSizePixel(0,0,0,0); - GLWin.Width = 0; - GLWin.Height = 0; - -#if defined( WNT ) - GLWin.hDC = GetDC(GLWin.hWnd); -#elif defined( MACOSX ) - -#elif defined( UNX ) - GLWin.ctx = glXCreateContext(GLWin.dpy, - GLWin.vi, - 0, - GL_TRUE); - if( GLWin.ctx == NULL ) - { - OSL_TRACE("unable to create GLX context"); - return false; - } -#endif - -#if defined( WNT ) - PIXELFORMATDESCRIPTOR PixelFormatFront = // PixelFormat Tells Windows How We Want Things To Be - { - sizeof(PIXELFORMATDESCRIPTOR), - 1, // Version Number - PFD_DRAW_TO_WINDOW | - PFD_SUPPORT_OPENGL | - PFD_DOUBLEBUFFER, - PFD_TYPE_RGBA, // Request An RGBA Format - (BYTE)32, // Select Our Color Depth - 0, 0, 0, 0, 0, 0, // Color Bits Ignored - 0, // No Alpha Buffer - 0, // Shift Bit Ignored - 0, // No Accumulation Buffer - 0, 0, 0, 0, // Accumulation Bits Ignored - 64, // 32 bit Z-BUFFER - 0, // 0 bit stencil buffer - 0, // No Auxiliary Buffer - 0, // now ignored - 0, // Reserved - 0, 0, 0 // Layer Masks Ignored - }; - - // we must check whether can set the MSAA - int WindowPix; - m_GLRender.InitMultisample(PixelFormatFront); - if (m_GLRender.GetMSAASupport()) - { - WindowPix = m_GLRender.GetMSAAFormat(); - } - else - { - WindowPix = ChoosePixelFormat(GLWin.hDC,&PixelFormatFront); - } - SetPixelFormat(GLWin.hDC,WindowPix,&PixelFormatFront); - GLWin.hRC = wglCreateContext(GLWin.hDC); - wglMakeCurrent(GLWin.hDC,GLWin.hRC); - -#elif defined( MACOSX ) - -#elif defined( UNX ) - if( !glXMakeCurrent( GLWin.dpy, GLWin.win, GLWin.ctx ) ) - { - OSL_TRACE("unable to select current GLX context"); - return false; - } - - int glxMinor, glxMajor; - double nGLXVersion = 0; - if( glXQueryVersion( GLWin.dpy, &glxMajor, &glxMinor ) ) - nGLXVersion = glxMajor + 0.1*glxMinor; - OSL_TRACE("available GLX version: %f", nGLXVersion); - - GLWin.GLExtensions = glGetString( GL_EXTENSIONS ); - OSL_TRACE("available GL extensions: %s", GLWin.GLExtensions); - - if( GLWin.HasGLXExtension("GLX_SGI_swap_control" ) ) - { - // enable vsync - typedef GLint (*glXSwapIntervalProc)(GLint); - glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" ); - if( glXSwapInterval ) { - int (*oldHandler)(Display* /*dpy*/, XErrorEvent* /*evnt*/); - - // replace error handler temporarily - oldHandler = XSetErrorHandler( oglErrorHandler ); - - errorTriggered = false; - - glXSwapInterval( 1 ); - - // sync so that we possibly get an XError - glXWaitGL(); - XSync(GLWin.dpy, false); - - if( errorTriggered ) - OSL_TRACE("error when trying to set swap interval, NVIDIA or Mesa bug?"); - else - OSL_TRACE("set swap interval to 1 (enable vsync)"); - - // restore the error handler - XSetErrorHandler( oldHandler ); - } - } - -#endif - - m_GLRender.InitOpenGL(GLWin); - -#ifdef DBG_UTIL - // only enable debug output in dbgutil build - if( GLEW_ARB_debug_output ) - { - glEnable(GL_DEBUG_OUTPUT); - glDebugMessageCallback(&debug_callback, NULL); - } - -#endif - - glEnable(GL_TEXTURE_2D); - glEnable(GL_CULL_FACE); - glCullFace(GL_BACK); - // Enable depth test - glEnable(GL_DEPTH_TEST); - // Accept fragment if it closer to the camera than the former one - glDepthFunc(GL_LESS); - -#if defined( WNT ) - SwapBuffers(GLWin.hDC); - glFlush(); -#elif defined( MACOSX ) - -#elif defined( UNX ) - glXSwapBuffers(GLWin.dpy, GLWin.win); -#endif - glEnable(GL_LIGHTING); - GLfloat light_direction[] = { 0.0 , 0.0 , 1.0 }; - GLfloat materialDiffuse[] = { 1.0 , 1.0 , 1.0 , 1.0}; - glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light_direction); - glMaterialfv(GL_FRONT,GL_DIFFUSE,materialDiffuse); - glEnable(GL_LIGHT0); - glEnable(GL_NORMALIZE); - SAL_INFO("chart2.opengl", "DummyChart::initOpengl----end"); - return true; -} - - DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget): - mpWindow(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL)), m_GLRender(xTarget) { SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: "); setName("com.sun.star.chart2.shapes"); - createGLContext(); -} - -void DummyChart::createGLContext() -{ - initOpengl(); + m_aGLContext.init(m_GLRender); } void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition ) @@ -1569,8 +1169,7 @@ void SAL_CALL DummyChart::setSize( const awt::Size& aSize ) SAL_INFO("chart2.opengl", "DummyChart::setSize()---aSize.Width = " << aSize.Width << ", aSize.Height = " << aSize.Height); int width = aSize.Width / OPENGL_SCALE_VALUE; int height = aSize.Height / OPENGL_SCALE_VALUE; - mpWindow->SetSizePixel(Size(width, height)); - pWindow->SetSizePixel(Size(width, height)); + m_aGLContext.setWinSize(Size(width, height)); DummyXShape::setSize(awt::Size(0,0)); m_GLRender.SetSize(width, height); SAL_INFO("chart2.opengl", "DummyChart::GLRender.Width = " << width << ", GLRender.Height = " << height); @@ -1586,7 +1185,7 @@ void DummyChart::render() DummyXShapes::render(); #endif m_GLRender.renderToBitmap(); -} + } void DummyChart::clear() { diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx new file mode 100644 index 0000000..cc7a3e7 --- /dev/null +++ b/include/vcl/OpenGLContext.hxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#ifndef VCL_OPENGL_CONTEXT_HXX +#define VCL_OPENGL_CONTEXT_HXX + +#include <vcl/OpenGLRender.hxx> + +class VCL_DLLPUBLIC OpenGLContext +{ +public: + bool init(OpenGLRender& rGLRender); + void setWinSize(const Size& rSize); + +private: + SAL_DLLPRIVATE bool initWindow(); + + GLWindow m_aGLWin; + boost::scoped_ptr<Window> m_pWindow; + boost::scoped_ptr<SystemChildWindow> m_pChildWindow; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vclopengl.mk b/vcl/Library_vclopengl.mk index 5c52add..f65f895 100644 --- a/vcl/Library_vclopengl.mk +++ b/vcl/Library_vclopengl.mk @@ -35,13 +35,14 @@ $(eval $(call gb_Library_use_libraries,vclopengl,\ $(eval $(call gb_Library_add_exception_objects,vclopengl,\ vcl/source/opengl/OpenGLRender \ + vcl/source/opengl/OpenGLContext \ )) ifeq ($(strip $(OS)),WNT) $(eval $(call gb_Library_use_system_win32_libs,vclopengl,\ opengl32 \ - gdi32 \ - glu32 \ + gdi32 \ + glu32 \ )) else ifeq ($(OS),MACOSX) $(eval $(call gb_Library_use_system_darwin_frameworks,vclopengl,\ diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx new file mode 100644 index 0000000..70ec988 --- /dev/null +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -0,0 +1,417 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#include <vcl/OpenGLContext.hxx> + + +using namespace com::sun::star; + +namespace { + +#ifdef DBG_UTIL + +namespace { + +const char* getSeverityString(GLenum severity) +{ + switch(severity) + { + case GL_DEBUG_SEVERITY_LOW: + return "low"; + case GL_DEBUG_SEVERITY_MEDIUM: + return "medium"; + case GL_DEBUG_SEVERITY_HIGH: + return "high"; + default: + ; + } + + return "unknown"; +} + +const char* getSourceString(GLenum source) +{ + switch(source) + { + case GL_DEBUG_SOURCE_API: + return "API"; + case GL_DEBUG_SOURCE_SHADER_COMPILER: + return "shader compiler"; + case GL_DEBUG_SOURCE_WINDOW_SYSTEM: + return "window system"; + case GL_DEBUG_SOURCE_THIRD_PARTY: + return "third party"; + case GL_DEBUG_SOURCE_APPLICATION: + return "Libreoffice"; + case GL_DEBUG_SOURCE_OTHER: + return "unknown"; + default: + ; + } + + return "unknown"; +} + +const char* getTypeString(GLenum type) +{ + switch(type) + { + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + return "deprecated behavior"; + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: + return "undefined behavior"; + case GL_DEBUG_TYPE_PERFORMANCE: + return "performance"; + case GL_DEBUG_TYPE_PORTABILITY: + return "portability"; + case GL_DEBUG_TYPE_MARKER: + return "marker"; + case GL_DEBUG_TYPE_PUSH_GROUP: + return "push group"; + case GL_DEBUG_TYPE_POP_GROUP: + return "pop group"; + case GL_DEBUG_TYPE_OTHER: + return "other"; + default: + ; + } + + return "unkown"; +} + +extern "C" void +#if defined _WIN32 +APIENTRY +#endif +debug_callback(GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei , const GLchar* message, GLvoid* ) +{ + SAL_WARN("vcl.opengl", "OpenGL debug message: source: " << getSourceString(source) << ", type: " + << getTypeString(type) << ", id: " << id << ", severity: " << getSeverityString(severity) << " with message: " << message); +} + +} + +#endif + +#if defined( UNX ) +static bool errorTriggered; +int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ ) +{ + errorTriggered = true; + + return 0; +} + +} +#endif + +bool OpenGLContext::init(OpenGLRender& rGLRender) +{ + m_pWindow.reset(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL)); + SAL_INFO("vcl.opengl", "OpenGLContext::OpenGLContext----start"); + initWindow(); + m_pWindow->setPosSizePixel(0,0,0,0); + m_aGLWin.Width = 0; + m_aGLWin.Height = 0; + +#if defined( WNT ) + m_aGLWin.hDC = GetDC(m_aGLWin.hWnd); +#elif defined( MACOSX ) + +#elif defined( UNX ) + m_aGLWin.ctx = glXCreateContext(m_aGLWin.dpy, + m_aGLWin.vi, + 0, + GL_TRUE); + if( m_aGLWin.ctx == NULL ) + { + OSL_TRACE("unable to create GLX context"); + return false; + } +#endif + +#if defined( WNT ) + PIXELFORMATDESCRIPTOR PixelFormatFront = // PixelFormat Tells Windows How We Want Things To Be + { + sizeof(PIXELFORMATDESCRIPTOR), + 1, // Version Number + PFD_DRAW_TO_WINDOW | + PFD_SUPPORT_OPENGL | + PFD_DOUBLEBUFFER, + PFD_TYPE_RGBA, // Request An RGBA Format + (BYTE)32, // Select Our Color Depth + 0, 0, 0, 0, 0, 0, // Color Bits Ignored + 0, // No Alpha Buffer + 0, // Shift Bit Ignored + 0, // No Accumulation Buffer + 0, 0, 0, 0, // Accumulation Bits Ignored + 64, // 32 bit Z-BUFFER + 0, // 0 bit stencil buffer + 0, // No Auxiliary Buffer + 0, // now ignored + 0, // Reserved + 0, 0, 0 // Layer Masks Ignored + }; + + // we must check whether can set the MSAA + int WindowPix; + rGLRender.InitMultisample(PixelFormatFront); + if (rGLRender.GetMSAASupport()) + { + WindowPix = rGLRender.GetMSAAFormat(); + } + else + { + WindowPix = ChoosePixelFormat(m_aGLWin.hDC,&PixelFormatFront); + } + SetPixelFormat(m_aGLWin.hDC,WindowPix,&PixelFormatFront); + m_aGLWin.hRC = wglCreateContext(m_aGLWin.hDC); + wglMakeCurrent(m_aGLWin.hDC,m_aGLWin.hRC); + +#elif defined( MACOSX ) + +#elif defined( UNX ) + if( !glXMakeCurrent( m_aGLWin.dpy, m_aGLWin.win, m_aGLWin.ctx ) ) + { + OSL_TRACE("unable to select current GLX context"); + return false; + } + + int glxMinor, glxMajor; + double nGLXVersion = 0; + if( glXQueryVersion( m_aGLWin.dpy, &glxMajor, &glxMinor ) ) + nGLXVersion = glxMajor + 0.1*glxMinor; + OSL_TRACE("available GLX version: %f", nGLXVersion); + + m_aGLWin.GLExtensions = glGetString( GL_EXTENSIONS ); + OSL_TRACE("available GL extensions: %s", m_aGLWin.GLExtensions); + + if( m_aGLWin.HasGLXExtension("GLX_SGI_swap_control" ) ) + { + // enable vsync + typedef GLint (*glXSwapIntervalProc)(GLint); + glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" ); + if( glXSwapInterval ) { + int (*oldHandler)(Display* /*dpy*/, XErrorEvent* /*evnt*/); + + // replace error handler temporarily + oldHandler = XSetErrorHandler( oglErrorHandler ); + + errorTriggered = false; + + glXSwapInterval( 1 ); + + // sync so that we possibly get an XError + glXWaitGL(); + XSync(m_aGLWin.dpy, false); + + if( errorTriggered ) + OSL_TRACE("error when trying to set swap interval, NVIDIA or Mesa bug?"); + else + OSL_TRACE("set swap interval to 1 (enable vsync)"); + + // restore the error handler + XSetErrorHandler( oldHandler ); + } + } + +#endif + + rGLRender.InitOpenGL(m_aGLWin); + +#ifdef DBG_UTIL + // only enable debug output in dbgutil build + if( GLEW_ARB_debug_output ) + { + glEnable(GL_DEBUG_OUTPUT); + glDebugMessageCallback(&debug_callback, NULL); + } + +#endif + + glEnable(GL_TEXTURE_2D); + glEnable(GL_CULL_FACE); + glCullFace(GL_BACK); + // Enable depth test + glEnable(GL_DEPTH_TEST); + // Accept fragment if it closer to the camera than the former one + glDepthFunc(GL_LESS); + +#if defined( WNT ) + SwapBuffers(m_aGLWin.hDC); + glFlush(); +#elif defined( MACOSX ) + +#elif defined( UNX ) + glXSwapBuffers(m_aGLWin.dpy, m_aGLWin.win); +#endif + glEnable(GL_LIGHTING); + GLfloat light_direction[] = { 0.0 , 0.0 , 1.0 }; + GLfloat materialDiffuse[] = { 1.0 , 1.0 , 1.0 , 1.0}; + glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light_direction); + glMaterialfv(GL_FRONT,GL_DIFFUSE,materialDiffuse); + glEnable(GL_LIGHT0); + glEnable(GL_NORMALIZE); + SAL_INFO("vcl.opengl", "OpenGLContext::init----end"); + return true; +} + +void OpenGLContext::setWinSize(const Size& rSize) +{ + m_pWindow->SetSizePixel(rSize); + m_pChildWindow->SetSizePixel(rSize); +} + +#if defined( WNT ) + +bool OpenGLContext::initWindow() +{ + const SystemEnvData* sysData(m_pWindow->GetSystemData()); + m_aGLWin.hWnd = sysData->hWnd; + SystemWindowData winData; + winData.nSize = sizeof(winData); + m_pChildWindow.reset(new SystemChildWindow(m_pWindow.get(), 0, &winData, sal_False)); + + + if( m_pChildWindow ) + { + m_pChildWindow->SetMouseTransparent( sal_True ); + m_pChildWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP ); + m_pChildWindow->EnableEraseBackground( sal_False ); + m_pChildWindow->SetControlForeground(); + m_pChildWindow->SetControlBackground(); + m_pChildWindow->EnablePaint(sal_False); + m_aGLWin.hWnd = sysData->hWnd; + } + + return true; +} + +#elif defined( MACOSX ) + +bool OpenGLContext::initWindow() +{ + return false; +} + +#elif defined( UNX ) + +namespace { + +// we need them before glew can initialize them +// glew needs an OpenGL context so we need to get the address manually +void initOpenGLFunctionPointers() +{ + glXChooseFBConfig = (GLXFBConfig*(*)(Display *dpy, int screen, const int *attrib_list, int *nelements))glXGetProcAddressARB((GLubyte*)"glXChooseFBConfig"); + glXGetVisualFromFBConfig = (XVisualInfo*(*)(Display *dpy, GLXFBConfig config))glXGetProcAddressARB((GLubyte*)"glXGetVisualFromFBConfig"); // try to find a visual for the current set of attributes + glXGetFBConfigAttrib = (int(*)(Display *dpy, GLXFBConfig config, int attribute, int* value))glXGetProcAddressARB((GLubyte*)"glXGetFBConfigAttrib"); + +} + +} + +bool OpenGLContext::initWindow() +{ + const SystemEnvData* sysData(m_pWindow->GetSystemData()); + + m_aGLWin.dpy = reinterpret_cast<Display*>(sysData->pDisplay); + + if( !glXQueryExtension( m_aGLWin.dpy, NULL, NULL ) ) + return false; + + m_aGLWin.win = sysData->aWindow; + + OSL_TRACE("parent window: %d", m_aGLWin.win); + + XWindowAttributes xattr; + XGetWindowAttributes( m_aGLWin.dpy, m_aGLWin.win, &xattr ); + + m_aGLWin.screen = XScreenNumberOfScreen( xattr.screen ); + + static int visual_attribs[] = + { + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_ALPHA_SIZE, 8, + GLX_DEPTH_SIZE, 24, + GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR, + None + }; + + const SystemEnvData* pChildSysData = NULL; + m_pChildWindow.reset(); + + initOpenGLFunctionPointers(); + + int fbCount = 0; + GLXFBConfig* pFBC = glXChooseFBConfig( m_aGLWin.dpy, + m_aGLWin.screen, + visual_attribs, &fbCount ); + + if(!pFBC) + { + SAL_WARN("vcl.opengl", "no suitable fb format found"); + return false; + } + + int best_fbc = -1, best_num_samp = -1; + for(int i = 0; i < fbCount; ++i) + { + XVisualInfo* pVi = glXGetVisualFromFBConfig( m_aGLWin.dpy, pFBC[i] ); + if(pVi) + { + // pick the one with the most samples per pixel + int nSampleBuf = 0; + int nSamples = 0; + glXGetFBConfigAttrib( m_aGLWin.dpy, pFBC[i], GLX_SAMPLE_BUFFERS, &nSampleBuf ); + glXGetFBConfigAttrib( m_aGLWin.dpy, pFBC[i], GLX_SAMPLES , &nSamples ); + + if ( best_fbc < 0 || (nSampleBuf && ( nSamples > best_num_samp )) ) + { + best_fbc = i; + best_num_samp = nSamples; + } + } + XFree( pVi ); + } + + XVisualInfo* vi = glXGetVisualFromFBConfig( m_aGLWin.dpy, pFBC[best_fbc] ); + if( vi ) + { + SystemWindowData winData; + winData.nSize = sizeof(winData); + OSL_TRACE("using VisualID %08X", vi->visualid); + winData.pVisual = (void*)(vi->visual); + m_pChildWindow.reset(new SystemChildWindow(m_pWindow.get(), 0, &winData, false)); + pChildSysData = m_pChildWindow->GetSystemData(); + } + + if (!m_pChildWindow || !pChildSysData) + return false; + + m_pChildWindow->SetMouseTransparent( true ); + m_pChildWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP ); + m_pChildWindow->EnableEraseBackground( false ); + m_pChildWindow->SetControlForeground(); + m_pChildWindow->SetControlBackground(); + + m_aGLWin.dpy = reinterpret_cast<Display*>(pChildSysData->pDisplay); + m_aGLWin.win = pChildSysData->aWindow; + m_aGLWin.vi = vi; + m_aGLWin.GLXExtensions = glXQueryExtensionsString( m_aGLWin.dpy, m_aGLWin.screen ); + OSL_TRACE("available GLX extensions: %s", m_aGLWin.GLXExtensions); + + return true; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 04b70c682e2cdc52b144961a83d05fd203de6884 Author: Zolnai Tamás <[email protected]> Date: Thu Mar 13 14:22:59 2014 +0100 Move OpenGLRender to vcl Change-Id: I6383ae3f94fc18aec92596b9d857d3fde5869dd6 diff --git a/Repository.mk b/Repository.mk index ab60094..eb7a55f 100644 --- a/Repository.mk +++ b/Repository.mk @@ -356,6 +356,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ $(if $(DISABLE_SCRIPTING),,vbahelper) \ vcl \ vclcanvas \ + $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)),vclopengl) \ $(if $(and $(filter unx,$(GUIBASE)),$(filter-out MACOSX,$(OS))), \ vclplug_gen \ $(if $(ENABLE_TDE),vclplug_tde) \ diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk index 0aa6340..db3dc29 100644 --- a/chart2/Library_chartopengl.mk +++ b/chart2/Library_chartopengl.mk @@ -47,13 +47,13 @@ $(eval $(call gb_Library_use_libraries,chartopengl,\ ucbhelper \ utl \ vcl \ + vclopengl \ $(gb_UWINAPI) \ )) $(eval $(call gb_Library_add_exception_objects,chartopengl,\ chart2/source/view/main/OpenglShapeFactory \ chart2/source/view/main/DummyXShape \ - chart2/source/view/main/OpenGLRender \ )) ifeq ($(strip $(OS)),WNT) diff --git a/chart2/Module_chart2.mk b/chart2/Module_chart2.mk index 611e699..6c4d193 100644 --- a/chart2/Module_chart2.mk +++ b/chart2/Module_chart2.mk @@ -14,7 +14,6 @@ $(eval $(call gb_Module_add_targets,chart2,\ Library_chartcore \ $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \ Library_chartopengl \ - Package_opengl \ ) \ )) diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx index cf19ff5..553b4e1 100644 --- a/chart2/source/view/inc/DummyXShape.hxx +++ b/chart2/source/view/inc/DummyXShape.hxx @@ -12,7 +12,7 @@ #include <cppuhelper/implbase6.hxx> -#include "OpenGLRender.hxx" +#include <vcl/OpenGLRender.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShapes.hpp> diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index 41ef580..018e4c6 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -362,6 +362,7 @@ certain functionality. @li @c vcl.kde - KDE @li @c vcl.kde4 - KDE4 @li @c vcl.layout - Widget layout +@li @c vcl.opengl - OpenGL rendering @li @c vcl.plugadapt - the Unix/X11 backend plugin mechanism @li @c vcl.osx @li @c vcl.osx.print diff --git a/chart2/source/view/main/OpenGLRender.hxx b/include/vcl/OpenGLRender.hxx similarity index 91% rename from chart2/source/view/main/OpenGLRender.hxx rename to include/vcl/OpenGLRender.hxx index 8e5314d..2f7903a 100755 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/include/vcl/OpenGLRender.hxx @@ -7,6 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef VCL_OPENGL_RENDER_HXX +#define VCL_OPENGL_RENDER_HXX + #if defined( MACOSX ) #elif defined( UNX ) # include <prex.h> @@ -90,7 +93,7 @@ typedef std::vector<GLfloat> PieSegment2DPointList; typedef std::vector<GLfloat> PointList; /// Holds the information of our new child window -struct GLWindow +struct VCL_DLLPUBLIC GLWindow { #if defined( _WIN32 ) HWND hWnd; @@ -140,7 +143,7 @@ struct GLWindow } }; -class OpenGLRender +class VCL_DLLPUBLIC OpenGLRender { public: OpenGLRender(com::sun::star::uno::Reference< @@ -192,16 +195,16 @@ public: void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha); private: - GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName); - int CreateTextureObj(int width, int height); - int CreateRenderObj(int width, int height); - int CreateFrameBufferObj(); + SAL_DLLPRIVATE GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName); + SAL_DLLPRIVATE int CreateTextureObj(int width, int height); + SAL_DLLPRIVATE int CreateRenderObj(int width, int height); + SAL_DLLPRIVATE int CreateFrameBufferObj(); #if defined( _WIN32 ) - int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd); - bool WGLisExtensionSupported(const char *extension); + SAL_DLLPRIVATE int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd); + SAL_DLLPRIVATE bool WGLisExtensionSupported(const char *extension); #endif - int CreateMultiSampleFrameBufObj(); - int Create2DCircle(int detail); + SAL_DLLPRIVATE int CreateMultiSampleFrameBufObj(); + SAL_DLLPRIVATE int Create2DCircle(int detail); private: // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units @@ -295,4 +298,6 @@ private: #endif }; +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vclopengl.mk b/vcl/Library_vclopengl.mk new file mode 100644 index 0000000..5c52add --- /dev/null +++ b/vcl/Library_vclopengl.mk @@ -0,0 +1,59 @@ +# -*- 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_Library_Library,vclopengl)) + +$(eval $(call gb_Library_set_include,vclopengl,\ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_use_externals,vclopengl,\ + boost_headers \ + mdds_headers \ + glm_headers \ + mesa_headers \ + glew \ +)) + +$(eval $(call gb_Library_use_sdk_api,vclopengl)) + +$(eval $(call gb_Library_use_libraries,vclopengl,\ + comphelper \ + cppu \ + cppuhelper \ + editeng \ + sal \ + vcl \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_Library_add_exception_objects,vclopengl,\ + vcl/source/opengl/OpenGLRender \ +)) + +ifeq ($(strip $(OS)),WNT) +$(eval $(call gb_Library_use_system_win32_libs,vclopengl,\ + opengl32 \ + gdi32 \ + glu32 \ +)) +else ifeq ($(OS),MACOSX) +$(eval $(call gb_Library_use_system_darwin_frameworks,vclopengl,\ + OpenGL \ +)) +else ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_libs,vclopengl,\ + -ldl \ + -lGL \ + -lGLU \ + -lX11 \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 1f3c8e2..50d847c 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -25,6 +25,10 @@ $(eval $(call gb_Module_add_targets,vcl,\ $(if $(filter DESKTOP,$(BUILD_TYPE)), \ StaticLibrary_vclmain \ Executable_ui-previewer) \ + $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \ + Library_vclopengl \ + Package_opengl \ + ) \ )) $(eval $(call gb_Module_add_l10n_targets,vcl,\ diff --git a/chart2/Package_opengl.mk b/vcl/Package_opengl.mk similarity index 78% rename from chart2/Package_opengl.mk rename to vcl/Package_opengl.mk index ef33ebb..6eb2463 100644 --- a/chart2/Package_opengl.mk +++ b/vcl/Package_opengl.mk @@ -7,9 +7,9 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -$(eval $(call gb_Package_Package,chart2_opengl_shader,$(SRCDIR)/chart2/opengl)) +$(eval $(call gb_Package_Package,vcl_opengl_shader,$(SRCDIR)/vcl/source/opengl/shaders)) -$(eval $(call gb_Package_add_files,chart2_opengl_shader,$(LIBO_BIN_FOLDER)/opengl,\ +$(eval $(call gb_Package_add_files,vcl_opengl_shader,$(LIBO_BIN_FOLDER)/opengl,\ backgroundFragmentShader.glsl \ backgroundVertexShader.glsl \ commonFragmentShader.glsl \ diff --git a/chart2/source/view/main/OpenGLRender.cxx b/vcl/source/opengl/OpenGLRender.cxx similarity index 96% rename from chart2/source/view/main/OpenGLRender.cxx rename to vcl/source/opengl/OpenGLRender.cxx index 3b81db2..a4fb1b9 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/vcl/source/opengl/OpenGLRender.cxx @@ -9,7 +9,7 @@ #include <GL/glew.h> #include <vector> -#include "OpenGLRender.hxx" +#include <vcl/OpenGLRender.hxx> #include <vcl/bmpacc.hxx> #include <vcl/graph.hxx> #include <com/sun/star/awt/XBitmap.hpp> @@ -74,9 +74,9 @@ int static checkGLError(const char *file, int line) const GLubyte* sError = gluErrorString(glErr); if (sError) - SAL_WARN("chart2.opengl", "GL Error #" << glErr << "(" << gluErrorString(glErr) << ") " << " in File " << file << " at line: " << line); + SAL_WARN("vcl.opengl", "GL Error #" << glErr << "(" << gluErrorString(glErr) << ") " << " in File " << file << " at line: " << line); else - SAL_WARN("chart2.opengl", "GL Error #" << glErr << " (no message available)" << " in File " << file << " at line: " << line); + SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available)" << " in File " << file << " at line: " << line); retCode = -1; return retCode; @@ -91,7 +91,7 @@ static bool bGlewInit = false; #define CHECK_GL_FRAME_BUFFER_STATUS() \ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\ if( status != GL_FRAMEBUFFER_COMPLETE ) {\ - SAL_WARN("chart2.opengl", "OpenGL error: " << status );\ + SAL_WARN("vcl.opengl", "OpenGL error: " << status );\ return -1;\ } @@ -126,7 +126,7 @@ OString loadShader(const OUString& rFilename) } else { - SAL_WARN("chart2.opengl", "could not load the file: " << aFileURL); + SAL_WARN("vcl.opengl", "could not load the file: " << aFileURL); } return OString(); @@ -159,10 +159,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString std::vector<char> VertexShaderErrorMessage(InfoLogLength+1); glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]); VertexShaderErrorMessage.push_back('\0'); - SAL_WARN("chart2.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]); + SAL_WARN("vcl.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]); } else - SAL_WARN("chart2.opengl", "vertex shader compile failed without error log"); + SAL_WARN("vcl.opengl", "vertex shader compile failed without error log"); return 0; } @@ -183,10 +183,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString std::vector<char> FragmentShaderErrorMessage(InfoLogLength+1); glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]); FragmentShaderErrorMessage.push_back('\0'); - SAL_WARN("chart2.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]); + SAL_WARN("vcl.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]); } else - SAL_WARN("chart2.opengl", "fragment shader compile failed without error log"); + SAL_WARN("vcl.opengl", "fragment shader compile failed without error log"); return 0; @@ -208,10 +208,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString std::vector<char> ProgramErrorMessage(InfoLogLength+1); glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]); ProgramErrorMessage.push_back('\0'); - SAL_WARN("chart2.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]); + SAL_WARN("vcl.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]); } else - SAL_WARN("chart2.opengl", "shader program link failed without error log"); + SAL_WARN("vcl.opengl", "shader program link failed without error log"); return 0; } @@ -241,7 +241,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { - SAL_WARN("chart2.opengl", "Failed to initialize GLEW"); + SAL_WARN("vcl.opengl", "Failed to initialize GLEW"); return -1; } else @@ -251,7 +251,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) // These guys don't just check support but setup the vtables. if (glewIsSupported("framebuffer_object") != GLEW_OK) { - SAL_WARN("chart2.opengl", "GL stack has no framebuffer support"); + SAL_WARN("vcl.opengl", "GL stack has no framebuffer support"); return -1; } @@ -385,7 +385,7 @@ BitmapEx OpenGLRender::GetAsBitmap() aWriter.Write( sOutput ); sOutput.Close(); } catch (...) { - SAL_WARN("chart2.opengl", "Error writing png to " << aName); + SAL_WARN("vcl.opengl", "Error writing png to " << aName); } #endif @@ -535,13 +535,13 @@ void OpenGLRender::renderToBitmap() status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { - SAL_INFO("chart2.opengl", "The frame buffer status is not complete!"); + SAL_INFO("vcl.opengl", "The frame buffer status is not complete!"); } glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FboID); status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { - SAL_INFO("chart2.opengl", "The frame buffer status is not complete!"); + SAL_INFO("vcl.opengl", "The frame buffer status is not complete!"); } glBlitFramebuffer(0, 0 ,m_iWidth, m_iHeight, 0, 0,m_iWidth ,m_iHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBindFramebuffer(GL_READ_FRAMEBUFFER,0); @@ -659,7 +659,7 @@ void OpenGLRender::Release() glXMakeCurrent(glWin.dpy, None, NULL); if( glGetError() != GL_NO_ERROR ) { - SAL_INFO("chart2.opengl", "glError: " << (char *)gluErrorString(glGetError())); + SAL_INFO("vcl.opengl", "glError: " << (char *)gluErrorString(glGetError())); } glXDestroyContext(glWin.dpy, glWin.ctx); glWin.ctx = NULL; @@ -805,7 +805,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) //create a temp windwo to check whether support multi-sample, if support, get the format if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0) { - SAL_WARN("chart2.opengl", "Can't create temp window to test"); + SAL_WARN("vcl.opengl", "Can't create temp window to test"); return false; } @@ -813,7 +813,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) if (!WGLisExtensionSupported("WGL_ARB_multisample")) { mbArbMultisampleSupported = false; - SAL_WARN("chart2.opengl", "Device doesn't support multi sample"); + SAL_WARN("vcl.opengl", "Device doesn't support multi sample"); return false; } // Get Our Pixel Format @@ -1112,7 +1112,7 @@ int OpenGLRender::RenderBubble2FBO(int) GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER); if( fbResult != GL_FRAMEBUFFER_COMPLETE ) { - SAL_WARN("chart2.opengl", "error"); + SAL_WARN("vcl.opengl", "error"); return -1; } CHECK_GL_ERROR(); @@ -1270,7 +1270,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point& aWriter.Write( sOutput ); sOutput.Close(); } catch (...) { - SAL_WARN("chart2.opengl", "Error writing png to " << aName); + SAL_WARN("vcl.opengl", "Error writing png to " << aName); } #endif @@ -1533,7 +1533,7 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_ m_BackgroundColor[13] = (float)g / 255.0f; m_BackgroundColor[14] = (float)b / 255.0f; m_BackgroundColor[15] = nAlpha / 255.0f; - SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2); + SAL_INFO("vcl.opengl", "color1 = " << color1 << ", color2 = " << color2); } diff --git a/chart2/opengl/backgroundFragmentShader.glsl b/vcl/source/opengl/shaders/backgroundFragmentShader.glsl similarity index 100% rename from chart2/opengl/backgroundFragmentShader.glsl rename to vcl/source/opengl/shaders/backgroundFragmentShader.glsl diff --git a/chart2/opengl/backgroundVertexShader.glsl b/vcl/source/opengl/shaders/backgroundVertexShader.glsl similarity index 100% rename from chart2/opengl/backgroundVertexShader.glsl rename to vcl/source/opengl/shaders/backgroundVertexShader.glsl diff --git a/chart2/opengl/commonFragmentShader.glsl b/vcl/source/opengl/shaders/commonFragmentShader.glsl similarity index 100% rename from chart2/opengl/commonFragmentShader.glsl rename to vcl/source/opengl/shaders/commonFragmentShader.glsl diff --git a/chart2/opengl/commonVertexShader.glsl b/vcl/source/opengl/shaders/commonVertexShader.glsl similarity index 100% rename from chart2/opengl/commonVertexShader.glsl rename to vcl/source/opengl/shaders/commonVertexShader.glsl diff --git a/chart2/opengl/debugFragmentShader.glsl b/vcl/source/opengl/shaders/debugFragmentShader.glsl similarity index 100% rename from chart2/opengl/debugFragmentShader.glsl rename to vcl/source/opengl/shaders/debugFragmentShader.glsl diff --git a/chart2/opengl/debugVertexShader.glsl b/vcl/source/opengl/shaders/debugVertexShader.glsl similarity index 100% rename from chart2/opengl/debugVertexShader.glsl rename to vcl/source/opengl/shaders/debugVertexShader.glsl diff --git a/chart2/opengl/symbolFragmentShader.glsl b/vcl/source/opengl/shaders/symbolFragmentShader.glsl similarity index 100% rename from chart2/opengl/symbolFragmentShader.glsl rename to vcl/source/opengl/shaders/symbolFragmentShader.glsl diff --git a/chart2/opengl/symbolVertexShader.glsl b/vcl/source/opengl/shaders/symbolVertexShader.glsl similarity index 100% rename from chart2/opengl/symbolVertexShader.glsl rename to vcl/source/opengl/shaders/symbolVertexShader.glsl diff --git a/chart2/opengl/textFragmentShader.glsl b/vcl/source/opengl/shaders/textFragmentShader.glsl similarity index 100% rename from chart2/opengl/textFragmentShader.glsl rename to vcl/source/opengl/shaders/textFragmentShader.glsl diff --git a/chart2/opengl/textVertexShader.glsl b/vcl/source/opengl/shaders/textVertexShader.glsl similarity index 100% rename from chart2/opengl/textVertexShader.glsl rename to vcl/source/opengl/shaders/textVertexShader.glsl
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
