HI,

have you tried the cmake-setting  OSG_BUILD_APPLICATION_BUNDLES? Haven’t tried 
this, as for me all example apps run from within xcode when compiling for debug 
and setting the osgPlugins-folder correctly.

OS X is a hard to track development platform as it changes a lot over the 
years. Basically every year you’ll get a new version of xcode, new APIs, new 
blablabla. The os x offers so many options in regard of development: do you 
want to use frameworks, or dylibs, do you want to bundle it with your app or 
just install it to the usual locations? 32bit, 64bit? Two years ago there was 
even Carbon around the corner. And now IOS-development. Hand-maintaining the 
xcode-project files were error-prone and a mess. Cmake is not perfect but when 
setup correctly delivers xcode-project-files which work for iOS and OS X.

There are different ways to integrate osg with an existing os-x app. One 
approach is using an GraphicsWindowEmbedded and do the context-setup by 
yourself. 

Another approach is to setup a osgViewer::GraphicsWindowCocoa::WindowData and 
feed it into osg::GraphicsContext::Traits-object and create an 
osg::GraphicsContext manually. After the viewer is realized you can get back 
the created view via osgViewer::GraphicsWindowCocoa::WindowData:: 
getCreatedNSView or [osgVIewer:: GraphicsWindowCocoa::getContext() view]

I haven’t tried the osgViewerCocoa-example in years and can’t speak for it.

cheers,

Stephan


Am 11.11.2013 um 01:31 schrieb Ronald Aldrich <[email protected]>:

> Thanks, Robert - I'll check that out.
> 
> I'm wondering if there's a simple example application for cocoa, which 
> actually compiles and runs.  So far, I've gotten osgviewercocoa to compile 
> and link, but it doesn't run because it's not being packaged as an 
> application.
> 
> I've gotten my own program to display an OSG window, with a lovely blue 
> background, but adding scene data to it doesn't seem to do anything, so I 
> find myself looking for a better starting point.
> 
> It all feels like OSG has taken a huge step backward from where it was 
> several years ago when I first experimented with it, at least with regard to 
> Mac.  Back when, there were xcode project files which allowed you to build a 
> complete sample application and run it - now, you get tossed into a morass of 
> CMake settings, and spend a lot of time exploring dead ends and configuration 
> mistakes before you get anything at all to work.
> 
> - Ron
> 
> On Nov 10, 2013, at 1:39 AM, Robert Osfield <[email protected]> wrote:
> 
>> Hi Ron,
>> 
>> Apple keep moving the goal posts on their platform so it's a case of keep 
>> trying to catch up with whatever the new flavour of the month is.  In OSG 
>> svn/trunk I have checked in a submissions that allows one toggle which libs 
>> to link against, look out for the OSG_CXX_LANGUAGE_STANDARD option, set it 
>> to either C++98 or C++11.
>> 
>> Robert.
>> 
>> 
>> On 9 November 2013 19:25, Ronald Aldrich <[email protected]> wrote:
>> It appears that the issue is that OpenSceneGraph is linked against 
>> libstdc++, while my application was being linked against libc++.
>> 
>> According to the documentation for libc++ ( http://libcxx.llvm.org ), the 
>> two are not ABI compatible, and with the amount of inline code used in 
>> OpenSceneGraph, it's not surprising that the two don't co-exist.
>> 
>> Linking my application against libstdc++ stopped it from crashing, which 
>> should solve the issue for now, but I'd really like to be using libc++ 
>> instead, because it brings C++11 compatibility as well as performance 
>> improvements.
>> 
>> So, what would it take to configure OpenSceneGraph's build environment to 
>> link against libc++, rather than libstdc++?
>> 
>> - Ron
>> 
>> On Nov 8, 2013, at 10:37 PM, Ronald Aldrich <[email protected]> wrote:
>> 
>>> Hello All,
>>> 
>>> I'm new to OpenSceneGraph, so please bear with me.
>>> 
>>> I'm attempting to write a Mac OS X native (cocoa) application that uses 
>>> OpenSceneGraph, and I'm having some difficulty.
>>> 
>>> I created an XCode project to build OpenSceneGraph as a set of frameworks 
>>> (Using CMake), and I think I was mostly successful at that.
>>> 
>>> Now, I'm trying to use those frameworks within my own application, and 
>>> having some difficulty.
>>> 
>>> I've created a class (OSGView) along the lines of the OSGViewerCocoa 
>>> OSGViewer class - simplified, and modified for ARC.  That class doesn't 
>>> populate the scene data, and when the application runs,  a view filled with 
>>> blue is displayed - so good, so far.
>>> 
>>> Next, I tried to create a triangle mesh to populate the scene data with, 
>>> and that's where my problem occurs - when one of the array objects I 
>>> created is deleted, the application crashes.
>>> 
>>> I can simplify the problem down to the following:
>>> 
>>> - (void) test
>>> {
>>>     osg::ref_ptr<osg::Vec3Array> theVertices = new osg::Vec3Array(0);
>>> }
>>> 
>>> When the Vec3Array is deleted, it crashes at the end of Object::~Object(), 
>>> with the code
>>> 
>>> Thread 1: EXC_BAD_ACCESS (code=1, address= 0xfffffffffffffff8)
>>> 
>>> I then thought I'd go back to basics, and build the OSGViewerCocoa example, 
>>> to see how it works, but when I build it, all I get is a unix executable 
>>> (OSGViewerCocoad), which doesn't run because it isn't assembled as a 
>>> complete Mac application.
>>> 
>>> I suspect that the problem I'm having is caused by a mix of build 
>>> environments - CMake for OpenSceneGraph, and XCode (LLVM) for my 
>>> application, but I've got no idea how to resolve that since CMake doesn't 
>>> appear to be able to create complete applications.
>>> 
>>> So, does anyone have a suggestion?
>>> 
>>> TIA,
>>> 
>>> Ron Aldrich
>>> 
>>> _______________________________________________
>>> osg-users mailing list
>>> [email protected]
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> 
>> 
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> 
>> 
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to