Kaydet (Commit) 26cb65db authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Make the OpenGL stuff in chart2 compile for OS X (but definitely won't work)

Change-Id: I487fcd12bf90e8ce2c05743244858f7b5145c355
üst b6ba651f
...@@ -222,7 +222,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ ...@@ -222,7 +222,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
canvastools \ canvastools \
chartcore \ chartcore \
chartcontroller \ chartcontroller \
$(if $(filter LINUX FREEBSD WNT,$(OS)),chartopengl) \ $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)),chartopengl) \
$(if $(filter $(OS),WNT),,cmdmail) \ $(if $(filter $(OS),WNT),,cmdmail) \
cppcanvas \ cppcanvas \
configmgr \ configmgr \
......
...@@ -62,6 +62,10 @@ $(eval $(call gb_Library_use_system_win32_libs,chartopengl,\ ...@@ -62,6 +62,10 @@ $(eval $(call gb_Library_use_system_win32_libs,chartopengl,\
gdi32 \ gdi32 \
glu32 \ glu32 \
)) ))
else ifeq ($(OS),MACOSX)
$(eval $(call gb_Library_use_system_darwin_frameworks,chartopengl,\
OpenGL \
))
else ifeq ($(OS),LINUX) else ifeq ($(OS),LINUX)
$(eval $(call gb_Library_add_libs,chartopengl,\ $(eval $(call gb_Library_add_libs,chartopengl,\
-ldl \ -ldl \
......
...@@ -12,7 +12,7 @@ $(eval $(call gb_Module_Module,chart2)) ...@@ -12,7 +12,7 @@ $(eval $(call gb_Module_Module,chart2))
$(eval $(call gb_Module_add_targets,chart2,\ $(eval $(call gb_Module_add_targets,chart2,\
Library_chartcontroller \ Library_chartcontroller \
Library_chartcore \ Library_chartcore \
$(if $(filter LINUX FREEBSD WNT,$(OS)), \ $(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \
Library_chartopengl \ Library_chartopengl \
Package_opengl \ Package_opengl \
) \ ) \
......
...@@ -61,8 +61,14 @@ ...@@ -61,8 +61,14 @@
#include <map> #include <map>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#if defined( MACOSX )
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#endif
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <vcl/syschild.hxx> #include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx> #include <vcl/sysdata.hxx>
...@@ -72,9 +78,6 @@ ...@@ -72,9 +78,6 @@
#include <GL/glext.h> #include <GL/glext.h>
#include <GL/wglext.h> #include <GL/wglext.h>
#elif defined( MACOSX ) #elif defined( MACOSX )
#include "premac.h"
#include <Cocoa/Cocoa.h>
#include "postmac.h"
#elif defined( UNX ) #elif defined( UNX )
#include <GL/glu.h> #include <GL/glu.h>
#include <GL/glext.h> #include <GL/glext.h>
......
...@@ -947,6 +947,13 @@ bool DummyChart::initWindow() ...@@ -947,6 +947,13 @@ bool DummyChart::initWindow()
return true; return true;
} }
#elif defined( MACOSX )
bool DummyChart::initWindow()
{
return false;
}
#elif defined( UNX ) #elif defined( UNX )
namespace { namespace {
...@@ -1085,6 +1092,8 @@ bool DummyChart::initOpengl() ...@@ -1085,6 +1092,8 @@ bool DummyChart::initOpengl()
#if defined( WNT ) #if defined( WNT )
GLWin.hDC = GetDC(GLWin.hWnd); GLWin.hDC = GetDC(GLWin.hWnd);
#elif defined( MACOSX )
#elif defined( UNX ) #elif defined( UNX )
GLWin.ctx = glXCreateContext(GLWin.dpy, GLWin.ctx = glXCreateContext(GLWin.dpy,
GLWin.vi, GLWin.vi,
...@@ -1135,6 +1144,8 @@ bool DummyChart::initOpengl() ...@@ -1135,6 +1144,8 @@ bool DummyChart::initOpengl()
GLWin.hRC = wglCreateContext(GLWin.hDC); GLWin.hRC = wglCreateContext(GLWin.hDC);
wglMakeCurrent(GLWin.hDC,GLWin.hRC); wglMakeCurrent(GLWin.hDC,GLWin.hRC);
#elif defined( MACOSX )
#elif defined( UNX ) #elif defined( UNX )
if( !glXMakeCurrent( GLWin.dpy, GLWin.win, GLWin.ctx ) ) if( !glXMakeCurrent( GLWin.dpy, GLWin.win, GLWin.ctx ) )
{ {
...@@ -1195,6 +1206,8 @@ bool DummyChart::initOpengl() ...@@ -1195,6 +1206,8 @@ bool DummyChart::initOpengl()
#if defined( WNT ) #if defined( WNT )
SwapBuffers(GLWin.hDC); SwapBuffers(GLWin.hDC);
glFlush(); glFlush();
#elif defined( MACOSX )
#elif defined( UNX ) #elif defined( UNX )
glXSwapBuffers(GLWin.dpy, GLWin.win); glXSwapBuffers(GLWin.dpy, GLWin.win);
#endif #endif
......
...@@ -424,6 +424,8 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow) ...@@ -424,6 +424,8 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
#if defined( WNT ) #if defined( WNT )
SwapBuffers(glWin.hDC); SwapBuffers(glWin.hDC);
#elif defined( MACOSX )
#elif defined( UNX ) #elif defined( UNX )
glXSwapBuffers(glWin.dpy, glWin.win); glXSwapBuffers(glWin.dpy, glWin.win);
#endif #endif
...@@ -663,6 +665,8 @@ void OpenGLRender::renderToBitmap() ...@@ -663,6 +665,8 @@ void OpenGLRender::renderToBitmap()
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
#if defined( WNT ) #if defined( WNT )
SwapBuffers(glWin.hDC); SwapBuffers(glWin.hDC);
#elif defined( MACOSX )
#elif defined( UNX ) #elif defined( UNX )
glXSwapBuffers(glWin.dpy, glWin.win); glXSwapBuffers(glWin.dpy, glWin.win);
#endif #endif
...@@ -745,6 +749,8 @@ int OpenGLRender::RenderTexture(GLuint TexID) ...@@ -745,6 +749,8 @@ int OpenGLRender::RenderTexture(GLuint TexID)
glUseProgram(0); glUseProgram(0);
#if defined( WNT ) #if defined( WNT )
SwapBuffers(glWin.hDC); SwapBuffers(glWin.hDC);
#elif defined( MACOSX )
#elif defined( UNX ) #elif defined( UNX )
glXSwapBuffers(glWin.dpy, glWin.win); glXSwapBuffers(glWin.dpy, glWin.win);
#endif #endif
...@@ -826,6 +832,8 @@ void OpenGLRender::Release() ...@@ -826,6 +832,8 @@ void OpenGLRender::Release()
glDeleteRenderbuffers(1, &m_RboID); glDeleteRenderbuffers(1, &m_RboID);
#if defined( WNT ) #if defined( WNT )
wglMakeCurrent(NULL, NULL); wglMakeCurrent(NULL, NULL);
#elif defined( MACOSX )
#elif defined( UNX ) #elif defined( UNX )
glXMakeCurrent(glWin.dpy, None, NULL); glXMakeCurrent(glWin.dpy, None, NULL);
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include <vcl/font.hxx> #include <vcl/font.hxx>
#if defined( UNX ) #if defined( MACOSX )
#elif defined( UNX )
#include <prex.h> #include <prex.h>
#include "GL/glxew.h" #include "GL/glxew.h"
#include <postx.h> #include <postx.h>
...@@ -22,9 +23,14 @@ ...@@ -22,9 +23,14 @@
#include "postwin.h" #include "postwin.h"
#endif #endif
#if defined( MACOSX )
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#endif
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <vcl/syschild.hxx> #include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx> #include <vcl/sysdata.hxx>
...@@ -36,9 +42,6 @@ ...@@ -36,9 +42,6 @@
#include <GL/glext.h> #include <GL/glext.h>
#include <GL/wglext.h> #include <GL/wglext.h>
#elif defined( MACOSX ) #elif defined( MACOSX )
#include "premac.h"
#include <Cocoa/Cocoa.h>
#include "postmac.h"
#elif defined( UNX ) #elif defined( UNX )
#include <GL/glu.h> #include <GL/glu.h>
......
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