Re: [osg-users] CompositeViewer and camera manipulator
Robert, I've changed the variable name - certainly not a functionality issue, but I understand the obvious confusion it could cause. I also used the Camera from the view and the minimap is now rendering correctly. So thank you for that advice. Can you tell me what difference using that Camera should make? I figured there would be no difference if I just set the Camera of the view with the hudCamera...but it appears there is a significant difference. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33998#33998 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CompositeViewer and camera manipulator
I have now refactored all my view-based code so it works with osgViewer::View's. Currently my main scene is working as it was before, including my HUD. However, the area I'm trying to use as a minimap is drawing itself light gray and I have no idea why. Here is the code I'm using to initialize the minimap: Before entering this block: - viewer is an osgViewer:View that has already been added to an osgViewer::CompositeView - scene is of type osg::Node* and references the same model as my main view...so scene refers to a valid scene and is non-null - the scene has been added to viewer Code: // create minimap camera osg::Camera* minimapCamera = new osg::Camera; // setup minimap view viewer-setUpViewAcrossAllScreens(); osgViewer::Viewer::Windows windows; viewer-getViewerBase()-getWindows(windows); minimapCamera-setGraphicsContext(windows[0]); // generate dimensions for minimap int winWidth = windows[0]-getTraits()-width; int winHeight = windows[0]-getTraits()-height; int displayWidth = (int)floor((float)(1920./1080 * 300)); int displayHeight = 300; // set dimensions for minimap minimapCamera-setViewport(winWidth - displayWidth - 20, 20, displayWidth, displayHeight); // set the scene for the camera minimapCamera-addChild(scene); // set the viewer's camera to the minimap camera viewer-setCamera(minimapCamera); Can anyone find anything wrong or missing from that code block? Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33958#33958 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CompositeViewer and camera manipulator
Ok, to use a View I have had to make some changes to my input system because I was extending Viewer and adding Joystick support to it. The final problem I seem to be having with extending View instead of Viewer is that the method elapsedTime() is not provided. Do you have any suggestions about how to work around this? I am generating GUIEventAdapter's with my Joystick information and they require a time - not to mention I'm using that time in the camera manipulator. Unfortunately I really do not know anything about how the timing system in OSG works - so even if I need to re-implement that method myself, I'm not sure how to do it. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33877#33877 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CompositeViewer and camera manipulator
Greetings, I have decided to switch the viewer in my application from a Viewer to a CompositeViewer - currently I have instantiated a CompositeViewer and added the normal Viewer to it that was previously being used for my entire scene. However, my custom CameraManipulator is no longer changing the camera in my Viewer. Does CompositeViewer override the CameraManipulators of the sub-views added to it? If so, how do I prevent this? Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33811#33811 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 3D GUI Icon
Greetings, I'd like to create a 3D icon (in the shape of an arrow, or a plane) that sits in the lower left corner of the screen and shows the user the current orientation of the camera. I should be able to handle the dynamics of orienting the icon, but I'm wondering, is this something that should use some 3D GUI framework to accomplish? or is there a way to tell an OSG camera to always render this icon in the corner of the screen, never let any other object get between the icon and the camera, and never move the icon? Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33635#33635 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] 3D GUI Icon
I found a solution for this task using a HUD: http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/HudsAndText Although I do still have an issue. I am using the Cessna.osg model in the HUD but when I do Code: myPlaneTrans-setStateSet(hudStateSet); hudStateSet-setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); many of the triangles in the Cessna model are not rendered, or are rendered black. Unfortunately if I don't use that setMode() method, the Cessna sometimes appears behind other objects - so it seems I really need GL_DEPTH_TEST off, but I don't know why the Cessna mesh is being rendered incorrectly. Thanks. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33637#33637 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] DotScene In OSG
Greetings, Does anyone know if there is currently an OSG reader for the XML .scene format? I'm looking for a simple human readable file format for generating a scene, so if there is a good alternative available for OSG that would be fine as well, but at the moment .scene is looking good. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33398#33398 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] DotScene In OSG
The OSG format appears to hold model and texture data. I'm looking for a file format which is used exclusively for placing and orienting models in a scene. For example I could do something like this: model src=myModel.3DS loc x=A y=B z=C / orient xAngle=A2 yAngle=B2 zAngle=C2 / /model This way I can reference models of many different formats and position them in a uniform manner. Plus, I don't have to work around the hundreds or thousands of vertices that would otherwise appear in the file. The .scene format provides this ability which is why I was wondering if someone had created a reader for that file type. If not, and if there is no direct competitor in the OSG reader system, then I might just go ahead and write a reader for .scene files to make this possible. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33402#33402 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [3rdparty] osgAudio Sound Position
Greetings, I am trying to hack together the simplest example possible of sound intensity changing by distance from the sound source with osgAudio. From the example source code I have hacked together the following commands: Code: osgAudio::SoundManager::instance()-init(32); osgAudio::SoundManager::instance()-getEnvironment()-setGain(0.5); osgAudio::SoundManager::instance()-getEnvironment()-setDistanceModel(osgAudio::InverseDistance); osgAudio::SoundManager::instance()-getEnvironment()-setDopplerFactor(1); osgAudio::SoundState *musicSoundState;// = osgAudio::SoundManager::instance()-findSoundState(music); musicSoundState = new osgAudio::SoundState(music); // ALlocate a hw source so we can loop it musicSoundState-allocateSource( 10 ); // Create a new filestream that streams samples from a ogg-file. osgAudio::FileStream *musicStream = new osgAudio::FileStream(FILEPATH/44100_1chan.ogg); // Associate the stream with the sound state musicSoundState-setStream( musicStream ); // Loop the sound forever musicSoundState-setLooping( true ); musicSoundState-setRelative(true); musicSoundState-setPosition(osg::Vec3(0,0,0)); musicSoundState-setReferenceDistance(10); musicSoundState-setRolloffFactor(1); // Start playing the music! musicSoundState-setPlay( true ); // Add the soundstate to the sound manager so we can find it later on. osgAudio::SoundManager::instance()-addSoundState( musicSoundState ); //} osgAudio::SoundNode *sound_node = new osgAudio::SoundNode; sound_node-setSoundState(musicSoundState); root-addChild(sound_node); Then later I have Code: osg::ref_ptrosgAudio::SoundRoot sound_root = new osgAudio::SoundRoot; viewer-setCameraManipulator(new TrackballManipulator()); sound_root-setCamera( viewer-getCamera() ); However, when I run this the audio sounds ambient. I don't know if the audio is somehow sticking to the camera, or if it is actually running in ambient mode, but distance from (0,0,0) has no effect on sound volume. I have tried setting ambient to false with no affect. Does anyone see where I am going wrong? Thanks. Matt[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33096#33096 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [3rdparty] Sound In OSG
Are there standard ways to configure sound placement from outside the source code? Looking through the 1 page of documentation that comes with the source code as well as the examples, I see that I can place a sound object at an (x,y) position - so I can manually place it somewhere in my model. However, what I'd really like to do is configure Sound1 to position itself at Node1, so that when I make changes to my coordinate system, model, etc. I won't have to recalculate and re-code position information. I see that sound nodes are extensions of OSG's Node so I can manipulate them in the same way, but I would still need to change the source code if I ever moved or manipulated my 3D model. For example, I have a large model of a school and I'd like to attach a bell ring to the bell tower, cheers to the stadium, etc. It would be great if I could just write a config file or smarter source code that would always pair each sound with its part of the model in the scene. Has anyone solved this task before? Also, is there any detailed documentation for this system? The only documentation I found on the google project site was for building the system - and then I only saw 1 page of documentation in the source. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32996#32996 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [3rdparty] Sound In OSG
Thanks Chris, I downloaded osgAudio, generated the project files, and I have built the osgAudio project. I was hoping you could help me with a couple details though: What is the difference between osgAudio and osgdb_osgAudio? After looking through the plugin directory for OSG it seems that all the plugins I currently have begin with osgdb - does this mean I actually want to build osgdb_osgAudio instead? How do I integrate osgAudio with my OSG build? Do I just throw the osgAudio executables into the OSG plugins folder inside my OSG build directory? Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32911#32911 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [3rdparty] Sound In OSG
Is osgAL the recommended way to incorporate sound in OSG? I'm looking to generate sounds based on locations in the scene graph and the only obvious library that popped up in a google search was osgAL... Any direction to a standard solution would be appreciated. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32865#32865 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How Camera Manipulators Work
Chuck, I think I'm gonna come back to this thread in a little while with a proposed project to realize the mapping that has been discussed over the past few entries. Maybe you can take a look at the proposal and give some feedback? I agree that most users probably find the current manipulators usable with some tweaking, but for such an object oriented and modularized system, I hate to think that the typical user is out there adjusting source code for the manipulator and then calling it something else. I think this part of the system is just far too tangled in its logic and should be opened up for extensibility purposes. For those who find the current manipulators to be useful, theres no reason we can't provide a factory to hand out all the versions of manipulators that people are used to - mapped to the IO that people are used toso I think we can keep it equally simple for users who don't want extensibility, but at the same time we can make new manipulators far easier for those of us with unusual IO devices, or unusual manipulator logic. At the moment I'd say my two primary goals for this camera re-write are: 1) Separation of IO from Camera Manipulators 2) Pluggable IO system with regard to Camera Manipulators 3) Factory(s) to build the manipulators everyone is used to Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32867#32867 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Rotating With Quaternions
If I can split up a quaternion to rotations about arbitrary axes then thats fine - I just need to know how to make that split. For example if I have a quaternion with some rotation about some axis, I might need to grab the rotation around (0,0,1) from that quaternion. But I don't see how to do that right now. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32661#32661 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Rotating With Quaternions
How can I get and set a rotation about a specific axis from a qauternion? I have a quaternion rotated arbitrarily in 3D space, but I would like to inspect its rotation about the global z-axis, then after inspection I would like to be able to set that rotation. I suppose to set it I could just add the difference between the current rotation and the final rotation, but to do this I still need to be able to inspect the z-rotation initially. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32622#32622 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How Camera Manipulators Work
Thanks for the input everyone - I'm slowly starting to get a grip on these manipulators. I'm currently working on a manipulator to mate up with a joystick I have - the first time around I'm just kind of hacking it together to find out how everything works, but I want to come back and really polish it up. So I have an academic question for all you very experienced OSG'ers: Looking through the manipulators it is brutally apparent that camera navigation is inextricably linked to specific input signals. Wouldn't it make infinitely more sense to define business logic camera manipulators and then simply hook up an IO device to that business logic? For example, the FlightManipulator does pretty much exactly what I'm looking for in business logic for my joystick, but FlightManipulator is filled with references to mouse interaction, even though a mouse really has nothing to do with the idea of pitching, rolling, throttling, etc. So why are the manipulators currently set up the way they are? and would the community benefit from a new idiom and class structure in this particular area? If you guys agree with my point, I may try to develop such a structure. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32583#32583 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How Camera Manipulators Work
J-S, Your view of how the system would work is probably very similar to what I had in mind. The idea is that camera manipulators really define business logic behavior and should be used as such. For example, these are some possible API examples (not exhaustive) FlightManipulator: //these do not set pitch or roll angles, these accept magnitudes between, //lets say, [-1,1] and then the implementation decides how strongly that //pushes the pitch angle or roll angle. pitch(force) roll(force) throttle(force) etc.. FirstPersonManipulator: lookHor(speed) lookVert(speed) walk(speed) etc... ModelManipulator (my new name for a TrackballManipulator): zoom(amount) rotate(angle) etc... Then there would be separate GUIEventAdapters which are just GUI Event Handlers, and these handlers map their specific input to calls to the manipulator. Hence, when the joystick handler receives a joystick event, the handler figures out what was pressed or pushed, then requests a business logic action from the FlightManipulator, or the FirstPersonManipulator, or the ModelManipulator...depending on which manipulator is currently in use. That sound good? I think the fundamental issue is that someone decided to combine the concept of a GUI Event Handler and the concept of a Camera Manipulatorthe reason this is a problem is because, as stated before, a Camera Manipulator is all business logic - it deals only with 3D concepts. The GUI Event Handler on the other hand is sitting in the architecture layer where it knows things about IO (and therefore hardware). Hence we've crossed abstraction layers and now its limiting extensions of the system. What do you think? Also, J-S, I didn't really understand the point you were trying to make in your final paragraph: I would suggest that axes be mappable to either an analog axis (say mouse up/down or joystick y axis) or a pair of buttons (one for incrementing and one for decrementing the value). Thanks. Matt[/quote] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32586#32586 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Problem Loading .FLT
Hi, I've got an .FLT file that I need to load into OSG. I am loading it with the following code: Code: osg::Node* pLoadedModel = osgDB::readNodeFile([mypath]/campus08-19.flt); However when I compile and run the program I get the following error: Unknown record, opcode=91 size=88 I have no idea what this means and I'm hoping someone here can explain it and perhaps help me correct it. I have seen this .FLT run with other programs so it should not be corrupt or anything. Thank you! Cheers, Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32410#32410 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem Loading .FLT
It turns out the model was just incredibly large and it took some 20 minutes to load on my machine - thats why I figured the unknown record line was an error. Thanks. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32415#32415 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How Camera Manipulators Work
I'm trying to write my own camera manipulator and I'm having a difficult time figuring out how the current camera manipulators work. I have read through source code for a number of the manipulator classes including FlightManipulator, FirstPersonManipulator, StandardManipulator, and CameraManipulator. I can't seem to track down the code that actually manipulates the camera. I see a bunch of instance variables being altered and GUIEventAdapters getting passed off to other methods, but I just can't seem to get down far enough in the code to see where the manipulation is occurring. I think I noticed a frame() method in one of the lower level classes - is this where all the data is used to compute new camera position and location? If so, how does that frame() method know to use the velocity, acceleration, pitch, yaw, etc that is built into subclasses like FlightManipulator? Any clarification about how the camera manipulator class structure works would be appreciated. Additionally, I am having difficulty understanding the use of quaternions in relation to the OSG coordinate system. If someone could point me towards some descriptive reference material on working in the OSG coordinate system I would appreciate it. Thanks. Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32416#32416 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG Input Event System
Hi, Im looking for some clarification on the IO event system in OSG. Starting from the outside in, we've got various types of CameraManipulators that move the camera based on input. That input arrives as a GUIEventAdapter where the manipulator queries for mouse events or keyboard buttons pressed. I'm wondering, what generates those GUIEventAdapters? I would like to create a new type of GUIEventAdapter, but first I need to figure out what actually instantiates the events. Thank you! Cheers, Matt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32294#32294 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG Input Event System
Thanks Robert, that was exactly the sequence information I was looking for. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32299#32299 ___ 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
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
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
[osg-users] [build] OSG Namespace Functions
Hi, I built OSG from source on Windows and I have just gotten past the Hello World program. I am now trying to load a mesh using the following line: Code: osg::Node* pLoadedModel = osgDB::readNodeFile(cow.osg); However I get the following error: 1..\HelloWorld2\HelloWorld.cpp(8) : error C2039: 'readNodeFile' : is not a member of 'osgDB' 1..\HelloWorld2\HelloWorld.cpp(8) : error C3861: 'readNodeFile': identifier not found Now I suppose this makes sense because while I have a directory called osgDB/ with all of the osgDB classes in it, I don't have any header file for osgDB itself. Can anyone tell me where the lib for osgDB should be? Or clarify what is going wrong here? Thank you! Cheers, Matt[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32038#32038 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] OSG Namespace Functions
I did not have the correct include statement, you're suggestion to check it was right on. I realized that was the problem a few minutes ago and I edited my post to say that, but thanks for the help anyway. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32041#32041 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org