A few of the newer OSG components explicitly reference osgViewer::GraphicsWindowCocoa in their code. This causes link errors when compiling OSG on MacOS with OSG_WINDOWING_SYSTEM set to X11.

The affected components are: avfoundation (osgdb), osgmultitouch (examples), osgoscdevice (examples). Currently the only check done in their CMake scripts is IF(APPLE), which implicitly assumes that everyone on Mac is building Cocoa.

One simple fix is to add a check at the beginning of the affected components' CMakeLists.txt files. e.g.:

Code:

IF(NOT (OSG_WINDOWING_SYSTEM STREQUAL "Cocoa"))
RETURN()
ENDIF()

This will only build that component if the windowing system is Cocoa.

I see this build problem with the 3.4.0 stable download, as well as the latest Git source.

I realized that the OpenGL link dependencies for OSG are not quite correct for OSX/X11. Specifically, if OSG_WINDOWING_SYSTEM is X11 then osgViewer is built with X11/OpenGL, but osg (base) is still built with Cocoa/OpenGL. This mismatch of OpenGL implementations can cause very unexpected runtime errors for 3rd-party apps that use OSG on OSX/X11.

An example of this happens when running "osgviewer cow.osg" with an OSX/X11 build; the viewer starts in fullscreen. As things are now, if you press "f", it goes into windowed mode but the window is black. With the proposed change, everything works as expected.

My proposed change is to move the OSX/X11-specific OpenGL link code from osgViewer/CMakeLists.txt to the root CMakeLists.txt. I've done this, and am testing it out now. I'll post the git patch to osg-submissions soon.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou cannot download files in this forum