diff options
-rw-r--r-- | chart2/Library_chartopengl.mk | 22 | ||||
-rw-r--r-- | chart2/Module_chart2.mk | 1 | ||||
-rw-r--r-- | chart2/Package_opengl.mk (renamed from vcl/Package_opengl.mk) | 4 | ||||
-rw-r--r-- | chart2/opengl/backgroundFragmentShader.glsl (renamed from vcl/source/opengl/shaders/backgroundFragmentShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/backgroundVertexShader.glsl (renamed from vcl/source/opengl/shaders/backgroundVertexShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/commonFragmentShader.glsl (renamed from vcl/source/opengl/shaders/commonFragmentShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/commonVertexShader.glsl (renamed from vcl/source/opengl/shaders/commonVertexShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/debugFragmentShader.glsl (renamed from vcl/source/opengl/shaders/debugFragmentShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/debugVertexShader.glsl (renamed from vcl/source/opengl/shaders/debugVertexShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/symbolFragmentShader.glsl (renamed from vcl/source/opengl/shaders/symbolFragmentShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/symbolVertexShader.glsl (renamed from vcl/source/opengl/shaders/symbolVertexShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/textFragmentShader.glsl (renamed from vcl/source/opengl/shaders/textFragmentShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/opengl/textVertexShader.glsl (renamed from vcl/source/opengl/shaders/textVertexShader.glsl) | 0 | ||||
-rw-r--r-- | chart2/source/view/inc/DummyXShape.hxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/DummyXShape.cxx | 2 | ||||
-rwxr-xr-x | chart2/source/view/main/OpenGLRender.cxx (renamed from vcl/source/opengl/OpenGLRender.cxx) | 44 | ||||
-rwxr-xr-x | chart2/source/view/main/OpenGLRender.hxx (renamed from include/vcl/OpenGLRender.hxx) | 105 | ||||
-rw-r--r-- | include/sal/log-areas.dox | 1 | ||||
-rw-r--r-- | include/vcl/OpenGLContext.hxx | 81 | ||||
-rw-r--r-- | vcl/Library_vclopengl.mk | 1 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 8 |
22 files changed, 142 insertions, 130 deletions
diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk index 5ca68bd4eff9..758719695571 100644 --- a/chart2/Library_chartopengl.mk +++ b/chart2/Library_chartopengl.mk @@ -54,6 +54,26 @@ $(eval $(call gb_Library_use_libraries,chartopengl,\ $(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) +$(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/Module_chart2.mk b/chart2/Module_chart2.mk index 6c4d193dd2dd..611e699705a9 100644 --- a/chart2/Module_chart2.mk +++ b/chart2/Module_chart2.mk @@ -14,6 +14,7 @@ $(eval $(call gb_Module_add_targets,chart2,\ Library_chartcore \ $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \ Library_chartopengl \ + Package_opengl \ ) \ )) diff --git a/vcl/Package_opengl.mk b/chart2/Package_opengl.mk index 6eb2463d6feb..ef33ebbbff44 100644 --- a/vcl/Package_opengl.mk +++ b/chart2/Package_opengl.mk @@ -7,9 +7,9 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -$(eval $(call gb_Package_Package,vcl_opengl_shader,$(SRCDIR)/vcl/source/opengl/shaders)) +$(eval $(call gb_Package_Package,chart2_opengl_shader,$(SRCDIR)/chart2/opengl)) -$(eval $(call gb_Package_add_files,vcl_opengl_shader,$(LIBO_BIN_FOLDER)/opengl,\ +$(eval $(call gb_Package_add_files,chart2_opengl_shader,$(LIBO_BIN_FOLDER)/opengl,\ backgroundFragmentShader.glsl \ backgroundVertexShader.glsl \ commonFragmentShader.glsl \ diff --git a/vcl/source/opengl/shaders/backgroundFragmentShader.glsl b/chart2/opengl/backgroundFragmentShader.glsl index 805789e731ed..805789e731ed 100644 --- a/vcl/source/opengl/shaders/backgroundFragmentShader.glsl +++ b/chart2/opengl/backgroundFragmentShader.glsl diff --git a/vcl/source/opengl/shaders/backgroundVertexShader.glsl b/chart2/opengl/backgroundVertexShader.glsl index 6d9d6c21f3c9..6d9d6c21f3c9 100644 --- a/vcl/source/opengl/shaders/backgroundVertexShader.glsl +++ b/chart2/opengl/backgroundVertexShader.glsl diff --git a/vcl/source/opengl/shaders/commonFragmentShader.glsl b/chart2/opengl/commonFragmentShader.glsl index 805789e731ed..805789e731ed 100644 --- a/vcl/source/opengl/shaders/commonFragmentShader.glsl +++ b/chart2/opengl/commonFragmentShader.glsl diff --git a/vcl/source/opengl/shaders/commonVertexShader.glsl b/chart2/opengl/commonVertexShader.glsl index f32e3fd38a91..f32e3fd38a91 100644 --- a/vcl/source/opengl/shaders/commonVertexShader.glsl +++ b/chart2/opengl/commonVertexShader.glsl diff --git a/vcl/source/opengl/shaders/debugFragmentShader.glsl b/chart2/opengl/debugFragmentShader.glsl index d36c4f4d46e4..d36c4f4d46e4 100644 --- a/vcl/source/opengl/shaders/debugFragmentShader.glsl +++ b/chart2/opengl/debugFragmentShader.glsl diff --git a/vcl/source/opengl/shaders/debugVertexShader.glsl b/chart2/opengl/debugVertexShader.glsl index 762de3121419..762de3121419 100644 --- a/vcl/source/opengl/shaders/debugVertexShader.glsl +++ b/chart2/opengl/debugVertexShader.glsl diff --git a/vcl/source/opengl/shaders/symbolFragmentShader.glsl b/chart2/opengl/symbolFragmentShader.glsl index 3ac6b0305285..3ac6b0305285 100644 --- a/vcl/source/opengl/shaders/symbolFragmentShader.glsl +++ b/chart2/opengl/symbolFragmentShader.glsl diff --git a/vcl/source/opengl/shaders/symbolVertexShader.glsl b/chart2/opengl/symbolVertexShader.glsl index 3cf9f41ef21b..3cf9f41ef21b 100644 --- a/vcl/source/opengl/shaders/symbolVertexShader.glsl +++ b/chart2/opengl/symbolVertexShader.glsl diff --git a/vcl/source/opengl/shaders/textFragmentShader.glsl b/chart2/opengl/textFragmentShader.glsl index ef8d44d6949d..ef8d44d6949d 100644 --- a/vcl/source/opengl/shaders/textFragmentShader.glsl +++ b/chart2/opengl/textFragmentShader.glsl diff --git a/vcl/source/opengl/shaders/textVertexShader.glsl b/chart2/opengl/textVertexShader.glsl index a805229eb07a..a805229eb07a 100644 --- a/vcl/source/opengl/shaders/textVertexShader.glsl +++ b/chart2/opengl/textVertexShader.glsl diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx index d7e137d6805f..032651fb3f0d 100644 --- a/chart2/source/view/inc/DummyXShape.hxx +++ b/chart2/source/view/inc/DummyXShape.hxx @@ -12,8 +12,8 @@ #include <cppuhelper/implbase6.hxx> -#include <vcl/OpenGLRender.hxx> #include <vcl/OpenGLContext.hxx> +#include "OpenGLRender.hxx" #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShapes.hpp> diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 0416ea9c54d4..f28af5de8315 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -1150,7 +1150,7 @@ DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget): { SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: "); setName("com.sun.star.chart2.shapes"); - m_aGLContext.init(m_GLRender); + m_aGLContext.init(); } void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition ) diff --git a/vcl/source/opengl/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 5a88e7aa28c1..f97f50619b56 100755 --- a/vcl/source/opengl/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -9,7 +9,7 @@ #include <GL/glew.h> #include <vector> -#include <vcl/OpenGLRender.hxx> +#include "OpenGLRender.hxx" #include <vcl/bmpacc.hxx> #include <vcl/graph.hxx> #include <com/sun/star/awt/XBitmap.hpp> @@ -73,9 +73,9 @@ int static checkGLError(const char *file, int line) const GLubyte* sError = gluErrorString(glErr); if (sError) - SAL_WARN("vcl.opengl", "GL Error #" << glErr << "(" << gluErrorString(glErr) << ") " << " in File " << file << " at line: " << line); + SAL_WARN("chart2.opengl", "GL Error #" << glErr << "(" << gluErrorString(glErr) << ") " << " in File " << file << " at line: " << line); else - SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available)" << " in File " << file << " at line: " << line); + SAL_WARN("chart2.opengl", "GL Error #" << glErr << " (no message available)" << " in File " << file << " at line: " << line); retCode = -1; return retCode; @@ -90,7 +90,7 @@ static bool bGlewInit = false; #define CHECK_GL_FRAME_BUFFER_STATUS() \ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\ if( status != GL_FRAMEBUFFER_COMPLETE ) {\ - SAL_WARN("vcl.opengl", "OpenGL error: " << status );\ + SAL_WARN("chart2.opengl", "OpenGL error: " << status );\ return -1;\ } @@ -125,7 +125,7 @@ OString loadShader(const OUString& rFilename) } else { - SAL_WARN("vcl.opengl", "could not load the file: " << aFileURL); + SAL_WARN("chart2.opengl", "could not load the file: " << aFileURL); } return OString(); @@ -158,10 +158,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("vcl.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]); + SAL_WARN("chart2.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]); } else - SAL_WARN("vcl.opengl", "vertex shader compile failed without error log"); + SAL_WARN("chart2.opengl", "vertex shader compile failed without error log"); return 0; } @@ -182,10 +182,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("vcl.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]); + SAL_WARN("chart2.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]); } else - SAL_WARN("vcl.opengl", "fragment shader compile failed without error log"); + SAL_WARN("chart2.opengl", "fragment shader compile failed without error log"); return 0; @@ -207,10 +207,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("vcl.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]); + SAL_WARN("chart2.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]); } else - SAL_WARN("vcl.opengl", "shader program link failed without error log"); + SAL_WARN("chart2.opengl", "shader program link failed without error log"); return 0; } @@ -240,7 +240,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { - SAL_WARN("vcl.opengl", "Failed to initialize GLEW"); + SAL_WARN("chart2.opengl", "Failed to initialize GLEW"); return -1; } else @@ -250,7 +250,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("vcl.opengl", "GL stack has no framebuffer support"); + SAL_WARN("chart2.opengl", "GL stack has no framebuffer support"); return -1; } @@ -384,7 +384,7 @@ BitmapEx OpenGLRender::GetAsBitmap() aWriter.Write( sOutput ); sOutput.Close(); } catch (...) { - SAL_WARN("vcl.opengl", "Error writing png to " << aName); + SAL_WARN("chart2.opengl", "Error writing png to " << aName); } #endif @@ -534,13 +534,13 @@ void OpenGLRender::renderToBitmap() status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { - SAL_INFO("vcl.opengl", "The frame buffer status is not complete!"); + SAL_INFO("chart2.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("vcl.opengl", "The frame buffer status is not complete!"); + SAL_INFO("chart2.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); @@ -658,7 +658,7 @@ void OpenGLRender::Release() glXMakeCurrent(glWin.dpy, None, NULL); if( glGetError() != GL_NO_ERROR ) { - SAL_INFO("vcl.opengl", "glError: " << (char *)gluErrorString(glGetError())); + SAL_INFO("chart2.opengl", "glError: " << (char *)gluErrorString(glGetError())); } glXDestroyContext(glWin.dpy, glWin.ctx); glWin.ctx = NULL; @@ -804,7 +804,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("vcl.opengl", "Can't create temp window to test"); + SAL_WARN("chart2.opengl", "Can't create temp window to test"); return false; } @@ -812,7 +812,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) if (!WGLisExtensionSupported("WGL_ARB_multisample")) { mbArbMultisampleSupported = false; - SAL_WARN("vcl.opengl", "Device doesn't support multi sample"); + SAL_WARN("chart2.opengl", "Device doesn't support multi sample"); return false; } // Get Our Pixel Format @@ -1111,7 +1111,7 @@ int OpenGLRender::RenderBubble2FBO(int) GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER); if( fbResult != GL_FRAMEBUFFER_COMPLETE ) { - SAL_WARN("vcl.opengl", "error"); + SAL_WARN("chart2.opengl", "error"); return -1; } CHECK_GL_ERROR(); @@ -1269,7 +1269,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point& aWriter.Write( sOutput ); sOutput.Close(); } catch (...) { - SAL_WARN("vcl.opengl", "Error writing png to " << aName); + SAL_WARN("chart2.opengl", "Error writing png to " << aName); } #endif @@ -1532,7 +1532,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("vcl.opengl", "color1 = " << color1 << ", color2 = " << color2); + SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2); } diff --git a/include/vcl/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 4fabae9d56bb..8140bf9adf3b 100755 --- a/include/vcl/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -7,43 +7,11 @@ * 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> -# include "GL/glxew.h" -# include <postx.h> -#elif defined( _WIN32 ) -# include "prewin.h" -# include "windows.h" -# include "postwin.h" -#endif - -#include <GL/glew.h> - -#include <vcl/window.hxx> -#include <vcl/syschild.hxx> -#include <vcl/sysdata.hxx> #include <vcl/bitmapex.hxx> #include <com/sun/star/drawing/HomogenMatrix3.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> #include <vcl/font.hxx> -#include <vcl/vclopengl_dllapi.hxx> - - -#if defined( _WIN32 ) -#include <GL/glext.h> -#include <GL/wglext.h> -#elif defined( MACOSX ) -#elif defined( UNX ) -#include <GL/glext.h> -#define GLX_GLXEXT_PROTOTYPES 1 -#include <GL/glx.h> -#include <GL/glxext.h> - -#endif +#include <vcl/OpenGLContext.hxx> // Include GLM #include <list> @@ -93,58 +61,7 @@ typedef std::vector<GLfloat> Area2DPointList; typedef std::vector<GLfloat> PieSegment2DPointList; typedef std::vector<GLfloat> PointList; -/// Holds the information of our new child window -struct GLWindow -{ -#if defined( _WIN32 ) - HWND hWnd; - HDC hDC; - HGLRC hRC; -#elif defined( MACOSX ) -#elif defined( UNX ) - Display* dpy; - int screen; - XLIB_Window win; -#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap ) - GLXFBConfig fbc; -#endif - XVisualInfo* vi; - GLXContext ctx; - - bool HasGLXExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, (const GLubyte*) GLXExtensions ); } - const char* GLXExtensions; -#endif - unsigned int bpp; - unsigned int Width; - unsigned int Height; - const GLubyte* GLExtensions; - - bool HasGLExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, GLExtensions ); } - - GLWindow() - : -#if defined( _WIN32 ) -#elif defined( MACOSX ) -#elif defined( UNX ) - dpy(NULL), - screen(0), - win(0), -#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap ) - fbc(0), -#endif - vi(NULL), - ctx(0), - GLXExtensions(NULL), -#endif - bpp(0), - Width(0), - Height(0), - GLExtensions(NULL) - { - } -}; - -class VCLOPENGL_DLLPUBLIC OpenGLRender +class OpenGLRender { public: OpenGLRender(com::sun::star::uno::Reference< @@ -196,16 +113,16 @@ public: void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha); private: - 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(); + GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName); + int CreateTextureObj(int width, int height); + int CreateRenderObj(int width, int height); + int CreateFrameBufferObj(); #if defined( _WIN32 ) - SAL_DLLPRIVATE int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd); - SAL_DLLPRIVATE bool WGLisExtensionSupported(const char *extension); + int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd); + bool WGLisExtensionSupported(const char *extension); #endif - SAL_DLLPRIVATE int CreateMultiSampleFrameBufObj(); - SAL_DLLPRIVATE int Create2DCircle(int detail); + int CreateMultiSampleFrameBufObj(); + int Create2DCircle(int detail); private: // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units @@ -299,6 +216,4 @@ private: #endif }; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index 018e4c64863c..41ef580eec03 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -362,7 +362,6 @@ 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/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx index 60bcfcca760f..407333424780 100644 --- a/include/vcl/OpenGLContext.hxx +++ b/include/vcl/OpenGLContext.hxx @@ -10,9 +10,86 @@ #ifndef VCL_OPENGL_CONTEXT_HXX #define VCL_OPENGL_CONTEXT_HXX +#if defined( MACOSX ) +#elif defined( UNX ) +# include <prex.h> +# include "GL/glxew.h" +# include <postx.h> +#elif defined( _WIN32 ) +# include "prewin.h" +# include "windows.h" +# include "postwin.h" +#endif + +#if defined( _WIN32 ) +#include <GL/glext.h> +#include <GL/wglext.h> +#elif defined( MACOSX ) +#elif defined( UNX ) +#include <GL/glext.h> +#define GLX_GLXEXT_PROTOTYPES 1 +#include <GL/glx.h> +#include <GL/glxext.h> +#endif + +#include <GL/glew.h> + #include <vcl/vclopengl_dllapi.hxx> -#include <vcl/OpenGLRender.hxx> #include <boost/scoped_ptr.hpp> +#include <vcl/window.hxx> +#include <tools/gen.hxx> +#include <vcl/syschild.hxx> + +/// Holds the information of our new child window +struct GLWindow +{ +#if defined( _WIN32 ) + HWND hWnd; + HDC hDC; + HGLRC hRC; +#elif defined( MACOSX ) +#elif defined( UNX ) + Display* dpy; + int screen; + XLIB_Window win; +#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap ) + GLXFBConfig fbc; +#endif + XVisualInfo* vi; + GLXContext ctx; + + bool HasGLXExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, (const GLubyte*) GLXExtensions ); } + const char* GLXExtensions; +#endif + unsigned int bpp; + unsigned int Width; + unsigned int Height; + const GLubyte* GLExtensions; + + bool HasGLExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, GLExtensions ); } + + GLWindow() + : +#if defined( _WIN32 ) +#elif defined( MACOSX ) +#elif defined( UNX ) + dpy(NULL), + screen(0), + win(0), +#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap ) + fbc(0), +#endif + vi(NULL), + ctx(0), + GLXExtensions(NULL), +#endif + bpp(0), + Width(0), + Height(0), + GLExtensions(NULL) + { + } +}; class VCLOPENGL_DLLPUBLIC OpenGLContext { @@ -20,7 +97,7 @@ public: OpenGLContext(); ~OpenGLContext(); - bool init(OpenGLRender& rGLRender); + bool init(); void setWinSize(const Size& rSize); private: diff --git a/vcl/Library_vclopengl.mk b/vcl/Library_vclopengl.mk index 270cbd6213a2..59cf9581643a 100644 --- a/vcl/Library_vclopengl.mk +++ b/vcl/Library_vclopengl.mk @@ -33,7 +33,6 @@ $(eval $(call gb_Library_use_libraries,vclopengl,\ )) $(eval $(call gb_Library_add_exception_objects,vclopengl,\ - vcl/source/opengl/OpenGLRender \ vcl/source/opengl/OpenGLContext \ )) diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 50d847c9a669..bb2ad3b433d8 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -27,7 +27,6 @@ $(eval $(call gb_Module_add_targets,vcl,\ Executable_ui-previewer) \ $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \ Library_vclopengl \ - Package_opengl \ ) \ )) diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index e17a7b83f1b6..a41a05804e13 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -8,7 +8,8 @@ */ #include <vcl/OpenGLContext.hxx> - +#include <vcl/syschild.hxx> +#include <vcl/sysdata.hxx> using namespace com::sun::star; @@ -119,9 +120,10 @@ int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ ) } } + #endif -bool OpenGLContext::init(OpenGLRender& rGLRender) +bool OpenGLContext::init() { m_pWindow.reset(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL)); SAL_INFO("vcl.opengl", "OpenGLContext::OpenGLContext----start"); @@ -233,7 +235,7 @@ bool OpenGLContext::init(OpenGLRender& rGLRender) #endif - rGLRender.InitOpenGL(m_aGLWin); + //rGLRender.InitOpenGL(m_aGLWin); #ifdef DBG_UTIL // only enable debug output in dbgutil build |