Re: [osg-users] [3rdparty] OSG and SDL

2010-09-29 Thread Robert Osfield
Hi Matt,

I'd recommend using SDL for joystick input and osgViewer for windowing
as the later has far more flexible and powerful windowing and
threading support.  An example of mixing SDL for joystick input and
osgViewer for windowing can be found in the applications/present3D
application.

Robert.

On Tue, Sep 28, 2010 at 6:33 PM, Matt Caron mcindafi...@gmail.com wrote:
 Hi,

 I am using SDL to get input from a joystick so that I can integrate joystick 
 control in OSG (I have tried the VRPN approach and right now SDL is looking 
 better for my needs).

 I have searched for as much information about integrating OSG and SDL as 
 possible, and so far it appears that I must use SDL windows and have OSG draw 
 to SDL windows, instead of OSG using its own windowing system.

 Does anyone know if this assertion is accurate?  Is there any way to connect 
 SDL through an OSG Viewer?  All I care about are the input events associated 
 with the joystick...


 Thank you!

 Cheers,
 Matt

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=32147#32147





 ___
 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] [3rdparty] OSG and SDL

2010-09-28 Thread Matt Caron
Hi,

I am using SDL to get input from a joystick so that I can integrate joystick 
control in OSG (I have tried the VRPN approach and right now SDL is looking 
better for my needs).

I have searched for as much information about integrating OSG and SDL as 
possible, and so far it appears that I must use SDL windows and have OSG draw 
to SDL windows, instead of OSG using its own windowing system.

Does anyone know if this assertion is accurate?  Is there any way to connect 
SDL through an OSG Viewer?  All I care about are the input events associated 
with the joystick...


Thank you!

Cheers,
Matt

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32147#32147





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [3rdparty] OSG and SDL

2010-09-28 Thread Ben Cain
If you just want to use SDL to read joystick inputs, you don't have to
use SDL windows.  You can use SDL for joystick inputs, and render OGS
to windows managed by Qt, CEGUI, or whatever meets your needs.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [3rdparty] OSG and SDL

2010-09-28 Thread Matt Caron
Perhaps I just don't know enough about whats going on in my OSG build...but 
right now I can just instantiate and start a Viewer in OSG and it automatically 
opens a window and handles drawing for me.  Is there a way to go about using 
OSG this same way but to incorporate SDL?

Right now when I try to grab SDL events while also running an osgViewer, my 
main function just exits as if the osgViewer isn't blocking the thread.

My main function has the following code:


Code:

if( SDL_Init(SDL_INIT_JOYSTICK)  0)
{
std::cerr  unable to init SDL:   SDL_GetError()  '\n';

return false;
}else{
std::clog  Init'd Joystick :)  std::endl;
}

std::atexit(SDL_Quit);

if( SDL_NumJoysticks() == 0 )
{
std::cerr  no joysticks found\n;

return false;
}else{
std::clog  Found   SDL_NumJoysticks()   joysticks :) 
 std::endl  std::endl;
for(int i = 0; i  SDL_NumJoysticks(); ++i)
{
std::clog  Joystick   (i + 1)  :   
SDL_JoystickName(i)  std::endl  std::endl;
}
}

SDL_Joystick *joystick;

SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);

int running = true;
SDL_Event event;


std::clog  Left/Right axis:   SDL_JoystickGetAxis(joystick, 0)  
std::endl;
std::clog  Up/Down axis:   SDL_JoystickGetAxis(joystick, 1)  
std::endl;


// construct the viewer
osg::ref_ptrosgViewer::Viewer viewer = new osgViewer::Viewer;

// make the viewer create a 512x512 window and position it at 32, 32
viewer-setUpViewInWindow( 32, 32, 512, 512 );

// set the scene-graph data the viewer will render
viewer-setSceneData( CreateScene() );

// execute main loop
return viewer-run();




I'm just trying to initialize SDL, grab initial joystick data to prove I am 
connected to it, then start the osgViewer.  However, the OSG window never pops 
up...

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32151#32151





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org