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