Kaydet (Commit) 40ea5e9d authored tarafından Markus Mohrhard's avatar Markus Mohrhard

Revert "Move OpenGLRender to vcl"

This reverts commit 04b70c68.

The OpenGLRender is not abstract enough for vcl. Leave it in chart2.

Conflicts:
	chart2/source/view/inc/DummyXShape.hxx
	chart2/source/view/main/OpenGLRender.hxx
	vcl/Library_vclopengl.mk

Change-Id: I5392c8ee34462ff49059126ca2284d8ebe1eb379
üst bd78139d
...@@ -54,6 +54,26 @@ $(eval $(call gb_Library_use_libraries,chartopengl,\ ...@@ -54,6 +54,26 @@ $(eval $(call gb_Library_use_libraries,chartopengl,\
$(eval $(call gb_Library_add_exception_objects,chartopengl,\ $(eval $(call gb_Library_add_exception_objects,chartopengl,\
chart2/source/view/main/OpenglShapeFactory \ chart2/source/view/main/OpenglShapeFactory \
chart2/source/view/main/DummyXShape \ 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: # vim: set noet sw=4 ts=4:
...@@ -14,6 +14,7 @@ $(eval $(call gb_Module_add_targets,chart2,\ ...@@ -14,6 +14,7 @@ $(eval $(call gb_Module_add_targets,chart2,\
Library_chartcore \ Library_chartcore \
$(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \ $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \
Library_chartopengl \ Library_chartopengl \
Package_opengl \
) \ ) \
)) ))
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # 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 \ backgroundFragmentShader.glsl \
backgroundVertexShader.glsl \ backgroundVertexShader.glsl \
commonFragmentShader.glsl \ commonFragmentShader.glsl \
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include <cppuhelper/implbase6.hxx> #include <cppuhelper/implbase6.hxx>
#include <vcl/OpenGLRender.hxx>
#include <vcl/OpenGLContext.hxx> #include <vcl/OpenGLContext.hxx>
#include "OpenGLRender.hxx"
#include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/drawing/XShapes.hpp>
......
...@@ -1150,7 +1150,7 @@ DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget): ...@@ -1150,7 +1150,7 @@ DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget):
{ {
SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: "); SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
setName("com.sun.star.chart2.shapes"); setName("com.sun.star.chart2.shapes");
m_aGLContext.init(m_GLRender); m_aGLContext.init();
} }
void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition ) void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition )
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <GL/glew.h> #include <GL/glew.h>
#include <vector> #include <vector>
#include <vcl/OpenGLRender.hxx> #include "OpenGLRender.hxx"
#include <vcl/bmpacc.hxx> #include <vcl/bmpacc.hxx>
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
#include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/awt/XBitmap.hpp>
...@@ -73,9 +73,9 @@ int static checkGLError(const char *file, int line) ...@@ -73,9 +73,9 @@ int static checkGLError(const char *file, int line)
const GLubyte* sError = gluErrorString(glErr); const GLubyte* sError = gluErrorString(glErr);
if (sError) 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 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; retCode = -1;
return retCode; return retCode;
...@@ -90,7 +90,7 @@ static bool bGlewInit = false; ...@@ -90,7 +90,7 @@ static bool bGlewInit = false;
#define CHECK_GL_FRAME_BUFFER_STATUS() \ #define CHECK_GL_FRAME_BUFFER_STATUS() \
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\
if( status != GL_FRAMEBUFFER_COMPLETE ) {\ if( status != GL_FRAMEBUFFER_COMPLETE ) {\
SAL_WARN("vcl.opengl", "OpenGL error: " << status );\ SAL_WARN("chart2.opengl", "OpenGL error: " << status );\
return -1;\ return -1;\
} }
...@@ -125,7 +125,7 @@ OString loadShader(const OUString& rFilename) ...@@ -125,7 +125,7 @@ OString loadShader(const OUString& rFilename)
} }
else else
{ {
SAL_WARN("vcl.opengl", "could not load the file: " << aFileURL); SAL_WARN("chart2.opengl", "could not load the file: " << aFileURL);
} }
return OString(); return OString();
...@@ -158,10 +158,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString ...@@ -158,10 +158,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString
std::vector<char> VertexShaderErrorMessage(InfoLogLength+1); std::vector<char> VertexShaderErrorMessage(InfoLogLength+1);
glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]); glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
VertexShaderErrorMessage.push_back('\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 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; return 0;
} }
...@@ -182,10 +182,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString ...@@ -182,10 +182,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString
std::vector<char> FragmentShaderErrorMessage(InfoLogLength+1); std::vector<char> FragmentShaderErrorMessage(InfoLogLength+1);
glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]); glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
FragmentShaderErrorMessage.push_back('\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 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; return 0;
...@@ -207,10 +207,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString ...@@ -207,10 +207,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString
std::vector<char> ProgramErrorMessage(InfoLogLength+1); std::vector<char> ProgramErrorMessage(InfoLogLength+1);
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]); glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
ProgramErrorMessage.push_back('\0'); ProgramErrorMessage.push_back('\0');
SAL_WARN("vcl.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]); SAL_WARN("chart2.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]);
} }
else 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; return 0;
} }
...@@ -240,7 +240,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) ...@@ -240,7 +240,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
glewExperimental = GL_TRUE; glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK) if (glewInit() != GLEW_OK)
{ {
SAL_WARN("vcl.opengl", "Failed to initialize GLEW"); SAL_WARN("chart2.opengl", "Failed to initialize GLEW");
return -1; return -1;
} }
else else
...@@ -250,7 +250,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) ...@@ -250,7 +250,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
// These guys don't just check support but setup the vtables. // These guys don't just check support but setup the vtables.
if (glewIsSupported("framebuffer_object") != GLEW_OK) 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; return -1;
} }
...@@ -384,7 +384,7 @@ BitmapEx OpenGLRender::GetAsBitmap() ...@@ -384,7 +384,7 @@ BitmapEx OpenGLRender::GetAsBitmap()
aWriter.Write( sOutput ); aWriter.Write( sOutput );
sOutput.Close(); sOutput.Close();
} catch (...) { } catch (...) {
SAL_WARN("vcl.opengl", "Error writing png to " << aName); SAL_WARN("chart2.opengl", "Error writing png to " << aName);
} }
#endif #endif
...@@ -534,13 +534,13 @@ void OpenGLRender::renderToBitmap() ...@@ -534,13 +534,13 @@ void OpenGLRender::renderToBitmap()
status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) 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); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FboID);
status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) 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); glBlitFramebuffer(0, 0 ,m_iWidth, m_iHeight, 0, 0,m_iWidth ,m_iHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR);
glBindFramebuffer(GL_READ_FRAMEBUFFER,0); glBindFramebuffer(GL_READ_FRAMEBUFFER,0);
...@@ -658,7 +658,7 @@ void OpenGLRender::Release() ...@@ -658,7 +658,7 @@ void OpenGLRender::Release()
glXMakeCurrent(glWin.dpy, None, NULL); glXMakeCurrent(glWin.dpy, None, NULL);
if( glGetError() != GL_NO_ERROR ) { 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); glXDestroyContext(glWin.dpy, glWin.ctx);
glWin.ctx = NULL; glWin.ctx = NULL;
...@@ -804,7 +804,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) ...@@ -804,7 +804,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
//create a temp windwo to check whether support multi-sample, if support, get the format //create a temp windwo to check whether support multi-sample, if support, get the format
if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0) 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; return false;
} }
...@@ -812,7 +812,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) ...@@ -812,7 +812,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
if (!WGLisExtensionSupported("WGL_ARB_multisample")) if (!WGLisExtensionSupported("WGL_ARB_multisample"))
{ {
mbArbMultisampleSupported = false; mbArbMultisampleSupported = false;
SAL_WARN("vcl.opengl", "Device doesn't support multi sample"); SAL_WARN("chart2.opengl", "Device doesn't support multi sample");
return false; return false;
} }
// Get Our Pixel Format // Get Our Pixel Format
...@@ -1111,7 +1111,7 @@ int OpenGLRender::RenderBubble2FBO(int) ...@@ -1111,7 +1111,7 @@ int OpenGLRender::RenderBubble2FBO(int)
GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER); GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if( fbResult != GL_FRAMEBUFFER_COMPLETE ) if( fbResult != GL_FRAMEBUFFER_COMPLETE )
{ {
SAL_WARN("vcl.opengl", "error"); SAL_WARN("chart2.opengl", "error");
return -1; return -1;
} }
CHECK_GL_ERROR(); CHECK_GL_ERROR();
...@@ -1269,7 +1269,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point& ...@@ -1269,7 +1269,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&
aWriter.Write( sOutput ); aWriter.Write( sOutput );
sOutput.Close(); sOutput.Close();
} catch (...) { } catch (...) {
SAL_WARN("vcl.opengl", "Error writing png to " << aName); SAL_WARN("chart2.opengl", "Error writing png to " << aName);
} }
#endif #endif
...@@ -1532,7 +1532,7 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_ ...@@ -1532,7 +1532,7 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_
m_BackgroundColor[13] = (float)g / 255.0f; m_BackgroundColor[13] = (float)g / 255.0f;
m_BackgroundColor[14] = (float)b / 255.0f; m_BackgroundColor[14] = (float)b / 255.0f;
m_BackgroundColor[15] = nAlpha / 255.0f; m_BackgroundColor[15] = nAlpha / 255.0f;
SAL_INFO("vcl.opengl", "color1 = " << color1 << ", color2 = " << color2); SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2);
} }
......
...@@ -7,43 +7,11 @@ ...@@ -7,43 +7,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * 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 <vcl/bitmapex.hxx>
#include <com/sun/star/drawing/HomogenMatrix3.hpp> #include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include <vcl/font.hxx> #include <vcl/font.hxx>
#include <vcl/vclopengl_dllapi.hxx> #include <vcl/OpenGLContext.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 GLM // Include GLM
#include <list> #include <list>
...@@ -93,58 +61,7 @@ typedef std::vector<GLfloat> Area2DPointList; ...@@ -93,58 +61,7 @@ typedef std::vector<GLfloat> Area2DPointList;
typedef std::vector<GLfloat> PieSegment2DPointList; typedef std::vector<GLfloat> PieSegment2DPointList;
typedef std::vector<GLfloat> PointList; typedef std::vector<GLfloat> PointList;
/// Holds the information of our new child window class OpenGLRender
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
{ {
public: public:
OpenGLRender(com::sun::star::uno::Reference< OpenGLRender(com::sun::star::uno::Reference<
...@@ -196,16 +113,16 @@ public: ...@@ -196,16 +113,16 @@ public:
void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha); void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha);
private: private:
SAL_DLLPRIVATE GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName); GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
SAL_DLLPRIVATE int CreateTextureObj(int width, int height); int CreateTextureObj(int width, int height);
SAL_DLLPRIVATE int CreateRenderObj(int width, int height); int CreateRenderObj(int width, int height);
SAL_DLLPRIVATE int CreateFrameBufferObj(); int CreateFrameBufferObj();
#if defined( _WIN32 ) #if defined( _WIN32 )
SAL_DLLPRIVATE int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd); int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd);
SAL_DLLPRIVATE bool WGLisExtensionSupported(const char *extension); bool WGLisExtensionSupported(const char *extension);
#endif #endif
SAL_DLLPRIVATE int CreateMultiSampleFrameBufObj(); int CreateMultiSampleFrameBufObj();
SAL_DLLPRIVATE int Create2DCircle(int detail); int Create2DCircle(int detail);
private: private:
// Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
...@@ -299,6 +216,4 @@ private: ...@@ -299,6 +216,4 @@ private:
#endif #endif
}; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -362,7 +362,6 @@ certain functionality. ...@@ -362,7 +362,6 @@ certain functionality.
@li @c vcl.kde - KDE @li @c vcl.kde - KDE
@li @c vcl.kde4 - KDE4 @li @c vcl.kde4 - KDE4
@li @c vcl.layout - Widget layout @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.plugadapt - the Unix/X11 backend plugin mechanism
@li @c vcl.osx @li @c vcl.osx
@li @c vcl.osx.print @li @c vcl.osx.print
......
...@@ -10,9 +10,86 @@ ...@@ -10,9 +10,86 @@
#ifndef VCL_OPENGL_CONTEXT_HXX #ifndef VCL_OPENGL_CONTEXT_HXX
#define 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/vclopengl_dllapi.hxx>
#include <vcl/OpenGLRender.hxx>
#include <boost/scoped_ptr.hpp> #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 class VCLOPENGL_DLLPUBLIC OpenGLContext
{ {
...@@ -20,7 +97,7 @@ public: ...@@ -20,7 +97,7 @@ public:
OpenGLContext(); OpenGLContext();
~OpenGLContext(); ~OpenGLContext();
bool init(OpenGLRender& rGLRender); bool init();
void setWinSize(const Size& rSize); void setWinSize(const Size& rSize);
private: private:
......
...@@ -33,7 +33,6 @@ $(eval $(call gb_Library_use_libraries,vclopengl,\ ...@@ -33,7 +33,6 @@ $(eval $(call gb_Library_use_libraries,vclopengl,\
)) ))
$(eval $(call gb_Library_add_exception_objects,vclopengl,\ $(eval $(call gb_Library_add_exception_objects,vclopengl,\
vcl/source/opengl/OpenGLRender \
vcl/source/opengl/OpenGLContext \ vcl/source/opengl/OpenGLContext \
)) ))
......
...@@ -27,7 +27,6 @@ $(eval $(call gb_Module_add_targets,vcl,\ ...@@ -27,7 +27,6 @@ $(eval $(call gb_Module_add_targets,vcl,\
Executable_ui-previewer) \ Executable_ui-previewer) \
$(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \ $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \
Library_vclopengl \ Library_vclopengl \
Package_opengl \
) \ ) \
)) ))
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
*/ */
#include <vcl/OpenGLContext.hxx> #include <vcl/OpenGLContext.hxx>
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
using namespace com::sun::star; using namespace com::sun::star;
...@@ -119,9 +120,10 @@ int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ ) ...@@ -119,9 +120,10 @@ int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ )
} }
} }
#endif #endif
bool OpenGLContext::init(OpenGLRender& rGLRender) bool OpenGLContext::init()
{ {
m_pWindow.reset(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL)); m_pWindow.reset(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL));
SAL_INFO("vcl.opengl", "OpenGLContext::OpenGLContext----start"); SAL_INFO("vcl.opengl", "OpenGLContext::OpenGLContext----start");
...@@ -233,7 +235,7 @@ bool OpenGLContext::init(OpenGLRender& rGLRender) ...@@ -233,7 +235,7 @@ bool OpenGLContext::init(OpenGLRender& rGLRender)
#endif #endif
rGLRender.InitOpenGL(m_aGLWin); //rGLRender.InitOpenGL(m_aGLWin);
#ifdef DBG_UTIL #ifdef DBG_UTIL
// only enable debug output in dbgutil build // only enable debug output in dbgutil build
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment