Commit 797d1723 authored by Sylvain Thery's avatar Sylvain Thery

maj probleme compilation mac osX

parent 7d8cee23
...@@ -55,7 +55,7 @@ target_link_libraries( tp_master ...@@ -55,7 +55,7 @@ target_link_libraries( tp_master
add_executable( tuto_mt tuto_mt.cpp) add_executable( tuto_mt tuto_mt.cpp)
target_link_libraries( tuto_mt target_link_libraries( tuto_mt
container topology utils algo ${COMMON_LIBS} boost_thread) container topology utils algo ${COMMON_LIBS} boost_thread-mt)
add_executable( tuto_ogl3 tuto_ogl3.cpp) add_executable( tuto_ogl3 tuto_ogl3.cpp)
target_link_libraries( tuto_ogl3 target_link_libraries( tuto_ogl3
......
...@@ -8,7 +8,9 @@ SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/..) ...@@ -8,7 +8,9 @@ SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/..)
find_package(OpenGL) find_package(OpenGL)
find_package(GLUT) find_package(GLUT)
IF (APPLE)
SET(CMAKE_OSX_ARCHITECTURES x86_64)
ENDIF(APPLE)
#On Windows we use AntTweakBar/OpenCTM of dependencies, not compiled #On Windows we use AntTweakBar/OpenCTM of dependencies, not compiled
IF(WIN32) IF(WIN32)
SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib)#release added by visual SET(LIBRARY_OUTPUT_PATH ${CGoGN_ROOT_DIR}/lib)#release added by visual
......
...@@ -17,6 +17,8 @@ IF(APPLE) ...@@ -17,6 +17,8 @@ IF(APPLE)
# attention a changer pour chercher la bonne version automatiquement # attention a changer pour chercher la bonne version automatiquement
SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk") SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX")
SET(CMAKE_OSX_ARCHITECTURES x86_64)
ENDIF(APPLE) ENDIF(APPLE)
IF(WIN32) IF(WIN32)
......
...@@ -38,9 +38,14 @@ ...@@ -38,9 +38,14 @@
#include <GL/freeglut.h> #include <GL/freeglut.h>
#ifndef WIN32 #ifndef WIN32
#include <GL/glx.h> #ifdef MAC_OSX
#include <OpenGL/CGLCurrent.h>
#else
#include <GL/glx.h>
#endif
#endif #endif
#include "Utils/trackball.h" #include "Utils/trackball.h"
#include <IL/ilu.h> #include <IL/ilu.h>
#include <IL/ilut.h> #include <IL/ilut.h>
...@@ -142,13 +147,19 @@ protected: ...@@ -142,13 +147,19 @@ protected:
virtual void myMouseClick(int button, int state, int x, int y) {} virtual void myMouseClick(int button, int state, int x, int y) {}
#ifdef WIN32 #ifdef WIN32
HDC m_drawable; HDC m_drawable;
HGLRC m_context; HGLRC m_context;
#else #else
Display* m_dpy; #ifdef MAC_OSX
GLXDrawable m_drawable; CGLContextObj m_context;
GLXContext m_context; #else
Display* m_dpy;
GLXDrawable m_drawable;
GLXContext m_context;
#endif
#endif #endif
public: public:
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#ifndef MAC_OSX //#ifndef MAC_OSX
#include <stdlib.h> #include <stdlib.h>
...@@ -143,13 +143,18 @@ SimpleGlutWinGL3::SimpleGlutWinGL3(int* argc, char **argv, int winX, int winY) ...@@ -143,13 +143,18 @@ SimpleGlutWinGL3::SimpleGlutWinGL3(int* argc, char **argv, int winX, int winY)
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
//Store context infos //Store context infos
#ifdef WIN32 #ifdef WIN32
m_drawable = wglGetCurrentDC(); m_drawable = wglGetCurrentDC();
m_context = wglGetCurrentContext(); m_context = wglGetCurrentContext();
#else #else
m_dpy = glXGetCurrentDisplay(); #ifdef MAC_OSX
m_drawable = glXGetCurrentDrawable(); m_context = CGLGetCurrentContext();
m_context = glXGetCurrentContext(); #else
m_dpy = glXGetCurrentDisplay();
m_drawable = glXGetCurrentDrawable();
m_context = glXGetCurrentContext();
#endif
#endif #endif
// Call other initialization (possibly overloaded in instances) // Call other initialization (possibly overloaded in instances)
instance->init(); instance->init();
...@@ -237,12 +242,17 @@ void SimpleGlutWinGL3::setCurrentShader(Utils::GLSLShader* sh) ...@@ -237,12 +242,17 @@ void SimpleGlutWinGL3::setCurrentShader(Utils::GLSLShader* sh)
glutPostRedisplay(); glutPostRedisplay();
} }
void SimpleGlutWinGL3::releaseContext() void SimpleGlutWinGL3::releaseContext()
{ {
#ifdef WIN32 #ifdef WIN32
wglMakeCurrent(NULL,NULL); wglMakeCurrent(NULL,NULL);
#else #else
glXMakeCurrent(m_dpy,None,NULL); #ifdef MAC_OSX
CGLSetCurrentContext(NULL);
#else
glXMakeCurrent(m_dpy,None,NULL);
#endif
#endif #endif
} }
...@@ -251,13 +261,19 @@ void SimpleGlutWinGL3::useContext() ...@@ -251,13 +261,19 @@ void SimpleGlutWinGL3::useContext()
#ifdef WIN32 #ifdef WIN32
wglMakeCurrent(m_drawable, m_context); wglMakeCurrent(m_drawable, m_context);
#else #else
glXMakeCurrent(m_dpy, m_drawable, m_context); #ifdef MAC_OSX
CGLSetCurrentContext(m_context);
#else
glXMakeCurrent(m_dpy, m_drawable, m_context);
#endif
#endif #endif
} }
void SimpleGlutWinGL3::recalcModelView(void) void SimpleGlutWinGL3::recalcModelView(void)
{ {
glm::mat4 m; glm::mat4 m;
...@@ -503,4 +519,4 @@ GLfloat SimpleGlutWinGL3::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geo ...@@ -503,4 +519,4 @@ GLfloat SimpleGlutWinGL3::getOrthoScreenRay(int x, int y, Geom::Vec3f& rayA, Geo
} // namespace Utils } // namespace Utils
} // namespace CGoGN } // namespace CGoGN
#endif //#endif
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