Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
if application xcode doesn't build, then remove all files *.cpp and *.h and add just application.cpp and application.h to the project. (sorry, may i forget to remove them) 2008/2/11, Adrian Egli OpenSceneGraph (3D) [EMAIL PROTECTED]: Hi Stephan, i played arround friday with a small safari osg plugin and did some small changes in the graphics window files for carbon. may you check out this two files and extract my safari_osg.tar.gz file. then you should be able to build them with xcode. first application, second the plugin, and third have a look into the test.sh and the *.html files. it sould work. there is no keyboard, nor mouse event. but if you right-click onto the menu bar of safari (links) or into the html page with the mouse, a context menu apprears, then press 'w' or 's' and you see that the events are transfert to the plugin, strange, or is something really wrong with safari or my plugin or carbon or .. . . /adegli 2008/2/8, Stephan Maximilian Huber [EMAIL PROTECTED]: Hi Adrian, Adrian Egli OpenSceneGraph (3D) schrieb: may i do something wrong, or the osgViewer for Carbon is not right, i don't know. The result should looking like Bild 3. the Bild 1 and Bild 2 are wrong, or current state of the integration. (Bild 1 : osg default when window not moved, Bild 2 after bild moved) I am not sure if your usage-scenario is currently doable with GraphicsWindowCarbon. You want to attach a HIView (or what it is called in Carbon) , which is part of a window to the osgViewer::Viewer. GraphicWindowCarbon owns whole windows, it takes all the place, it eats all the events, so other ui-items get lost. It is not designed to handle only a view. The current implementation of GraphicsWindowCarbon does not process any events, if it gets a foreign window. If you want to install the eventhandlers, with a foreign window, set m_windowData-setInstallEventHandler(true); This may not work for your settings, because GraphicsWindowCarbon installs several event handlers to catch Application-Quit etc. Perhaps it is the best way to implement your own native GraphicsContext-implementation for the plugin-usage or use a GraphicsWindowEmbedded and do the handling of the AGLContext yourself. Hope that helps, Stephan (P.S. I am attaching a working example using an external window with GraphicsWindowCarbon) // // main.c // cefixTemplate // // Created by Stephan Huber on 26.11.06. // Copyright __MyCompanyName__ 2006. All rights reserved. // #include osgViewer/api/Carbon/GraphicsWindowCarbon #include osgViewer/Viewer #include osg/ShapeDrawable int main(int argc, char* argv[]) { // create the window: Rect titleRect = {100,100, 600, 800}; OSStatus err = 0; WindowRef windowPtr; WindowAttributes attr = (kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute) ~kWindowResizableAttribute; err = CreateNewWindow(kDocumentWindowClass, attr, titleRect, windowPtr); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; // Init the Windata Variable that holds the handle for the Window to display OSG in. osg::ref_ptrosgViewer::GraphicsWindowCarbon::WindowData m_windowData = new osgViewer::GraphicsWindowCarbon::WindowData(windowPtr); m_windowData-setInstallEventHandler(true); // Setup the traits parameters traits-x = titleRect.left; traits-y = titleRect.top; traits-width = abs(titleRect.right - titleRect.left); traits-height = abs(titleRect.bottom - titleRect.top); osg::notify(osg::ALWAYS) SIZE= traits-width x traits-height std::endl; traits-windowDecoration = false; traits-doubleBuffer = true; traits-sharedContext = NULL; traits-setInheritedWindowPixelFormat = false;//true; traits-inheritedWindowData = m_windowData.get(); // Create the Graphics Context osg::GraphicsContext* gc = osg::GraphicsContext::createGraphicsContext(traits.get()); // Init a new Camera (Master for this View) osg::Camera* camera = new osg::Camera; // Assign Graphics Context to the Camera camera-setGraphicsContext(gc); // Set the viewport for the Camera camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); // Add the Camera to the Viewer osg::ref_ptrosgViewer::Viewer m_osg_simple_viewer = new osgViewer::Viewer(); m_osg_simple_viewer-addSlave(camera); m_osg_simple_viewer-setCamera(camera); osg::Group* g = new osg::Group(); osg::Geode* geode = new osg::Geode(); geode-addDrawable(new osg::ShapeDrawable(new osg::Box()));
Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
Hi Adrian, Adrian Egli OpenSceneGraph (3D) schrieb: may i do something wrong, or the osgViewer for Carbon is not right, i don't know. The result should looking like Bild 3. the Bild 1 and Bild 2 are wrong, or current state of the integration. (Bild 1 : osg default when window not moved, Bild 2 after bild moved) I am not sure if your usage-scenario is currently doable with GraphicsWindowCarbon. You want to attach a HIView (or what it is called in Carbon) , which is part of a window to the osgViewer::Viewer. GraphicWindowCarbon owns whole windows, it takes all the place, it eats all the events, so other ui-items get lost. It is not designed to handle only a view. The current implementation of GraphicsWindowCarbon does not process any events, if it gets a foreign window. If you want to install the eventhandlers, with a foreign window, set m_windowData-setInstallEventHandler(true); This may not work for your settings, because GraphicsWindowCarbon installs several event handlers to catch Application-Quit etc. Perhaps it is the best way to implement your own native GraphicsContext-implementation for the plugin-usage or use a GraphicsWindowEmbedded and do the handling of the AGLContext yourself. Hope that helps, Stephan (P.S. I am attaching a working example using an external window with GraphicsWindowCarbon) // // main.c // cefixTemplate // // Created by Stephan Huber on 26.11.06. // Copyright __MyCompanyName__ 2006. All rights reserved. // #include osgViewer/api/Carbon/GraphicsWindowCarbon #include osgViewer/Viewer #include osg/ShapeDrawable int main(int argc, char* argv[]) { // create the window: Rect titleRect = {100,100, 600, 800}; OSStatus err = 0; WindowRef windowPtr; WindowAttributes attr = (kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute) ~kWindowResizableAttribute; err = CreateNewWindow(kDocumentWindowClass, attr, titleRect, windowPtr); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; // Init the Windata Variable that holds the handle for the Window to display OSG in. osg::ref_ptrosgViewer::GraphicsWindowCarbon::WindowData m_windowData = new osgViewer::GraphicsWindowCarbon::WindowData(windowPtr); m_windowData-setInstallEventHandler(true); // Setup the traits parameters traits-x = titleRect.left; traits-y = titleRect.top; traits-width = abs(titleRect.right - titleRect.left); traits-height = abs(titleRect.bottom - titleRect.top); osg::notify(osg::ALWAYS) SIZE= traits-width x traits-height std::endl; traits-windowDecoration = false; traits-doubleBuffer = true; traits-sharedContext = NULL; traits-setInheritedWindowPixelFormat = false;//true; traits-inheritedWindowData = m_windowData.get(); // Create the Graphics Context osg::GraphicsContext* gc = osg::GraphicsContext::createGraphicsContext(traits.get()); // Init a new Camera (Master for this View) osg::Camera* camera = new osg::Camera; // Assign Graphics Context to the Camera camera-setGraphicsContext(gc); // Set the viewport for the Camera camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); // Add the Camera to the Viewer osg::ref_ptrosgViewer::Viewer m_osg_simple_viewer = new osgViewer::Viewer(); m_osg_simple_viewer-addSlave(camera); m_osg_simple_viewer-setCamera(camera); osg::Group* g = new osg::Group(); osg::Geode* geode = new osg::Geode(); geode-addDrawable(new osg::ShapeDrawable(new osg::Box())); g-addChild(geode); m_osg_simple_viewer-setSceneData(geode); m_osg_simple_viewer-realize(); m_osg_simple_viewer-run(); return 0; } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
ok, it seams that i should retest it myself. but the problem is that i don't have much knowledge on OS/X. it doesn't attach the osgViewer into the context / window rect of the WindowRef is pointing to. / 2008/2/6, Stephan Huber [EMAIL PROTECTED]: Adrian Egli OpenSceneGraph (3D) schrieb: is there a carbon (safari plugin) demo / example for osg viewer integration into carbon like viewer mfc afaik no. What are the requirements? With the current implementation you can pass your own WindowRef and/or disable the registering of the EventCallbacks. See GraphicsWindowCarbon::WindowData. But this codepath is not well tested. cheers, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
Adrian Egli OpenSceneGraph (3D) schrieb: ok, it seams that i should retest it myself. but the problem is that i don't have much knowledge on OS/X. it doesn't attach the osgViewer into the context / window rect of the WindowRef is pointing to. I did some minor tests while implementing GraphicsWindowCarbon, and attaching a graphicsContext to an existing window did work, but perhaps it got broken. Do you have a small example which shows the error? cheers, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
Hi Stephan, i will test it tomorrow, today i did some short test, it's hard to say whats going wrong. may tomorrow i will be able to say more. /adegli 2008/2/6, Stephan Maximilian Huber [EMAIL PROTECTED]: Adrian Egli OpenSceneGraph (3D) schrieb: ok, it seams that i should retest it myself. but the problem is that i don't have much knowledge on OS/X. it doesn't attach the osgViewer into the context / window rect of the WindowRef is pointing to. I did some minor tests while implementing GraphicsWindowCarbon, and attaching a graphicsContext to an existing window did work, but perhaps it got broken. Do you have a small example which shows the error? cheers, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Looking for CARBON integration example, like osgviewerMFC
hi all is there a carbon (safari plugin) demo / example for osg viewer integration into carbon like viewer mfc /adegli -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org