Re: [osg-users] SDL osgViewer
Hi Zoltan, I have used SDL for joytstick support in OSG for a number of years - one can simply set SDL to poll for the events and let the osgViewer create all windows. Present3D is an example of this in action. In your own app you could probably just do all mouse, keyboard and joystick handling in your own code, polling for events on each new frame. If you want to reuse the osgGA event handlers/camera manipulators then you'll need to adapt the events into osgGA ones, the osgviewerSDL example will show you how to do this. If you don't need the off the shelf event support you just just have you own event handling and set the master camera's view matrix on each new frame as required. Robert. On Tue, May 6, 2008 at 11:34 AM, Zoltán [EMAIL PROTECTED] wrote: Hello, I have an OSG application that uses joysticks, and I use SDL for those. But I also need a mouse and keyboard and use (today) OSG for that. Sometimes it's a bit messy to do this, because when there is no joystick connected I fall back to the mouse, and the interface is very different (one is a SDL_JOYSTICk and the other an osgEventHandler). I'd like to handle mouse and joystick from the same interface, so either make both of them through SDL or both of them an osgEventHandler. Wouldn't it be more coherent to use SDL for all input ? But then, I need to create the window with SDL, and embed the osgViewer inside this window. Is this a reliable way to do things ? Because if I create the window with OSG, SDL doesn't see the mouse and keyboard. Or, is there a way to make an osgEventHandler from a SDL_JOYSTICK interface ? There is an osgviewerSDL in the examples (v2.3.4) but this is for an embedded OSG viewer inside an SDL window... would those work with a joystick ? Any suggestions ? cheers Zoltán PS: the application in question is a flight simulator: http://sourceforge.net/projects/zsim -- Zoltan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] SDL osgViewer
Hello, I have an OSG application that uses joysticks, and I use SDL for those. But I also need a mouse and keyboard and use (today) OSG for that. Sometimes it's a bit messy to do this, because when there is no joystick connected I fall back to the mouse, and the interface is very different (one is a SDL_JOYSTICk and the other an osgEventHandler). I'd like to handle mouse and joystick from the same interface, so either make both of them through SDL or both of them an osgEventHandler. Wouldn't it be more coherent to use SDL for all input ? But then, I need to create the window with SDL, and embed the osgViewer inside this window. Is this a reliable way to do things ? Because if I create the window with OSG, SDL doesn't see the mouse and keyboard. Or, is there a way to make an osgEventHandler from a SDL_JOYSTICK interface ? There is an osgviewerSDL in the examples (v2.3.4) but this is for an embedded OSG viewer inside an SDL window... would those work with a joystick ? Any suggestions ? cheers Zoltán PS: the application in question is a flight simulator: http://sourceforge.net/projects/zsim -- Zoltan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] SDL osgViewer
I've made some research (should have begin with that ?) and apparently while it would be possible to have SDL handle the window and inputs, and OSG do only the rendering, this is not advisable: Personally I wouldn't recommend SDL for windowing for serious 3d graphics applications, its just way too limiting - its really just designed for single threaded, single context apps. http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2007-August/000558.html That was in August 2007: is it still the situation today ? Another way to do it is just use SDL for joysticks, and use the standard osgViewer's support for native windowing. http://www.mail-archive.com/[EMAIL PROTECTED]/msg12744.html That's what I do today. But it's conceptually un-nice. Any suggestions ? bye Zoltán Zoltán wrote on Tuesday 06 May 2008: I have an OSG application that uses joysticks, and I use SDL for those. But I also need a mouse and keyboard and use (today) OSG for that. Sometimes it's a bit messy to do this, because when there is no joystick connected I fall back to the mouse, and the interface is very different (one is a SDL_JOYSTICk and the other an osgEventHandler). I'd like to handle mouse and joystick from the same interface, so either make both of them through SDL or both of them an osgEventHandler. Wouldn't it be more coherent to use SDL for all input ? But then, I need to create the window with SDL, and embed the osgViewer inside this window. Is this a reliable way to do things ? Because if I create the window with OSG, SDL doesn't see the mouse and keyboard. Or, is there a way to make an osgEventHandler from a SDL_JOYSTICK interface ? There is an osgviewerSDL in the examples (v2.3.4) but this is for an embedded OSG viewer inside an SDL window... would those work with a joystick ? Any suggestions ? cheers Zoltán PS: the application in question is a flight simulator: http://sourceforge.net/projects/zsim -- Zoltan http://sourceforge.net/projects/zsim ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] SDL osgViewer
Zoltán schrieb: Or, is there a way to make an osgEventHandler from a SDL_JOYSTICK interface ? There is an osgviewerSDL in the examples (v2.3.4) but this is for an embedded OSG viewer inside an SDL window... would those work with a joystick ? You can subclass from osgGA::GUIEventAdapter and add your joistick-data to it and feed it to the current event queue. In your eventhandler you can dynamic_cast to your subclassed Event-Adapter and read the joystick-data and handle it accordingly. I am using this technique to feed the events from a SpaceNavigaor to a custom event-handler. Or you encapsulate you joystick-data into a custom class and attach via setUserData to a GuiEventAdapter and push it with type USER to the eventqueue, and handling it in your event-handler. You can even mimick a mouse by feeding the event-queue with fake mouse-events from your joystick-data. HTH, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] SDL osgViewer
You can do along the lines of what Delta3D has done, by using http://plib.sourceforge.net/ as a source of your data and interfacing it into OSGGA. On Tue, May 6, 2008 at 12:10 PM, Stephan Maximilian Huber [EMAIL PROTECTED] wrote: Zoltán schrieb: Or, is there a way to make an osgEventHandler from a SDL_JOYSTICK interface ? There is an osgviewerSDL in the examples (v2.3.4) but this is for an embedded OSG viewer inside an SDL window... would those work with a joystick ? You can subclass from osgGA::GUIEventAdapter and add your joistick-data to it and feed it to the current event queue. In your eventhandler you can dynamic_cast to your subclassed Event-Adapter and read the joystick-data and handle it accordingly. I am using this technique to feed the events from a SpaceNavigaor to a custom event-handler. Or you encapsulate you joystick-data into a custom class and attach via setUserData to a GuiEventAdapter and push it with type USER to the eventqueue, and handling it in your event-handler. You can even mimick a mouse by feeding the event-queue with fake mouse-events from your joystick-data. HTH, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- It is only necessary to make war with five things: with the maladies of the body, with the ignorances of the mind, with the passions of the body, with the seditions of the city, with the discords of families. - Tacitus The desire for safety stands against every great and noble enterprise. - Tacitus Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety. - Benjamin Franklin Numquam ponenda est pluralitas sine necessitate. - William of Ockham ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org