Re: [osg-users] Keyboard focus loss with OSG 3.2.1
robertosfield wrote: > Hi Steven, > > I don't see this behaviour on my KDE Linux desktop - I can run osgviewer, > exit and the keyboard focus remains with the console that had the original > focus. > > What window manager are you using? > > I don't have an opinions w.r.t RevertToParent change as I don't know yet what > the effect across platforms will be to existing OSG applications. If it > works as a better default across more X11 window managers then that would be > a good thing. However, having to click for keyboard focus is hardly a major > issue, there are plenty of more pressing issues I need to tackle. > > Robert. > Hi Robert, My window manager is icewm. Like you I don't have a problem when running osgviewer. The keyboard problem after exiting my program started after I created a class derived from osgGA::GUIEventHandler. The loss of keyboard is not an issue except when running on a PC without a mouse which admittedly is pretty rare. I've just tested on an i386 and the results are the same so I doubt it is platform specific. I'll post here with any updates. Thanks, -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61441#61441 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Keyboard focus loss with OSG 3.2.1
Hi, I've recently added a keyboard handler (using osgGA::GUIEventHandler) to my program and it works but the keyboard focus is lost when the program ends and I have to click a window with the mouse to re-enable the keyboard. My operating system is Debian ARMHF. The fix I've found is to change src/osgViewer/GraphicsWindowX11.cpp so its XSetInputFocus call (there is only one) uses RevertToParent rather than RevertToNone. Does this sound like a reasonable solution or can anyone see any problems here ? I can try to supply a patch if this will kelp. Thanks, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61438#61438 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Vertical retrace detection
Chris wrote: Chris 'Xenon' Hanson wrote: > How do you mean "the display thread loops busy rather than idling"? My > experience with > OSG running on a proper video driver is that wait for vblank should be a > mostly-idle > operation, not a spin-wait. What OS, driver, hardware, etc are you running > on? I gave ATI > endless grief a few years ago until they fixed this because it was KILLING > OSG dtabase > pager (by eating all the time DBPager normally uses to load/compile scene > data). Thanks for the ATI hint. I do have an old ATI card in this PC. I've just tested the program in a PC with an nVidia card and it does wait-idle somewhere in the frame() call. I'll setup another thread for my input processing. Thanks, -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=17104#17104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Vertical retrace detection
Hi Ulrich, Ulrich Hertlein wrote: > In general I don't believe it would benefit your ultimate goal (smoother > display): yes, > the display thread waits for retrace and thereby wastes some cycles. On the > other hand if > you call 'frame()' too late you might miss the next retrace altogether and > quality will > suffer dramatically. > > Can't you decouple your processing instead by moving it to a separate thread? Yes, the quality drop from delaying my frame() calls is dramatic (say 30 frames per second instead of 60). Also, the variable processing time for each frame means that I can't reliably estimate the milliseconds required. My problem with using another thread is that the display thread loops busy rather than idling so it's hard to share the processing time without taking valuable time from the display thread. I'm now giving priority to net input and the rest to the display updating. Thanks, -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=17100#17100 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Vertical retrace detection
Hi, I'm using OSG 2.8.0 and trying to synchronise my video frame generation with the vertical retrace frequency so I get a smoother display. Update on vertical retrace is enabled. If I call viewer.frame() too early processing is stalled until the next retrace. Is there any way for my application to check for an available buffer before calling viewer.frame() ? I'd like to use this time for other processing rather than waiting. Thank you! Cheers, Steven -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=17096#17096 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] aspect ratio question
Clay, Bruce wrote: > I started working with the OSG MFC sample on a Vista windows box. When I load > a model into the window and rotate it, I notice that the aspect ratio of the > model changes. If the aspect ratio (probably a float) is calculated from the screen size (two integers) you might be losing the fractional component (e.g. 800/600 = 1). Casting the inputs to floats will help here. ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=17095#17095 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Desirable OpenGL knowledge
jguo wrote: > How do you recommend I go about this, keeping in mind that I dont plan to > develop with raw OpenGL? Im particularly interested in how the OpenGL states > and modes effect the rendering in OSG. > So, the Red Book > (http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321481003)? > The SuperBible > (http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321498828)? > The online documentation (http://www.opengl.org/documentation/)? I bought the SuperBible which has been good for me. Same as you I wanted to learn OpenGL so I could understand OSG rather than write OpenGL directly. The OSG Quick Start Guide is great and I still pick up something new each time I reread it. I've never done graphics programming before so it's all new territory to me. Cheers, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9951#9951 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LightPoint and fog
I've just found that using osgSim::LightPoint::BLENDED instead of ADDITIVE solves my problem. My apologies for posting this thread. Thanks, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9890#9890 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] LightPoint and fog
Hi, I'm using osgSim::LightPoint for lights (e.g. runway edge lights) in a scene. These are great normally but when fog (osg::Fog) is applied the lights change to white and don't fade into obscurity. Is there an easy way to fix this or perhaps a better method of adding such lights to the scene ? I'm wondering about putting the lights under an LOD and changing the max range to suit the fog but this doesn't sound easy or ideal. Thank you, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9884#9884 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Quaternion problem
Hi Antonin, I may be getting way out of my depth here but when I saw your problem this morning it looked very similar to a problem I had just recently. Looking at your original post : Antonin Linares wrote: > > //get height and normal under the tank > osg::Vec3f pos = > lsi->getFirstIntersection()->getWorldIntersectionPoint(); > osg::Vec3f normal = > lsi->getFirstIntersection()->getWorldIntersectionNormal(); > > //Set up height > pat->setPosition(pos); All looks fine so far Antonin Linares wrote: > //Set up alignment with terrain > float rotation; > osg::Vec3f origine; > pat->getAtitude().getRotate(rotation, origine); > > if((origine*normal) != 0){ > osg::Quat corect; > corect.makeRotation(origine, normal); > > pat->setAtitude(corect); I don't understand why you have the getAtitude() here. It will return a quat and the .getRotate will convert the value into an angle and vector. But what quat value is it converting ? What happens if you always calculate "corect" as you are doing and then apply "rot" in the setAtitude call (i.e. pat->setAtitude (rot * corect) ) ? //Set up alignment with terrain float rotation; osg::Vec3f origine (0,0,1); osg::Quat corect; corect.makeRotation(origine, normal); // I'm not sure where you get rotation from ?? osg::Quat rot(rotation, origine); pat->setAtitude(rot*corect); I hope this helps or entices someone more knowledgeable to assist here. -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8598#8598 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Quaternion problem
Antonin Linares wrote: > Hi osg users > > I use an intersectionVisitor to place tank model on my terrain > i made something like that: > > [...]osg::Quat rot(rotation, normal); > pat->setAtitude(corect*rot); //the tank was well oriented but > no more aligned with my terrain > } > } > > I looking for any idea to make my tank aligned with the terrain but > keeping it's previous orientation. > Have you tried : pat->setAtitude(rot*corect); ? I'm wondering if the factor that should be applied last (i.e. rot) should be first in the multiply here. -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8557#8557 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ProxyNode and output to .IVE
Brian R Hill wrote: > Steven, > > I use PagedLOD for this. Hi Brian, Thanks for the tip; it solves both problems and works like a charm. Cheers, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8472#8472 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] ProxyNode and output to .IVE
I'm generating a scene and writing it to disk for later use. I wish to import some sub-scenes (IVE files) at run-time. To achieve this I'm using ProxyNodes specifying the sub-scene filename. One problem is that the full filename is stored in the OSG file I generate but not the IVE file. If I split the filename into path and name and use setDatabasePath the path is not written to the IVE or OSG output files. The second problem is that when I generate the IVE file the plugin creates a dummy file with the filename of the file I wish to import. This dummy file overwrites the sub-scene file. Is ProxyNode the proper tool for this job ? Any suggestions or alternatives will be greatly appreciated. Thanks, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8419#8419 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] dynamic vertex array howto
Skylark wrote: > Yep, good intuition: _geometry->dirty(); > Also, since you're changing the vertices each frame, set > _geometry->setUseDisplayList(false); or otherwise you'll get bad > performance. Thanks for the tip about the futility of a display list in this case. I have a sky dome that follows the camera so your comment has helped me. But I can't find any reference to a "dirty" function. Do you mean "dirtyBounds" (which I do use) or am I missing something ? There is "dirtyDisplayList" but this is irrelevant when there is no list. Thanks, -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=7697#7697 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Lightning problem with camera point of view
jonim8or wrote: > I have the same problem, with lights switching on and off for one shape in my > scene. I have a similar problem in a scene with large flat terrain areas. When there is no vertex in close view it seems that OpenGL can't determine the appropriate lighting for the surface and therefore doesn't. Adding points with normals to the large area solves the problem. HTH, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=7681#7681 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] DrawArrays and bind_per_primitive
Robert Osfield wrote: > As a general note, using BIND_PER_PRIMITIVE drops the OSG down to > using OpenGL glBegin/glEnd slows paths, which is very inefficient > compared to using vertex arrays. Thanks for this tip; I wasn't aware of the performance penalty. Does this also apply to BIND_OVERALL ? I have many single entry arrays for colour. If these are expensive from a performance viewpoint then I'll definitely expand them. Thanks, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=7137#7137 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] DrawArrays and bind_per_primitive
Simon Hammett wrote: > No it works fine for me. (2.7.1) > It doesn't work with tri/quad strips though, you get the same behavior > as BIND_OVERALL. Thanks for the info. I can see the problem with strips or fans. The .osg file looks fine to me but it just doesn't work. If I set the notify level to INFO I see lots of warnings that the binding has been set to PER_PRIMITIVE. I'll experiment some more. -------- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=7107#7107 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] DrawArrays and bind_per_primitive
Is BIND_PER_PRIMITIVE allowed when using a DrawArrays (GL_QUADS) primitive ? I've found that if I do this and save the scene as an .osg file it will crash osgviewer. If I save the scene as an .ive file then there is no problem. I chose BIND_PER_PRIMITIVE here because it seems sufficient and avoids duplication of identical normals. Thanks, ---- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=7104#7104 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] IVE writer repeatedly saves identical textures (osgconv)
Andrew Lett wrote: > Is there another solution which can prevent repeat saves of the same texture? Can you change your scene (or whatever generates the .osg files) so it uses the same texture multiple times instead of multiple textures that just happen to contain the same image file ? I do this and the .osg output file is full of "UseTexture_??" and "UseArray_??" for the co-ords but the texture specs and image file name appear only once. -------- -- Steven Saunderson -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=7004#7004 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::View NO_LIGHT bug?
- From: Ben Axelrod at 2009-02-18 07:09- I still dont know why osg::View::NO_LIGHT doesnt work, but to answer my own questions, to turn off the default light completely: { light->setAmbient(osg::Vec4(0,0,0,1)); light->setDiffuse(osg::Vec4(0,0,0,1)); light->setSpecular(osg::Vec4(0,0,0,1)); } Hi Ben, This is the best solution that I found. I tried the example code from OSGQSG but it didn't work properly. I appreciate comments here that it's not ideal because light#0 is wasted but it seems safer than trying to hijack this light which viewer expects to use. Any suggestions or clues about taking control of light#0 will be greatly appreciated. -- Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Difficulties with HUD
- From: Ulrich Hertlein at 2008-11-30 11:17- On 30/11/08 9:17 AM, Steven Saunderson wrote: > If I setComputeNearFarMode to DO_NOT_COMPUTE_NEAR_FAR the HD background > (white in my case) appears but not the black text. Have you set correct near/far values? Maybe your text is clipped by the near plane? I've just tried this (and other tests). The HUD code has a Geode as the parent for the Geometry (background) and Text (foreground). This Geode has a StateSet that should do what I want but doesn't. If I also attach this StateSet to the Text everything works. I thought the Text would be affected by inheritance but apparently not. Perhaps Text has a default StateSet that stops inheritance. So, the good news is that this is now working. > Also, the HUD relies on the scene lighting. This means that when I > reduce/disable the scene lights the HUD also fades to black. Disable lighting for the HUD subgraph: stateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF); Brilliant, thank you very much. I wouldn't have realised this from reading my OpenGL book. Presumably LIGHTING OFF means the colour displayed is that specified with no modification. This is much better than adding a light to the HUD (just tried and it works) because lights are a limited resource. Thanks, Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Difficulties with HUD
I've added a HUD (code based on the OSG tutorial) but it has problems. If I setComputeNearFarMode to DO_NOT_COMPUTE_NEAR_FAR the HD background (white in my case) appears but not the black text. Reversing the colours doesn't help so it looks like the background is appearing on top of the text. Is there any way (perhaps StateSet entry) to correct this ? Also, the HUD relies on the scene lighting. This means that when I reduce/disable the scene lights the HUD also fades to black. I'd like the HUD contrast to be constant. Is there any way I can specify that the HUD background is a constant white rather than being affected by the ambient light level ? Thanks, Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera rotation on three axes
- From: Paul Melis at 2008-11-05 20:06- Hi Steven, Maybe the following is an easier way to accomplish what you want, as I don't see why you are trying to calculate angles... Hi Paul, Thanks for all your help. I've finally tried enough methods to appreciate the differences and how I can avoid gimbal lock problems. I'm now using pitch to select the latitude in my sphere of view rather than an oblique great circle. This seems to work well for my purposes. Thanks again, Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera rotation on three axes
- From: John Vidar Larring at 2008-10-30 21:42- Hi Steven, Here is a snipplet of code from the osgautocapture example that I just sent to osg-submissions (if my email got through?), provided as is. I hope it might be of help: Hi John, Thanks for the code. I tried it (and it also rekindled my interest in ViewMatrixLookAt) but I still got gimbal-lock. Perhaps my implementation of your code is faulty. I've spent days now trying to learn enough about quaternions. This almost works but my calculation for the rotation angle is still wrong. Is there a function in OSG for calculating a quaternion from euler angles ? I've searched but haven't found anything. The standard code to calculate a quaternion uses w = cosx * cosy * cosz + sinx * siny * sinz. This doesn't seem right to me and it doesn't work in my testing. I would expect the final rotation to be between the largest input rotation and PI. I hope this post is sufficiently on-topic for the osg-users list. I apologise if I should be looking elsewhere. Thanks, Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera rotation on three axes
- From: Paul Melis at 2008-10-30 23:45- Steven Saunderson wrote: > Hi Paul, > > Thanks for you quick answer. I've tried loading the matrix manually > but I still get stuck when both x-axis and y-axis are PI/2. I'm not sure what you mean here. It sounds like you're building your matrix from Euler angles manually, but this will still not solve your gimbal lock problem. You're quite right here. I'm now reading the entire FAQ especially about quaternions. To quote Q39 in the link above: "Don't let the spectre of Gimbal Lock fool you: Euler angles are still a complete representation of any rotation in 3D space; it's just that the actual Euler angles needed to achieve some particular desired rotation may be rather unintuitive." Does this mean that instead of rotating both x and y 90 degrees I should find another axis and rotate around this ? What exactly are you trying to achieve? Where do the pitch, rol, yaw values come from, are they user-specified? It is a flight simulator. The pitch, roll, and yaw values come from an external source so any combination is possible. Thanks for the FAQ link; it is a great resource. -- Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera rotation on three axes
- From: Paul Melis at 2008-10-30 21:10- You've hit upon a phenomenon called 'gimbal lock'. See http://web.archive.org/web/20041029003853/http:/www.j3d.org/matrix_faq/matrfaq_latest.html#Q34 for an explanation (and possibly some different ways of controling your camera). Hi Paul, Thanks for you quick answer. I've tried loading the matrix manually but I still get stuck when both x-axis and y-axis are PI/2. I am doing a mult after to apply the x,y,z offsets and then getting the inverse matrix before loading the camera. Will these actions thwart the fix ? Thanks, Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Camera rotation on three axes
I'm trying to rotate a camera on all axes but my code fails when the x-axis or y-axis rotation approaches 90 degrees. I am using a viewer.frame loop to avoid the default manipulator supplied by viewer.run. My current camera code is : cameraRotation.makeRotate ( yrads,osg::Vec3 (0, 1, 0) , // roll Y xrads,osg::Vec3 (1, 0, 0) , // pitch X zrads,osg::Vec3 (0, 0, 1) ); // yaw Z cameraTrans.makeTranslate (xdist, ydist, zdist); myCameraMatrix = cameraRotation * cameraTrans; inverseMatrix = myCameraMatrix.inverse (myCameraMatrix); inverseMatrix *= osg::Matrixd::rotate (-(osg::PI_2), 1, 0, 0); viewer.getCamera ()->setViewMatrix (inverseMatrix); When the pitch (xrads) is 0 everything works properly. But when xrads is PI/2 the effect of yrads is identical to zrads (both do z-axis rotation). I've tried applying the rotations in various orders but the code fails when one of the rotations is PI/2. Can anyone suggest what I am doing wrong here or point me to a sample of working code ? Thanks, Steven ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org