Re: [osg-users] Matrix uniforms glsl
Hi Jamie, On 2 April 2014 17:01, Jaime xatp...@hotmail.com wrote: I want to use matrix uniforms with GLSL shaders. I want to use MVM (modelview matrix) , MVP (modelviewprojection matrix) and NormalMatrix. How can I update it? To update a uniform you simply do: myuniform-set(value); You can do this from your main loop, a node update callback or an update callback attached to the uniform. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Couple of quest about Offset Polygon, Composite Viewer in window, license
On 30 March 2014 08:19, Sonya sonyablade2...@hotmail.com wrote: I've got couple of questions in my mind I would be very glad if anyone can answer them. *How to achieve the effect of showing the edges of shapes along with rendered surface. So the edges becomes more emphasized and visible. The effect is similar to those which we get in rendering applications with features edges+rendered in Blender3D, 3DMax etc.. apps? How's about the osgoutline example? *I do have a composite viewer example source (front, top, side, perspective) and I'm trying to figure out on how to put all this in a window, SetUpViewInWindow doesn't work in my case? Just create a single GraphicsWindow and assign to each view's master Camera rather than assigning one each. See the osgcompositeviewer and osgcamera examples for illustration of assigning contexts to cameras. *Is there any limitations on using OSG in commercial applications with disclosure, but my proprietary code will be in closed form? This is permitted by the OSGPL, most OSG users will be companies using the OSG as par of a closed source application. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] render main scene and 2d menu in single RTT
On 28 March 2014 19:58, Anton 86o...@gmail.com wrote: What you think? Overload... that's one lot of code you are expecting us to review and debug. I suspect this is the main reason why you haven't had a reply, too much to consider into one post. Try breaking things down. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] FBO - Write to texture array using sampleBuffer
Hi Paul, The way to bind a texture to the output of shader is to use an FBO. Robert, On 19 March 2014 11:44, paul cooper paul.ta...@internode.on.net wrote: Hi all, I would like to use shaders - especially a sampleBuffer to write to a floating point texture containing data. Do I have to setup an FBO and attach it to a camera? Is there another way to write to a buffer using shaders besides using an FBO? Regards Paul -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58656#58656 ___ 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
Re: [osg-users] Applying shaders or other effects within a shaped region.
Hi Josh, What you are trying to achieve is a step beyond entry level graphics so you'll need to be patient with learning all the bits required. The easiest way to do effects like this would be use multi-pass technique where the main scene without effects is rendered to the whole GraphicsWindow, then a second pass is done that renders the same scene but decorating it with the extra effects. To cut down the region you want to do the efffect rendering you could use the stencil buffer (see osgreflect example), a ClipNode (see osgclip) or simply a Viewport cut down to size if the window is screen aligned box. Potentially you could also a shader or projective texturing to do this as well. Robert. On 14 March 2014 15:32, Josh Sutterfield jo...@kaplogic.com wrote: Hi, I am looking for some guidance to the right doc or example, or even just a hint or a few classes to look closely at. Essentially I want to create a piece of geometry that applies effects to any part of a node in its interior. What I would be modelling is a camera's field of view, so it will be a 4-sided frustum extending out (not unlike the osgthirdpersonview example). All surfaces that intersect should be painted in some fashion not unlike a strong light source would do. In fact I at first thought a light source might be desirable but it seems like I am limited to 8 of those, and I have not seen any way to light up the whole path (and not just the surfaces it hits) so it highlights the whole field of view. So I think semi-transparent frustum will do the trick, but I am wondering how I can apply a shader to only the parts of other nodes that intersect with it? In terms of the scene graph the nodes may not be anywhere near each other, but I want to shade their overlap. Typically these areas will not be animated although it'd be nice to have the option. I have looked also at the osgclip example since this seemed promising - but this example uses two copies of the model, with one being clipped out. Meaning that the ClipNode could not easily be moved around the scene unless it carried a full duplicate (with shaders applied) of the entire graph. Is this the best/only approach? Maybe it is not as much of a chore or not as expensive as it seems? I am new to 3d graphics in general but can accept a fairly technical description since I've been perusing the source code a while now and understand the mathematics of it fairly well. Thanks, Josh Sutterfield -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58553#58553 ___ 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
Re: [osg-users] [forum] Change the position and rotation angle of the camera
Hi Becky, If you viewer has a CameraManipulator attached to it he manipulator will keep overriding the matrix you set on each frame, simply don't assigned a CameraManipulator and you should be fine. Robert. On 1 April 2014 10:37, ying song ying.s...@epfl.ch wrote: Hi, I draw a box using addDrawable. Then I want to change the position and rotation angle of the camera by: viewer-getCamera()-setViewMatrix(cameraTranslationMatrix); But actually it makes no change to the camera. The cube is still in the center of the screen after run the scene. I also tried to update the frame by using the following code, but also failed: while(!viewer-done()) { viewer-getCamera()-setViewMatrixAsLookAt(eye,center,up); viewer-frame(); } Would anyone tell me what could I do to move the camera? Thank you! Cheers, Becky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58769#58769 ___ 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
Re: [osg-users] Camera callbacks
HI John, As the Camera has Initial/Pre/Post and FinalDrawCallbacks having add/remove/getNum/get methods rather than just set/get will mean a lot of extra new methods expanding an already large API. To avoid a big expansion in the API it would probably be best to push the list of callbacks onto DrawCallback, possibly as a linked list. Or have a CallbackList object that we get for each for the Intial/Pre/Post/Final draw callbacks. For backwards compatibility we'd need to main the old set/get methods, but for code that uses like osgShadow we can easily update them to use the list method. Robert. On 9 April 2014 22:22, PCJohn pec...@fit.vutbr.cz wrote: Hi Robert, Providing similar support for Camera::DrawCallbacks would be possible, there isn't the same imperative for controlling traversal, but it'd keep the public Camera API simple - it's complicated enough as it is so am reluctant to add further API to it. Sorry, I am not native English. By the last sentence do you mean that the multiple Camera::DrawCallback support must be as simple as possible or that you would prefer to not put it into the API? I am not pushing the things, but it seems that shadow classes are already not compatible with OcclusionQueryNode as they both register pre and post draw callbacks. And a programmer might want to make his own callbacks for profiling reasons, start various OpenGL queries, resize his own custom RenderBuffers used for HDR rendering whenever screen window resizes, etc. My idea was: struct OSG_EXPORT DrawCallback : virtual public Object { DrawCallback() {} DrawCallback(const DrawCallback,const CopyOp) {} META_Object(osg, DrawCallback); virtual void operator () (osg::RenderInfo renderInfo) const; virtual void operator () (const osg::Camera /*camera*/) const {} ref_ptrDrawCallback _nestedCallback; }; inline void addPreDrawCallback(DrawCallback* dc) { if (dc != NULL) { dc-_nestedCallback = _preDrawCallback; _preDrawCallback = dc; } } inline void removePreDrawCallback(DrawCallback* dc) { if (dc != NULL) { if (dc == _preDrawCallback) _preDrawCallback = _preDrawCallback-_nestedCallback; else { DrawCallback *c = _preDrawCallback; while (c) { if (c-_nestedCallback==dc) { c-_nestedCallback = c-_nestedCallback- _nestedCallback; dc-_nestedCallback = NULL; return; } } } } } Not sure if it is enough thread-safe. If you think that Initial-,Pre-,Post-, and Final-DrawCallback functionality has too many methods, we can make like see bellow, while possibly deprecating some of the current methods. enum DrawCallbackEnum { INITIALIZE_DRAW_CALLBACK = 0, PRE_DRAW_CALLBACK = 1, POST_DRAW_CALLBACK = 2, FINALIZE_DRAW_CALLBACK = 3 }; inline void addPreDrawCallback(DrawCallbackEnum which, DrawCallback* dc) { if( which 4 ) { ref_ptrDrawCallback c = _drawCallbacks[which]; } inline void removePreDrawCallback(DrawCallbackEnum which, DrawCallback* dc) { } ref_ptrDrawCallback _drawCallbacks[4]; // this replaces four variables John On Wednesday 09 of April 2014 16:16:31 Robert Osfield wrote: Hi John, Original Node callbacks didn't support multiple callbacks, but I worked out that I could add the functionality relatively non-intrusively by nesting callbacks. The key advantage with nesting is that it enables a callback retain data on the stack within the local scope of the callback - which makes things easy to implement and gives you thread safety for free, and enables the callback to take complete controlling traversal. Providing similar support for Camera::DrawCallbacks would be possible, there isn't the same imperative for controlling traversal, but it'd keep the public Camera API simple - it's complicated enough as it is so am reluctant to add further API to it. The alternative would be to add a list of callbacks, but as you said this would break compatibility. Robert. On 9 April 2014 14:10, PCJohn pec...@fit.vutbr.cz wrote: Hi, I very like the capability of osg::Node to register any number of update, event and cull callbacks. This allows for a nice modular approach with each module registering callbacks for anything they wish without disturbing others. I came to a problem that Camera can register just one Initial-,Pre-,Post-, and Final-DrawCallback. Surely, I can register my own
Re: [osg-users] FBO - Write to texture array using sampleBuffer
Had it worked out - Thanks for your reply though :) On 17/04/14 18:14, Robert Osfield wrote: Hi Paul, The way to bind a texture to the output of shader is to use an FBO. Robert, On 19 March 2014 11:44, paul cooper paul.ta...@internode.on.net wrote: Hi all, I would like to use shaders - especially a sampleBuffer to write to a floating point texture containing data. Do I have to setup an FBO and attach it to a camera? Is there another way to write to a buffer using shaders besides using an FBO? Regards Paul -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58656#58656 ___ 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] 'osgwidgetbox' example can not work in HORIZONTAL_SPLIT stereo mode with OSG3.2.0 or higher
On 10 April 2014 10:33, Junjie Xue bit...@gmail.com wrote: I still can not work around this issue. Is there anyone who can help? 3.2.x introduced a new way of managing events to better handle complex viewer setups such as ones with distortion correction, it could be the osgWidget does play well with this. I'm not the author of osgWidget so am in similar boat with yourself of having to look at the code to understand what might be going amiss. As a general point osgWidget will never work properly with a stereo setup and it's assumes a fix position that overlays the 3D objects in the scene. In stereo this will mean the widgets will always appear on the image plane and will occlude 3D objects that are supposed to infront of the image plane, this will break the stereo effect in unpleasant ways and likely make your users feel uncomfortable when they attempt to use it. When doing stereo UI's you really need to have to placed into 3D scene and rendered along with everything else, osgWidget I'm afraid isn't presently up to this task. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] request for small source change in StandardShadowMap
Hi Nick, There isn't any way of me judging changes I haven't seen. In general if there is part of the OSG that isn't able to do what a users need it to do but a small change that is consistent with the overall design can achieve this then I'll be open to considering it to be merged. However, I have to see the code to know. It could also be that what you are trying to do can be done without any mods. Robert. On 14 April 2014 19:58, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, I am not sure if you are familiar with this code ( I bet You are ;-) ). I have a case where I want to mix shaders with the one that are provided to this class and I need access through the interface to the osg::Program which holds these shaders and it is instantiated locally in the scope of some method - StandardShadowMap.cpp Line: 544. I would welcome something like getProgram() and expose this object to the interface. Are you friendly to such a change - it won't brake anything. Please let me know Nick -- trajce nikolov nick ___ 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
Re: [osg-users] Scale Flattening and LODs
HI Karl, I'm trying to guess what is going on front the details you've provided. Are you saying that the osgUtil::FlattenStaticTransforms is not handling LOD's correctly? Have you looked at the source code to see what it's doing/not doing? Robert. On 14 April 2014 20:03, Cary, Karl A. karl.a.c...@leidos.com wrote: To at least partially answer my own question, everything seems fine if I manually apply the scale to the radius. So essentially, if you have a scale transform, it will affect the radius, center point, ranges, and vertex positions during the cull and draw. However if you flatten the scale, it seems to only affect the vertex positions and center. You have to manually adjust ranges and radius. Is this not supposed to be true? Is there anything else that I need to be double checking on? This is with 3.0.1. From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Cary, Karl A. Sent: Monday, April 14, 2014 12:51 PM To: OpenSceneGraph Users Subject: [osg-users] Scale Flattening and LODs I have run across an issue related to scaled flattening over an LOD. I have a Matrix transform with a static scale in it over an LOD node. For the LOD, I have exact ranges that I want it to change at, regardless of scale, i.e. always switch LOD at 1000ft, 2000ft etc. If I leave the matrix transform in place then I have to divide the ranges by the scale value as they get that scalar applied to them as well apparently. This is what we have been using for quite some time and works fine. I am trying now to flatten the scale transform out. When I do it though, the ranges don't get touched so I don't need to adjust them, but for some reason the raidus is also being left alone and now suddenly there is a center value that did not exist prior. In order to see this, I am spitting out the scenegraph to a .osg file. Is there something extra I need to do to an LOD to flatten the transform out? I am using the osg::Optimizer to do it. ___ 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
Re: [osg-users] Iterator bug
Hi Alexis, There are a number of issues at play here. First up the OSGPL license doesn't just allow you to grab OSG source code and embed it in your application - unless you are planning to publish your application OSGPL, otherwise it's copyright infringement. Secondly if your compiler is complaining of missing functions there is something amiss on the OSG side or something on your side, please report what errors you have. This error needs to be fixed properly not by being hacked around by including OSG code in your application. Finally the runtime error, well it could one of many things but you don't really provide any usual information what this might be. The original code looks fine, so I'd suspect memory corruption of the _normals pointer or an error in the container it points to. Robert. On 14 April 2014 22:42, alexis pierre osgfo...@tevs.eu wrote: Hi, I think I found a bug in osg 3.2.0 I needed to use osgUtil::SmoothingVisitor. For some reason my compiler couldn't find some of the functions so I just added SmoothingVisitor.cpp to my project (I may have taken that file from 3.2.1 rc2), and I got a big bug: in the function normalize I got an ERR_BAD_ACCESS Code: void normalize() { if (!_normals) return; for(osg::Vec3Array::iterator itr = _normals-begin(); itr != _normals-end(); ++itr) { (*itr).normalize(); } } So I modified the function as follows: Code: void normalize() { if (!_normals) return; unsigned long a,b; a=0; b=_normals-size(); for(osg::Vec3Array::iterator itr = _normals-begin(); itr != _normals-end()a=(b+1); ++itr) { if (a=b){ std::coutstd::hexlong(itr.base()) long(_normals-end().base())std::endl; } a++; (*itr).normalize(); } } And I got Code: 101f1ce18 101f1ce1c 101f1ce24 101f1ce1c So This means that the condition itr != _normals-end() is never false! Is it something I am missing? Thank you! Cheers, alexis -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58934#58934 ___ 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
Re: [osg-users] osgQt build error
Hi Alexey, to build osgQt library with osg using full OpenGL, you need to use the full OpenGL version of Qt as well. Qt built with ANGLE expects OpenGL-ES compliant code. If you want to use ANGLE version, I guess you should be fine if you compile osg with ES flag as well - I never tried this path though. ricky On Wed, Apr 16, 2014 at 10:00 AM, Alexey Pavlov alex...@gmail.com wrote: Hi! I can't build OSG with Qt builded with ANGLE under Windows using Mingw-w64 toolchain. I get conflict types between ANGLE and OpenGL headers: http://pastebin.kde.org/pitat7w4x Regards, Alexey. ___ 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
Re: [osg-users] multi-threading troubles with 2 graphic cards
Hi Thierry, I recently checked in a fix to OpenThreads's pthread affinity, from svn log: r14135 | robert | 2014-04-07 15:11:14 +0100 (Mon, 07 Apr 2014) | 15 lines From Marcel Pursche, The problem is that when OpenThreads is build with the Linux pthreads implementation all threads inherit the processor affinity from their parent thread. This behavior is also described in the pthreads man page (http://man7.org/linux/man-pages/man3/pthread_create.3.html... Perhaps this is the issue you are seeing, the fix is checked into svn/trunk and OSG-3.2 branch. Could you test it out and let me know if it helps. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] A suspicious bug of MatrixD
Hi Tianlan, Could you provide a small example that illustrates the problem? I did a quick test of: osg::Matrixd matrix = osg::Matrixd::scale(3.0,4.0,1.0); OSG_NOTICEMatrixd.getScale() = matrix.getScale()std::endl; And this works. I will need to have a think about a more complex scale set up before I can judge what it should be. Robert. On 15 April 2014 16:43, Tianlan Shao shaotianlan...@gmail.com wrote: Dear all, The following code in the header file MatrixD looks very suspicious to me: inline Vec3d getScale() const { Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } Shouldn't the index order be the other way around? I mean it should be inline Vec3d getScale() const { Vec3d x_vec(_mat[0][0],_mat[0][1],_mat[0][2]); Vec3d y_vec(_mat[1][0],_mat[1][1],_mat[1][2]); Vec3d z_vec(_mat[2][0],_mat[2][1],_mat[2][2]); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } The behaviour of my program was strange before I fix this problem. I'm not 100% percent sure, but since it's of fundamental importance, I still decided to report. Best regards, Tianlan Shao ___ 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
Re: [osg-users] request for small source change in StandardShadowMap
Hi Robert, let me do the changes then and I will send them to You so You decide. And thanks! Nick On Thu, Apr 17, 2014 at 10:44 AM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Nick, There isn't any way of me judging changes I haven't seen. In general if there is part of the OSG that isn't able to do what a users need it to do but a small change that is consistent with the overall design can achieve this then I'll be open to considering it to be merged. However, I have to see the code to know. It could also be that what you are trying to do can be done without any mods. Robert. On 14 April 2014 19:58, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Hi Robert, I am not sure if you are familiar with this code ( I bet You are ;-) ). I have a case where I want to mix shaders with the one that are provided to this class and I need access through the interface to the osg::Program which holds these shaders and it is instantiated locally in the scope of some method - StandardShadowMap.cpp Line: 544. I would welcome something like getProgram() and expose this object to the interface. Are you friendly to such a change - it won't brake anything. Please let me know Nick -- trajce nikolov nick ___ 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 -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Iterator bug
Hi, Thanks for your answer. I wasn't planning to add this file permanently, it was just a way to debug my software until I found why my compiler couldn't find the binaries (turned out I just forgot to add ogsUtil in my cmake file). Now that I have added that and removed the file it seems to run. I just wanted to post that in case this was a bug or something. Thank you! Cheers, alexis -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58992#58992 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Scale Flattening and LODs
Looking at the code for FlattenStaticTransformsDuplicatingSharedSubgraphs, as that is what appears to be running, the apply(LOD) function adjusts the center with a setCenter call, but there is no adjustment done to the radius. Since the setCenter call will enable the USER_DEFINED_CENTER mode, if radius is 0 then it will need to be adjusted. Also it does not modify the ranges either, even though if you were not to flatten the transform then those ranges would be effected by the scale. For my purposes the range part does not matter, but it might to others. -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield Sent: Thursday, April 17, 2014 4:48 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Scale Flattening and LODs HI Karl, I'm trying to guess what is going on front the details you've provided. Are you saying that the osgUtil::FlattenStaticTransforms is not handling LOD's correctly? Have you looked at the source code to see what it's doing/not doing? Robert. On 14 April 2014 20:03, Cary, Karl A. karl.a.c...@leidos.com wrote: To at least partially answer my own question, everything seems fine if I manually apply the scale to the radius. So essentially, if you have a scale transform, it will affect the radius, center point, ranges, and vertex positions during the cull and draw. However if you flatten the scale, it seems to only affect the vertex positions and center. You have to manually adjust ranges and radius. Is this not supposed to be true? Is there anything else that I need to be double checking on? This is with 3.0.1. From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Cary, Karl A. Sent: Monday, April 14, 2014 12:51 PM To: OpenSceneGraph Users Subject: [osg-users] Scale Flattening and LODs I have run across an issue related to scaled flattening over an LOD. I have a Matrix transform with a static scale in it over an LOD node. For the LOD, I have exact ranges that I want it to change at, regardless of scale, i.e. always switch LOD at 1000ft, 2000ft etc. If I leave the matrix transform in place then I have to divide the ranges by the scale value as they get that scalar applied to them as well apparently. This is what we have been using for quite some time and works fine. I am trying now to flatten the scale transform out. When I do it though, the ranges don't get touched so I don't need to adjust them, but for some reason the raidus is also being left alone and now suddenly there is a center value that did not exist prior. In order to see this, I am spitting out the scenegraph to a .osg file. Is there something extra I need to do to an LOD to flatten the transform out? I am using the osg::Optimizer to do it. ___ 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Understanding Node Clone Options
HI Karl, If the standard cloning options don't do exactly what you want then simply write your own method for cloning. A custom NodeVisitor should be easy to write, where you do a shallow copy on all the nodes you don't want to share and just directly assign the nodes/objects from the subgraph that you can share. The most important thing to share are the StateSet and Drawables, the internal scene graph should be relatively light weight. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] snapshot with fixed size
Hi FL, I'd use a slave Camera attached to the Viewer that shares the same graphics context as the main viewer windows, have this Camera use an FBO, and just set up the viewport and buffers to the size you need. You can toggle on/off the slave Camera by setting it's NodeMask to 0x0 for off, 0x for on. Robert. On 16 April 2014 09:45, F Lallauret fabrice.lallau...@fr.thalesgroup.com wrote: Hi, I have a scene render with RTT and quad geode for some postprocesses (e.g. a pseudo night vision shader). I want to get a snapshot of the displayed image but with a given size (e.g. always 512x512) independently of the real screen size. How can I do that ? The examples I found are always dependent of the screen size. Cheers, FL -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58954#58954 ___ 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
Re: [osg-users] Iterator bug
Thanks for your answer. I wasn't planning to add this file permanently, it was just a way to debug my software until I found why my compiler couldn't find the binaries (turned out I just forgot to add ogsUtil in my cmake file). Now that I have added that and removed the file it seems to run. I just wanted to post that in case this was a bug or something. It was a bug, just a compile/link bug in your application ;-) Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What should be used to simulate a camera on aircraft?
Hi Arden, The NodeTrackerManipulator tracks nodes in the scene and creates a view matrix for the Camera to track it. It doesn't do exactly what you won't but the implementation might provide inspiration. The key bit is computing the transform of the aircraft and then camera relative to this, this combined matrix will be the inverse of the matrix that you want to apply as the Camera view matrix. Robert. On 12 February 2014 20:05, arden firstki...@hotmail.com wrote: Hi, By which way I can define a camera and position it at the aircraft location pointing inthe direction of flight. I looked to find a solution. Bu If I not mistaken the manipulators works for moving in the scene by keyboard or mouse. I will take the lat,long,altitude,pitch,roll,heading/yaw parameters from FSX software. I am able to calculate world x y z coords from lat long and altitude values. But I did't figure out that how can I positon the camera to that x y z and point the camera in the direction calculated from pitch, roll, heading/yaw angles. Thank you! Cheers, arden -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58240#58240 ___ 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
Re: [osg-users] Crashes in drivers
Hi Jan, Working around driver bugs can be difficult, especially so when you don't have access to the problem hardware/drivers. You don't mention anything about the nature of the scene graph being used or the hardware/drivers that the problems are occurring on so there really isn't anything specifically we can suggest. The only general comment I can make is that worst drivers tend to be from Intel, could this be the issue here? If you look through the archives you should be able to spot places where other OSG users have had issue with driver quality and what they have been able to do to work around it. Robert. On 6 February 2014 09:09, Jan Stalmach stalmach...@gmail.com wrote: Hi, I would like to ask if somebody was forced with these kind of crashes. We have 7K+ customers and lot of them has problems with random crashes of OSG 3.2. We have a standard Win32 MFC MDI application with OSG integrated as an embedded viewer. With previous versions of OSG (2.6) there were no big number of crashes but with the 3.2 version is this really big problem for us. We always recommend to use the newest drivers (and it helps) but a lot of customers work on professional notebooks that have no option to get the up to date driver for every new vendor driver or simply they don't understand what driver is and how to install new one. We have a crash report mechanism that always report this call stack that lead to crash. Unfortunately we cant simulate this on our side. Do you have any idea where could be the problem? CALL STACK DUMP: CRASH... opengl32.dll!__fastGenFillTriangle() + 0x5ce byte opengl32.dll!__glRenderSmoothTriangle() + 0x175 bytes opengl32.dll!__glDoPolygonClip() + 0x2f0 bytes opengl32.dll!__glClipTriangle() + 0x28 bytes opengl32.dll!PARenderTriangle() + 0x32 bytes opengl32.dll!PolyArrayRenderTriangles() + 0x94 bytes opengl32.dll!glsrvFlushDrawPolyArray() + 0x50 bytes opengl32.dll!__glim_DrawPolyArray() + 0x128a bytes opengl32.dll!sbs_glDrawPolyArray() + 0x12 bytes opengl32.dll!glsrvAttention() + 0xef bytes opengl32.dll!glsbAttention() + 0xd8 bytes opengl32.dll!glcltBegin() + 0xbd bytes opengl32.dll!glcltDrawArrays() + 0x147 bytes osg100 osg64.dll!osg::Geometry::drawImplementation(osg::RenderInfo renderInfo) Line 796 + 0x17 bytes C++ osg100-osgUtil64.dll!osgUtil::RenderLeaf::render(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous) Line 84 C++ osg100-osgUtil64.dll!osgUtil::RenderBin::drawImplementation(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous) Line 484 C++ osg100-osgUtil64.dll!osgUtil::RenderBin::drawImplementation(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous) Line 513 + 0x13 bytes C++ osg100-osgUtil64.dll!osgUtil::RenderStage::drawImplementation(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous) Line 1398C++ osg100-osgUtil64.dll!osgUtil::RenderStage::drawInner(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous, bool doCopyTexture) Line 933C++ osg100-osgUtil64.dll!osgUtil::RenderStage::draw(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous) Line 1239 C++ osg100-osgUtil64.dll!osgUtil::RenderStage::drawPostRenderStages(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous) Line 1411 + 0x13 bytes C++ osg100-osgUtil64.dll!osgUtil::RenderStage::draw(osg::RenderInfo renderInfo, osgUtil::RenderLeaf * previous) Line 1304 C++ osg100-osgUtil64.dll!osgUtil::SceneView::draw() Line 1387 C++ osg100-osgViewer64.dll!osgViewer::Renderer::cull_draw() Line 867 C++ osg100-osg64.dll!osg::GraphicsContext::runOperations() Line 777 C++ osg100-osgViewer64.dll!osgViewer::ViewerBase::renderingTraversals() Line 812 C++ osg100-osgViewer64.dll!osgViewer::ViewerBase::frame(double simulationTime) Line 658C++ Thank you for any idea or help. Cheers, Jan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58171#58171 ___ 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
Re: [osg-users] build errors in VPB and latest trunks.
Hi Ewe, There are tweaks to VBP that have now been checked in, so an svn update may well help. Robert. On 5 February 2014 09:41, Uwe Woessner woess...@hlrs.de wrote: Hi, My reply comes a little late but I ran into the exact same problem and others might too thus I am posting my work around here. it turned out to be a problem with the log functions. I commented out //#include vpb/BuildLog and all calls to log(osg::INFO,... in SpatialProperties.cpp. after that, I was able to compile VPB successfully with VS 2010 ... Thank you! Cheers, Uwe -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58158#58158 ___ 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
Re: [osg-users] How to make overlaying osg::Billboard
Hi Petr, You can force objects to always appear by setting the StateSet::RenderBintDetails to a high bin number to make it draw after other objects, and then disable the depth test for that subgraph so it always gets drawn. Robert. On 4 February 2014 09:52, Petr Svoboda upd...@seznam.cz wrote: Hi, I made a scene, where I detect some collisions and I want to show progress of that collision. For example, you are poiniting at light switch and there is circle which is filled based on time spent pointing at the switch, so the light would turn/off after some timer period. That filling cricle is saved in images 1.png, 2.png... Then I make a textured quad Add quad to osg::Billboard ( I want that status bar will always be towards camera ) Add osg::Billboard to osg::Switch to switch between states (based on timer ) Here is code Code: osg::ref_ptrosg::Image image1 = osgDB::readImageFile(1.png); osg::ref_ptrosg::Texture2D texture1 = new osg::Texture2D; texture1-setImage( image1.get() ); osg::ref_ptrosg::Geometry quad1 = osg::createTexturedQuadGeometry( osg::Vec3(-0.5f, 0.0f,-0.5f), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) ); osg::StateSet* ss1 = quad1-getOrCreateStateSet(); ss1-setTextureAttributeAndModes( 0, texture1.get() ); ss1-setMode(GL_BLEND,osg::StateAttribute::ON); ss1-setRenderingHint(osg::StateSet::TRANSPARENT_BIN); osg::ref_ptrosg::Billboard timer1 = new osg::Billboard; timer1-setMode(osg::Billboard::POINT_ROT_EYE); timer1-addDrawable( quad1.get()); osg::Switch* switcher = new osg::Switch; switcher-addChild( timer1.get(),true); rootNode-addChild( switcher); This works well, but problem is that if there is some object between status bar and camera then status bar is covered. I want to render status bar always on top at the point of collision (intersection). What should I use? I tried HUD Camera, but didnt succed ( it just didnt render anything) Thank you! Cheers -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58138#58138 ___ 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
Re: [osg-users] Textures work great on all but 1 PC
Hi Paul, I don't think the OSG build settings are likely to be the issue, same applies ShaderComposer that will only be used if your explicitly invoke it. I suspect the drivers are at fault, have a look at updating them on the problem machine. Also look at the OSG examples, are these working? Robert. On 30 January 2014 22:31, Paul aquawic...@hotmail.com wrote: Hi, I've successfully compiled OSG and 3rd party libs for Windows, Mac, iOS, and Android. I am able to see my example program with textures on all devices successfully. All except for 1 PC. Works great on other Windows PC's.. just not this one. No textures. My CMAKE settings for mobile devices are: OSG_GL1_AVAILABLEOFF OSG_GL2_AVAILABLEOFF OSG_GL3_AVAILABLEOFF OSG_GLES1_AVAILABLE ON OSG_GLES2_AVAILABLE OFF OSG_GL_DISPLAYLISTS_AVAILABLEOFF OSG_GL_MATRICES_AVAILABLEON OSG_GL_VERTEX_FUNCS_AVAILABLEON OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ON OSG_GL_FIXED_FUNCTION_AVAILABLE ON OSG_CPP_EXCEPTIONS_AVAILABLE ON My CMAKE settings for desktops are: -- OSG_GL1_AVAILABLEON OSG_GL2_AVAILABLEON OSG_GL3_AVAILABLEOFF OSG_GLES1_AVAILABLE OFF OSG_GLES2_AVAILABLE OFF OSG_GL_DISPLAYLISTS_AVAILABLEOFF OSG_GL_MATRICES_AVAILABLEON OSG_GL_VERTEX_FUNCS_AVAILABLEON OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ON OSG_GL_FIXED_FUNCTION_AVAILABLE ON OSG_CPP_EXCEPTIONS_AVAILABLE OFF Here is the Notify log for the desktop that will NOT show textures: --- CullSettings::readEnvironmentalVariables() Render::Render() 00C91CB8 CullSettings::readEnvironmentalVariables() CullSettings::readEnvironmentalVariables() CullSettings::readEnvironmentalVariables() CullSettings::readEnvironmentalVariables() ShaderComposer::ShaderComposer() 00BE1100 ShaderComposer::ShaderComposer() 00BE1068 _availableQueue.size()=2 Applying osgViewer::ViewConfig : SingleWindow GraphicsContext::getWindowingSystemInterface() 004E1830 02A0E1E0 GraphicsContext::registerGraphicsContext 00C9FE40 ShaderComposer::ShaderComposer() 00BE1230 GraphicsContext::createNewContextID() creating contextID=0 Updating the MaxNumberOfGraphicsContexts to 1 View::setUpViewOnSingleScreen - GraphicsWindow has been created successfully. View::setSceneData() Reusing exisitng scene00C8F7D0 osg::State::_maxTexturePoolSize=0 osg::State::_maxBufferObjectPoolSize=0 OpenGL extensions supported by installed OpenGL drivers are: GL_AMD_performance_monitor GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_transpose_matrix GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_envmap_bumpmap GL_ATI_fragment_shader GL_ATI_meminfo GL_ATI_separate_stencil GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_copy_texture GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_gpu_program_parameters GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection GL_EXT_texture3D GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp
Re: [osg-users] A suspicious bug of MatrixD
Dear Robert, thank you for your reply, below is the code to reproduce the bug: // osg::Matrixd S = osg::Matrixd::scale(3.0, 4.0, 5.0); osg::Matrixd R = osg::Matrixd::rotate(osg::Quat(0.1, 0.5, 0.6, 0.7)); osg::Matrixd T = osg::Matrixd::translate(7.0, 8.0, 9.0); osg::Matrixd mat = S*R*T;//combine scale, rotation, and translation std::cout mat.getScale().x() mat.getScale().y() mat.getScale().z() std::endl;//Oops...seems wrong osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout x_vec2.length() y_vec2.length() z_vec2.length() std::endl; //seems correct // If the matrix combination above makes sense, then I guess what I found is indeed a bug. Thank you for your time and work. Best regards, Tianlan Shao On Thu, Apr 17, 2014 at 11:36 AM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Tianlan, Could you provide a small example that illustrates the problem? I did a quick test of: osg::Matrixd matrix = osg::Matrixd::scale(3.0,4.0,1.0); OSG_NOTICEMatrixd.getScale() = matrix.getScale()std::endl; And this works. I will need to have a think about a more complex scale set up before I can judge what it should be. Robert. On 15 April 2014 16:43, Tianlan Shao shaotianlan...@gmail.com wrote: Dear all, The following code in the header file MatrixD looks very suspicious to me: inline Vec3d getScale() const { Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } Shouldn't the index order be the other way around? I mean it should be inline Vec3d getScale() const { Vec3d x_vec(_mat[0][0],_mat[0][1],_mat[0][2]); Vec3d y_vec(_mat[1][0],_mat[1][1],_mat[1][2]); Vec3d z_vec(_mat[2][0],_mat[2][1],_mat[2][2]); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } The behaviour of my program was strange before I fix this problem. I'm not 100% percent sure, but since it's of fundamental importance, I still decided to report. Best regards, Tianlan Shao ___ 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] A suspicious bug of MatrixD
Hi Tianlan, I have done the following test where I provide a non unifom scale matrix then rotate it by 90 degrees, and then output the result of getScale() and the result of you suggested above: osg::Matrixd scale_then_rotated = osg::Matrixd::scale(3.0,4.0,1.0)*osg::Matrix::rotate(osg::inDegrees(90.0f),osg::Vec3d(0.0,0.0,1.0)); OSG_NOTICEMatrixd.getScale() = scale_then_rotated.getScale()std::endl; osg::Matrixd mat(scale_then_rotated); osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout x_vec2.length() y_vec2.length() z_vec2.length() std::endl; //seems correct The result I get on the console is: Matrixd.getScale() = 4 3 1 3 4 1 The getScale() version is correct, your suggestion is wrong as the matrix is now rotated 90 degrees so we'd expect the scale of the x and y axis to be swapped. If you were to compute the rotation and then remove this rotation and then do the getScale() I believe you'll get the result you are looking for with the existing code. Robert. On 17 April 2014 13:53, Tianlan Shao shaotianlan...@gmail.com wrote: Dear Robert, thank you for your reply, below is the code to reproduce the bug: // osg::Matrixd S = osg::Matrixd::scale(3.0, 4.0, 5.0); osg::Matrixd R = osg::Matrixd::rotate(osg::Quat(0.1, 0.5, 0.6, 0.7)); osg::Matrixd T = osg::Matrixd::translate(7.0, 8.0, 9.0); osg::Matrixd mat = S*R*T;//combine scale, rotation, and translation std::cout mat.getScale().x() mat.getScale().y() mat.getScale().z() std::endl;//Oops...seems wrong osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout x_vec2.length() y_vec2.length() z_vec2.length() std::endl; //seems correct // If the matrix combination above makes sense, then I guess what I found is indeed a bug. Thank you for your time and work. Best regards, Tianlan Shao On Thu, Apr 17, 2014 at 11:36 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Tianlan, Could you provide a small example that illustrates the problem? I did a quick test of: osg::Matrixd matrix = osg::Matrixd::scale(3.0,4.0,1.0); OSG_NOTICEMatrixd.getScale() = matrix.getScale()std::endl; And this works. I will need to have a think about a more complex scale set up before I can judge what it should be. Robert. On 15 April 2014 16:43, Tianlan Shao shaotianlan...@gmail.com wrote: Dear all, The following code in the header file MatrixD looks very suspicious to me: inline Vec3d getScale() const { Vec3d x_vec(_mat[0][0],_mat[1][0],_mat[2][0]); Vec3d y_vec(_mat[0][1],_mat[1][1],_mat[2][1]); Vec3d z_vec(_mat[0][2],_mat[1][2],_mat[2][2]); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } Shouldn't the index order be the other way around? I mean it should be inline Vec3d getScale() const { Vec3d x_vec(_mat[0][0],_mat[0][1],_mat[0][2]); Vec3d y_vec(_mat[1][0],_mat[1][1],_mat[1][2]); Vec3d z_vec(_mat[2][0],_mat[2][1],_mat[2][2]); return Vec3d(x_vec.length(), y_vec.length(), z_vec.length()); } The behaviour of my program was strange before I fix this problem. I'm not 100% percent sure, but since it's of fundamental importance, I still decided to report. Best regards, Tianlan Shao ___ 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 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
Re: [osg-users] BasicAnimationManager IntersectVisitor
Hi Maxim, On 25 February 2014 05:29, Maxim Gammer maxgam...@gmail.com wrote: I used the osgUtil :: IntersectionVisitor, but it did not fix the problem. Object based on the osgAnimation :: BasicAnimationManager not visible to IntersectionVisitor ( Perhaps the osgAnimation author, Cedric Pinson, might have an idea, but I'm afraid I'm in the same bout as you when comes to working out why the IntersectionVisitor is failing with the osgAnimation scene graph you have. As I don't have your scene graph and not the author of osgAnimation I'm rather limited to what I can do. The only suggestion I have is to look at the bound volumes, perhaps these aren't correct so the subgraphs get culled by the IntersectionVisitor, or perhaps the geometry leaves is not being updated prior to the IntersectionVisitor traversal. Using a debug to see what test within IntersectionVisitor is failing will give you the best clue to what might be amiss. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Finding adjacent TerrainTiles
Hi Lawrence, The osgTerrain::Terrain node that decorates an VPB generated database keeps track of all the tiles via their TileID index, you can then get the tile based on this TileID and getting the neighbours is simply a case of adding to the TileID x and y values. Robert. On 21 February 2014 01:40, lawrence bertoldi lbe...@comcast.net wrote: Hi, I'm trying to find all of the tiles terrain that are adjacent to any particular tile. Is there a way to do this... or maybe a million ways? Or is there a good reference on osgTerrain? something that will give a layout hint etc? ... Thank you! Cheers, lawrence -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58263#58263 ___ 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
Re: [osg-users] PagedLOD TerrainTile
Hi Lawrence, Your custom NodeVisitor will be using the default traversal selection for PagedLOD rather than one based on camera distance for the PagedLOD child as is done in the cull traversal.You'll need to set up your custom NodeVisitor with the Camera position, the following NodeVisitor virtual methods are what PagedLOD invokes to work our which child range to select, note the default 0 which gives you the highest. Have a look at the CullVisitor implementation of these for inspiration. /** Get the distance from a point to the eye point, distance value in local coordinate system. * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. * If the getDistanceFromEyePoint(pos) is not implemented then a default value of 0.0 is returned.*/ virtual float getDistanceToEyePoint(const Vec3 /*pos*/, bool /*useLODScale*/) const { return 0.0f; } /** Get the distance of a point from the eye point, distance value in the eye coordinate system. * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. * If the getDistanceFromEyePoint(pos) is not implemented than a default value of 0.0 is returned.*/ virtual float getDistanceFromEyePoint(const Vec3 /*pos*/, bool /*useLODScale*/) const { return 0.0f; } /** Get the distance from a point to the view point, distance value in local coordinate system. * Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. * If the getDistanceToViewPoint(pos) is not implemented then a default value of 0.0 is returned.*/ virtual float getDistanceToViewPoint(const Vec3 /*pos*/, bool /*useLODScale*/) const { return 0.0f; } Robert. On 24 February 2014 22:23, lawrence bertoldi lbe...@comcast.net wrote: Hi all I'm working in a osg::NodeVisitor to see TerrainTiles that are Currently Active, Which I thought were the visible tiles... when I zoom in to the DB and look at hi rez tiles, then zoom out again to see lo rez tiles, the tile printout information always the highest level for that location.. and while I can see the mesh in the window is a low res tile, or page or cell etc... my printout always shows the highest LOD data. Here is the code virtual void apply(osgTerrain::TerrainTile tile) { osgTerrain::TerrainTile* TT = dynamic_castosgTerrain::TerrainTile*(tile); osgTerrain::TileID tid = tile.getTileID(); for (int i=0;i tid.level; i++) std::cout | ; std::cout Tile X tid.xTile Y tid.y Tile level tid.level std::endl; } virtual void apply(osg::Group group) { static int depth = 0; std::cout depthgroup G group.className() has group.getNumChildren() C std::endl; // distinguish a tile from other groups osgTerrain::TerrainTile* tile = dynamic_castosgTerrain::TerrainTile*(group); if (tile) { apply(*tile); } else { depth++; traverse(group); depth--; } } ... Thank you! Cheers, lawrence -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58283#58283 ___ 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
Re: [osg-users] how to use symbols in ttf file like normal characters
Hi Peter, I'm not clear on what the problem is. The characters you pass to the osgText::Text can be a std::string which is nice and convenient for ASCII characters, but for extended characters sets you'll want to use the wider character support. The wide character support is provided by osgText::String that osgText::Text uses internally. osgText::String is a std::vectoruint, have a look the include/osgText/String header. As String is just a std::vectoruint you'll be assign the characters directly. Robert. On 7 August 2013 09:28, peter nxg2...@163.com wrote: I have a font file in .ttf format with mainly symbols. I want to use these symbols as osgText::Text in my application. I am not able to understand what should I specify in text-setString Function so that I can visualize the symbols. I am attaching the font file which i am using as test case. It will be great if somebody can tell me how can these fonts be used as normal text. Thank you! Cheers, peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55794#55794 ___ 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
Re: [osg-users] Usign OSG Shader
Hi Srikanth, Your shader just needs to handle the base texture as well as the colour you generate for the height. I can't really teach you all you need to know from a simple post, I have to recommend that you learn a bit more about OpenGL shaders directly from OpenGL books/resources on the topic. The OSG just wraps OpenGL shaders so what you learn from OpenGL resources directly applies. Robert. On 12 August 2013 05:54, Srikanth K P srika...@nal.res.in wrote: Hi, Hello. I am new to OSG. I have been given a task to drape the terrain with different color depending on altitude from eye point. I am going through the OpenSceneGraph 3.0 Beginner's Guide. I went through thro the shader example by OSG. I modified the program which takes the cow model with terrain. The problem I am facing is the color fully covers the terrain texture and texture is not visible at all. Is there a way to blend the color with terrain texture ? ... Thank you in advance Cheers, Srikanth -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55821#55821 ___ 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
Re: [osg-users] Manipulator on RTT camera
Hi Baptiste, The osgdistortion example is probably the best place to learn how to do the type of RTT that you want. The key part is that your RTT Camera will be a slave Camera attached to the viewer, with the slave Camera using the default RELEATIE_RF RefnerceFrame to it inherts the view and projection matrix from the Viewer's master Camera that the camera manipulator controls. A second slave Camera renders to the GraphicsWindow but is set up with an ABSOLUTE_RF ReferenceFrame so that it ignores the master Camera view and projection matrix so you can do all the screen space post processing effects you want. Robert. On 20 August 2013 18:38, Baptiste S. baptiste.sansie...@noos.fr wrote: Hi, I'm trying to use mutlipass rendering with osg, I would like to render my 3d scene in a texture and use this texture in some fragment shader for post-processing (I'm working for GL ES2). That's my first time with OSG, there's a lot of obscure things for me, so be clement please :) 1 - I've just created a RTT camera inspired from osgprerender (so RTT cam is part of scene graph) I have now my 3d scene rendered on a plane ! Cool ! My first problem is that I'm using a camera manipulator (trackball), and this manipulator is attached to the main camera so I manipulate the plane with the texture instead of my 3d scene ... :( I would like to attach the manipulator to my RTT camera, and the main camera should just be a static ortho cam !! I've seen this post : Attach camera manipulator to RTT camera instead of viewer? (cannot paste the link cause it's my first post ... :? ) which describe exactly the same problem, I understand that I can only attach the manipulator to the main camera or to it's slave (using setAllowEventFocus), not on cameras added to scene graph. But I have no idea on how to use slave camera for rendering to texture ? All provided exemples I have seen use the same method that I used Could you enlighten me about this point ? 2 - Another thing I was wondering is how can I order my RTT cameras if I have more than one ? Using camera-setRenderOrder(osg::Camera::PRE_RENDER); doesn't allow me to specify which RTT camera should be render in first place ? Thank you! Cheers, Baptiste -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55909#55909 ___ 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
Re: [osg-users] switching shading between 2 passes
Hi Baptiste, I would recommend trying to keep a minimal set of osg::Program that are provided high up in the scene graph and apply to whole chunks. To do the multi-pass you'll then duplicate the high level nodes but share the subgraphs so the bulk of the scene graph remains the same. Robert. On 21 August 2013 18:12, Baptiste S. baptiste.sansie...@noos.fr wrote: Hello, I have a big 3d scene, so I have some drawables, each drawable have his stateSet and each stateSet have a program (shader.vsh+shader.fsh) (lambert/phong/...). It works fine for a single pass. But if I want to make my rendering in 2 passes using different shading ?... I explain : - In the first pass I wan't to bake some data in some textures (using FBO) - One unique shader for the scene - In the second pass, I will use classical illumination shaders and render to a texture too - One shader per drawable - In the last pass, I just render a quad with a shader wich will cook my different textures ... So my problem is : how do I render the same scene twice with 2 different shading without parsing all my drawables in my draw func to modify shaders ? Is it possible to override stateSets ? (Do not tell me to duplicate my scene please :? ) Thank you for your help ! Cheers, Baptiste -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55936#55936 ___ 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
Re: [osg-users] Geometry in a Geode
Hi Quentin, You haven't provide enough information about what you are doing to know what is going wrong. My best guess is that you've got DisplayLists enabled on the osg::Geometry (this is the default) but haven't called dirtyDisplayList() and dirtyBound(); Robert. On 27 August 2013 11:18, Quentin quentin.blanc...@gmail.com wrote: Hi, I'm trying to add some Geometry in the same geode but just one is display, how to display some geometry in a geode? Thank you! Cheers, Quentin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55997#55997 ___ 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
Re: [osg-users] Framerate Drop in Rendering Multiple 1080p videos in OsgViewer
Hi Balajee.R.C, I would suspect a driver issue with it getting overwhelmed by the amount of data and stops sync the CPU and GPUs efficiently. Try other hardware and other drivers to see if you can see a pattern. Robert. On 16 September 2013 10:12, Balajee.R.C balaje...@gmail.com wrote: Hi, I have an application where I have to show multiple 1080p AVI videos rendering at the same time. I have implemented this using FFMPEG plugin with the code shown below. Most of the code is from osgmovie sample. Upto 3 videos, the framerate is constant and shows no drop. However, I notice a significant frame rate drop for every subsequent video source added. With 3 video sources, the framerate peaks at around 480 fps (60 fps with Vsync on) while with 6 videos, the frame rate drops to less than 80 (less than 20 fps with VSync turned on). Note that CPU utilization never goes over 30% throughout the entire process. I also find that when the view shows only 3 videos, then the frame rate is at maximum (since presumably, the other 3 videos are getting culled out). When all 5 videos become visible however, the frame rate drops as described above. This looks to me like a rendering issue. Am I doing something wrong? Essentially, osg is rendering 6 textured quads (its the plugins that update the textures) and hence musn't show frame rate drops. Could someone please give me some hints as to how I can improve rendering performance? Thank you! Cheers, Balajee.R.C TestBed: Intel Core i7 (3.07 GHz) 4GB RAM AMD Radeon HD 6800 Windows 7 Visual Studio 2008 OpenScenegraph 3.2.0 Release Code: osg::Geometry* CreateTexturedQuadGeometry(const osg::Vec3 pos,float width,float height, osg::Image* image, bool useTextureRectangle, bool xyPlane, bool option_flip) { bool flip = image-getOrigin()==osg::Image::TOP_LEFT; if (option_flip) flip = !flip; if (useTextureRectangle) { osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos, osg::Vec3(width,0.0f,0.0f), xyPlane ? osg::Vec3(0.0f,height,0.0f) : osg::Vec3(0.0f,0.0f,height), 0.0f, flip ? image-t() : 0.0, image-s(), flip ? 0.0 : image-t()); osg::ref_ptrosg::TextureRectangle texture = new osg::TextureRectangle(image); texture-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); texture-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); pictureQuad-getOrCreateStateSet()-setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); return pictureQuad; } else { osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos, osg::Vec3(width,0.0f,0.0f), xyPlane ? osg::Vec3(0.0f,height,0.0f) : osg::Vec3(0.0f,0.0f,height), 0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f); osg::ref_ptrosg::Texture2D texture = new osg::Texture2D(image); texture-setResizeNonPowerOfTwoHint(false); texture-setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); texture-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); texture-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); pictureQuad-getOrCreateStateSet()-setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); return pictureQuad; } } osg::ref_ptrosg::Node addAviVideo(const std::string filepath, const float xPos, const float yPos, float width, float height) { bool useTextureRectangle = false; bool xyPlane = false; bool flip = false; osg::ref_ptrosg::Image image = osgDB::readImageFile(filepath.c_str(), osgDB::Registry::instance()-getOptions()); osg::ref_ptrosg::ImageStream imagestream = dynamic_castosg::ImageStream*(image.get()); osg::ref_ptrosg::Geode geode = new osg::Geode(); if (imagestream) { osg::ImageStream::AudioStreams audioStreams = imagestream-getAudioStreams(); imagestream-play(); } if (image) { osg::notify(osg::NOTICE)image-s()image-s() image-t()=image-t() aspectRatio=image-getPixelAspectRatio()std::endl; float width = image-s() * image-getPixelAspectRatio(); float height = image-t(); osg::ref_ptrosg::Drawable drawable = CreateTexturedQuadGeometry(osg::Vec3f(0.f, 0.f, 0.f), width, height,image, useTextureRectangle, xyPlane, flip); if (image-isImageTranslucent()) {
Re: [osg-users] [forum] update partial of geometry
Hi Ding, Rather than using thousands of PrimitiveSet's try building your geometry with a smaller set of PrimitiveSet, this will result in a much lower CPU overhead when you are rendering without display lists. Robert. On 25 September 2013 11:03, ding zheng dingzheng...@hotmail.com wrote: Hello Everyone, I am a new osg user using 3.1.3. Recently I am trying to make a dynamic geometry drawing on win7 using NVIDIA. I have one geometry which contains a huge number of primitive sets (for example 7000) and one vertices around 800,000. All the primitive sets are defined as range primitive set type. I use BIND_PRIMITIVESET in color binding. each set corresponds to one element in the colorarray. after constructing the geometry, the geometry display is ok. If I set using vertexbufferobject( true), my application is almost blocked. I got very very low frame rate. If I set using displaylist( true ), the frame rate is much high than using vertexbufferobject and my application works fine with the manipulations such zoom(in/out ). Now, i got questions. my idea is only to change one element of the colorarray and hope only updating the primitive set which is linked to the changed color element. The rests of primitive sets should not be updated. I hope this process should be fast and simple. But the dirtyldisplaylist update all colors and redraw all. So before I change the color, I set using displaylist as false, after changing, I set using display back as true. such way avoids to call dirtydisplaylist. but the speed almost is same as using dirtydisplaylist. My geometry data variance is set as Static. I read some threads. Is 3.2 can solve this problem? Can someone help me? Thanks ding -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56429#56429 ___ 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
Re: [osg-users] DatabasePager and incremental compiler operation in a shared context
Hi Jose, The OSG's is written to handling multi-theading of shared contexts as handling this special case would require us to add lots of mutex locks to all OpenGL code that is setting or using OpenGL objects. It's better to avoid shared contexts. Robert. On 24 September 2013 06:34, Jose Ignacio Anguita jiangu...@indra.es wrote: Hi, I'm currently using OSG 3.0.1 I'm having a problem with the Database Pager when i use the IncrementalCompileOperation with a shared context. I'm trying to compile the GL objects in a separate thread. DatabasePager run in the main thread and send operations to the incremental compiler that is running in a different thread with a shared context. Everything seems to work fine, but eventually I can get these messages: GLBufferObjectSet::checkConsistency(): Error. Texture::TextureObjectSet::checkConsistency(): Error when this happens, you can see some texture with bad data or random geometry in the scene. However, there are no errors GL. One test has been to eliminate in the incremental compiler any compile operation, passing this to run on the main thread first painted. This all works fine but I'm not compiling on a different thread so the performance loss falls on the main thread. I think the problem is that the two threads share the managers and is not thread safe. Can this be possible? if so, how I can set up a system to compile GL objects in a shared context? Thank you! Best, Jose Ignacio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56447#56447 ___ 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
Re: [osg-users] How to get the colors of the points from a osgb or osgt file
Hi Yong, You'll need to load the file then use a custom NodeVisitor to traverse through the scene graph to locate all the osg::Geode leaves, then look at all the osg::Geometry within the Geode's and get the colours from the ColorArray attached to the osg::Geometry. Have a look at the NodeVisitor implementations in the OSG to see how they work. Also look at the examples and published books. Robert. On 24 January 2014 05:51, Young ff...@163.com wrote: Hi, I have a osgb/osgt file, and I want to get the color of each point contained in this file, what should I do? I am a newcommer to osg, and any suggestion is welcome. Thank you! Cheers, Young -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57980#57980 ___ 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
Re: [osg-users] osgTexture Dynamic Image Loading
Hi Arjun, There is way too little information about what you are specifically doing to know what you are doing wrong. In principle you can update osg::Image or assign new osg::Image to osg::Textutre and they should update, but as you don't provide an indication let alone code of how you actually updating the imagery there is no way for others to know what to suggest next. Robert. On 23 January 2014 11:13, Arjun arjun.sachdev...@gmail.com wrote: Hi, I have a OSG texture that i have created to display and image in it with the trigger being an input to my application. I can successfully display the image in the texture but the problem arises when this image needs to be changed. When the trigger is called the second time my previous image is overwritten and all RGB values are spoilt.(Black Blob) I would like to know if there is a way to remove the previous image in my texture before rendering the new image in the same texture at the same geometric coordinates. Once i have added the drawable to my osg::Group is there a way to still access my texture individually? osg::Image* sym = new osg::Image(); // This image is changed constantly at a trigger event sym-setImage(img.width(), img.height(), 1, 4, GL_RGBA, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE, 1); sym-flipVertical(); osg::Geode* pyramidGeode = new osg::Geode(); osg::ref_ptrosg::Group roadSign; float imageWidth = img.width(); float imageHeight = img.height(); osg::ref_ptrosg::Geometry pictureQuad1 = osg::createTexturedQuadGeometry(osg::Vec3(0, -14, 3), osg::Vec3(0,-10, 0), osg::Vec3(0,0, 10), 0, 1, 1, 0); osg::ref_ptrosg::Geometry pictureQuad2 = osg::createTexturedQuadGeometry(osg::Vec3(0, 24, 3), osg::Vec3(0,-10, 0), osg::Vec3(0,0, 10), 0, 1, 1, 0); pyramidGeode-addDrawable(pictureQuad1); pyramidGeode-addDrawable(pictureQuad2); osg::Texture2D* texture = new osg::Texture2D; texture-setDataVariance(osg::Object::DYNAMIC); texture-setImage(sym); osg::StateSet* stateOne = new osg::StateSet(); stateOne-setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); pyramidGeode-setStateSet(stateOne); roadSign-addChild(pyramidGeode); Thank you! Cheers, Arjun -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57966#57966 ___ 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
Re: [osg-users] Render frame only for one camera
Hi Andreas, Implementing picking using OpenGL is typically very inefficient as it forces a round trip to the GPU and stalls the CPU and GPU while they wait for each other. Is there a reason why you can't do the picking using a CPU operation? As for doing custom Camera traversals, there is no need to add/remove from the GraphicsContext, simply assign a Camera and toggle it on/off using the Camera::NodeMask, do camera-setNodeMask(0x0) to turn off and camera-setNodeMask(0x) to switch on. On 22 January 2014 23:00, Andreas Henne heandr...@live.de wrote: Hi, I implemented picking by rendering each object with a unique color ID to a texture. A lookup in the texture on the mouse cursor position then gives the color id of the selected object. When the user performs a mouse click, I need to update the picking texture. To avoid unnecessary rendering, I want to update only the picking texture and not all other cameras. I found that this simple task (taking a picture with one RTT camera without updating the others) is difficult to implement in OSG, because GraphicsContext::runOperations renders images for all cameras attached to the context. Of course I could use a seperate context for the picking, but that shouldn't be necessary in my opinion. I managed to implement what I want by adding and removing cameras to the context on the fly, but is this a good way to do this? For example, in GraphicsContext::removeCamera the function releaseGLObjects is called and I'm not sure how this could impact performance. Thank you! Cheers, Andreas -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57958#57958 ___ 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
Re: [osg-users] Wrong geode display on screen
Hi Sylvain, It sounds like the OpenGL object caches aren't being cleared when the graphics context deletes (the OSG has to use these caches as you can't delete OpenGL from any thread that can delete a scene graph object.) There is lots of support within the OSG to try and catch this properly, but there may be usage combinations that break this. I really don't know enough about the specifics of your implementation to know what might be amiss. You don't say which version of the OSG you are using, older versions din't catch all the usage cases of closing context, so I would suggest you are use a recent version of the OSG to make sure you have the best chance of all the loop holes with context/viewer destruction being closed. Failing that then calling the osg::discardAllGLObjects(contextID) is a brute force way of clearing all the caches. Robert. On 10 January 2014 13:48, Sylvain Comtois sylvain.comt...@gel.ulaval.ca wrote: Hi, We have a pretty complex software, under windows, that have a window the user can close and open for 3D rendering with OSG. When the user close the window we delete all OSG object except some node create from .osg or .ive files to speed up the next load process. The first time the user open the window we create the viewer and we load the nodes and everything just work perfectly. When the user close the window, everything is delete and we keep some nodes in a table. The next time the user open the window we recreate the viewer and we create new node and use again node store in the table. In this second or subsequent creation of the window we have some or all of the nodes, stock in the table, that are not display correctly. The nodes newly create are always corrects. By example, if we have a table with four objects (car, plane, box and ball) the ball can be show in place of the car or sometime just nothing is showed. We believe we using the correct geode because of the followings test: First we save the geode in osg file for the first time we open the window when the geode is correct and in the next time the geode is not correct. We compare the two files and the only difference are UniqueID MatricTransform_0 and UniqueID StateSet_0. Second we draw a bounding box around the object and the bounding correspond to the object we expected to be show. We use the ComputeBoundVistor to find the dimensions of the object. The software is also use in a realty center (cave) when in this configuration we use 4 cameras when each camera represent a wall of the cave. We have one master camera with three slaves cameras sharing the same scene data and the same viewer. In this configuration we can also observe the problem but in a different manner. Some camera show the right geode and some show a wrong geode. We only have to move the geode from one camera to another to see the two representation of the geode. Like in one camera mode, the problem is never present the first time we open the windows. To clear the osg environment, we only set all reference pointer we use to 0 (viewer, scenegraph, cameras, etc). We also verify in the debug log that the destructor of the viewer is called. But according to the log, it seem the 'GraphicContext' is not completely close. Do we have to do something else to perfectly clean all the OSG environment. Does OSG use internal cache table that we need to reset ? Thank you! Cheers, Sylvain -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57854#57854 ___ 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
Re: [osg-users] How to use more than 4 texture units?
Hi Hailong, The OSG itself places no restriction on the number of texture units, but some OpenGL drivers can do, particularly for the fixed function pipeline, perhaps you are hitting up against this. I know that NVIdia have recently reduced the number of texture units they support using the fixed function pipeline. Robert. On 21 January 2014 14:37, Hailong FU longlong_...@163.com wrote: Hi, Right now I am texturing a digital surface model using many (more than 4) airborne images, for example I want to texture the 6 facades of a building. I am using OSG to do the meshing and texturing. However, I found one object can only show the first 4 image textures, the 5th 6th won't show up. What's the problem when I use more than 4 texture units for one geometry? Could you give some hint please? osg::ref_ptrosg::StateSet stateOne = new osg::StateSet(); stateOne-setDataVariance(osg::Object::DYNAMIC); for(int i=0; i imgs; i++) { osg::ref_ptrosg::Texture2D texture = new osg::Texture2D; texture-setDataVariance(osg::Object::DYNAMIC); texture-setImage(img[i]); texture-setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_BORDER); texture-setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_BORDER); texture-setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_BORDER); texture-setBorderColor(osg::Vec4d(1,1,1,0)); osg::ref_ptrosg::TexEnv texenv = new osg::TexEnv; texenv-setMode(osg::TexEnv::MODULATE); stateOne-setTextureAttribute(i,texenv,osg::StateAttribute::ON); texture-setInternalFormatMode(osg::Texture::USE_IMAGE_DATA_FORMAT); texture-setResizeNonPowerOfTwoHint(1); stateOne-setTextureAttributeAndModes(i,texture,osg::StateAttribute::ON); } geode-getDrawable(0)-setStateSet(stateOne); ... Thank you! Cheers, Hailong -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57945#57945 ___ 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
Re: [osg-users] error C2065: 'Cube': undeclared identifier
Hi Lukas, There is no way for a 3rd Party to know what is amiss with your code with such scant details. What I can say is that with a compiler error like this it's entirely down to your own C++ code and really nothing to with the OSG. This is an OSG forum/mailing list, we can help you with OSG stuff, but C++ programming is something you best learn with online resources and books. Another general note, don't use C pointers for scene graph objects, you'll very likely end up with dangling pointers and crashes. Robert. On 5 January 2014 23:17, Lukas Koebler lukasnachhi...@gmail.com wrote: Hi, the top of my programm is called Plugin. Till now I got to add a quadrangle: Code: //header: std::listQuadrangle * m_BoxList; void addBox(Quadrangle *box,bool setdefaultpos); //cpp: void Plugin::addBox(Quadrangle *box,bool setdefaultpos) { m_BoxList.push_back(box); if(setdefaultpos) setBoxPosition(box); } In the header of the Quadrangle use the osgWidget::Box Code: class Quadrangle : public osgWidget::Box { public: Quadrangle (std::string name, osgWidget::Box::BoxType, osg::Vec4 color); } everything is working fine till now. But now I wanna add on the same way a cube and i get this disgusting error C2065: 'Cube': undeclared identifier. I tried it on so many ways now I hope one of you can tell me my fould. Code: //header: std::listCube* m_CubeList; void addBox(Cube *cube); //cpp: void Plugin::addCube(Cube *cube) { m_CubeList.push_back(cube); } And at least the header of the Cube Construktor: Code: class Cube : public osg::Geode { public: Cube(); } All data are reduced Thank you! Cheers, Lukas -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57798#57798 ___ 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
Re: [osg-users] new constructor
Hi Lukas, You can't do a addChild() on a object that is a subclass from osg::Geode because Geode has no addChild() method. Please look at the headers. Robert. On 5 January 2014 12:40, Lukas Koebler lukasnachhi...@gmail.com wrote: Hi, I´m new in OSG and I hope you can help me. I´ve done a new constructor called 3dBox. In this constructor I wanna create a cube. Code: mp_Quader2 = new Geode(); 3dBox(*mp_Quader2); this-addChild(mp_Quader2); This is how I want it in the end. But it doesn´t work jet. The constructor: Code: 3dBox::3dBox(Geode *mQuader){ //mQuader = new Geode(); // Eigene Geometrie Klasse erzeugen mGeom = new Geometry(); // Punktearray mit 6 Punkten für schrägen Quader Vec3Array *vec3array = new Vec3Array(); Vec3Array *vec3array2 = new Vec3Array(); vec3array-push_back(Vec3(0.,0.,-50.)); vec3array-push_back(Vec3(200,0.,-50.)); vec3array-push_back(Vec3(200,100,-50.)); vec3array-push_back(Vec3(0.,100,-50.)); vec3array-push_back(Vec3(0.,0.,120)); vec3array-push_back(Vec3(150,0.,120)); vec3array-push_back(Vec3(150,100,300)); vec3array-push_back(Vec3(0.,100,300)); // Indexarray erzeugen DrawElementsUInt *indarray = new DrawElementsUInt(PrimitiveSet::QUADS,0); indarray-push_back(0); indarray-push_back(1); indarray-push_back(2); indarray-push_back(3); indarray-push_back(4); indarray-push_back(5); indarray-push_back(6); indarray-push_back(7); indarray-push_back(0); indarray-push_back(1); indarray-push_back(5); indarray-push_back(4); indarray-push_back(3); indarray-push_back(2); indarray-push_back(6); indarray-push_back(7); indarray-push_back(0); indarray-push_back(3); indarray-push_back(7); indarray-push_back(4); indarray-push_back(1); indarray-push_back(2); indarray-push_back(6); indarray-push_back(5); mGeom-setVertexArray(vec3array); mGeom- addPrimitiveSet(indarray); HfT_osg_StateSet *stateset = new HfT_osg_StateSet(STRANSPARENT,Vec4(1.,0.,0.,0.5)); mGeom-setStateSet(stateset); // Jetzt geom der geode zuweisen mQuader-addDrawable(mGeom); mQuader-setName(TestQuader); mTrans = new MatrixTransform(); mTrans-addChild(mQuader); } In the header: Code: class 3dBox : public osg::Geode Can you help me and explane to me why I can´t do Code: this-addChild(mp_Quader2); and what I can do to make it work. Important to say is when I do the thinks I do in the constructor in the class it works fine. Thank you! Cheers, Lukas -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=57796#57796 ___ 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
Re: [osg-users] glGenBuffers not supported by OpenGL driver
Hi yangzhongqi, You don't say how you've created the graphics context, what OpenGL version the context reports, what version of OpenGL your hardware and drivers supports so... there really is far too many unknowns for us to be able to do anything other than guess. My guess is however you've created your context it ain't one that supports modern OpenGL. Robert On 27 December 2013 07:50, yangzhongqi yangzhongqi...@163.com wrote: Hi,group I build osg3.2.0 with qt5.1.0,and I build osgearth2.5.0 with qt5.1.0,when I run osgearth_qt sample,it reported errors, Warning: detected OpenGL error 'invalid operation' at Before Renderer::compil Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: In Texture::Extensions::setupGLExtensions(..) OpenGL version test fail requires valid graphics context. Scaling image from (256,256) to (-842150451,-842150451) Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Scaling image from (256,256) to (-842150451,-842150451) Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Scaling image from (256,256) to (-842150451,-842150451) Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Scaling image from (256,256) to (-842150451,-842150451) Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Scaling image from (256,256) to (-842150451,-842150451) Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glGenBuffers not supported by OpenGL driver Error: glBindBuffer not supported by OpenGL driver Error: glBufferData not supported by OpenGL driver Error: glBufferData not supported by OpenGL
Re: [osg-users] osg::Program and osgViewer::Renderer::Compile
HI Filip, I don't know whether it'll help with your case, but it's worth trying, there are fixes in svn/trunk and OSG-3.2 for handling osg::Program combinations in GLObjectVisitor/IncrementalCompileOperation so I'd recommend you try one of these versions of the OSG to see if that helps. Robert. On 28 February 2014 16:02, Filip Arlet fili...@seznam.cz wrote: Hi, I have problem with osg::Program and osgViewer::Renderer::compile(). I have scene graph with shader only for some part of it. But when display lists are compiled, shader is always active. Its geometry shader with LINES as input so any other geometry will raise opengl error. Shader even remains active after compile. So if I draw scene without my LINES with geometry shader. It still produces the same error. Only after first encounter of my LINES with shader, it fixes. Any suggestions ? PS: 1) When I add blank osg::Program() on root node, it obviosly fixes the initial rendering problem, but not problems during compile operation. 2) I dont want to give up on Display Lists since I found that implementation of VBO has bugs on some Intel and Ati(Amd) implementation and its major problem customers. Thank you! Cheers, Filip -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58401#58401 ___ 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
Re: [osg-users] How integrate openGL code inside OSG
Hi JacaYang, You don't say what the problem you are seeing is. In general you are going the direction that should work, but there is too little information about how you assinging your callback or what the problems you are seeing are. In general I'd say that integrating OpenGL code can be a bit awkward because both OSG OpenGL code and 3rd party OpenGL code change OpenGL state so they can influence each other. Robert. On 28 February 2014 11:35, JacaYang jacay...@sina.com wrote: Hi, I want to integrate openGL code inside OSG except for using osg::Drawable callback method.I have tried to use get GraphiContex and then call openGL code.but it not work at all.below is my code . glPushAttrib(GL_ALL_ATTRIB_BITS); glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_TEXTURE); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); //drawing in your own openGL code glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_TEXTURE); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); Thank you! Cheers, JacaYang -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58399#58399 ___ 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
Re: [osg-users] [build] Building with Eclipse and MinGW. __int64 definition in GL
Hi Marc, MinGW isn't a commonly used platform for OSG users so I'm afraid it's a case of those who want to use MinGW need help fix the problems as they occur. If you have a fix then subscribe to and a send en email with the whole modified file to osg-submissions mailing list so it can be reviewed and consered to merge with svn/trunk and/or the OSG-3.2 branch. As for the specific suggestion of adding include stdlib.h, I'd be hesitate to add this for all platforms but a specific case for MinGW would be OK, although would feel a bit hacky. If there is already a MinGW code path in the header than adding it that section would be most natural. Robert. On 6 February 2014 11:06, Marc Jacquin amarc.jacq...@gmail.com wrote: Hi all, Trying to build OSG with Eclipse and MinGW on Win 7 reports a _int64 does not name a type error in GL header file at lines 147 148: #if !defined(GL_EXT_timer_query) !defined(OSG_GL3_AVAILABLE) #ifdef _WIN32 typedef __int64 GLint64EXT; typedef unsigned __int64 GLuint64EXT;[/u] #else typedef long long int GLint64EXT; typedef unsigned long long int GLuint64EXT; #endif #endif Adding a stdlib include at the top of GL.h seems to fix it. Is that the proper way to do it ? Thanks. Cheers, Marc -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58174#58174 ___ 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
Re: [osg-users] [build] Building with Eclipse and MinGW. __int64 definition in GL
17 апр. 2014 г., в 20:19, Robert Osfield robert.osfi...@gmail.com написал(а): Hi Marc, MinGW isn't a commonly used platform for OSG users so I'm afraid it's a case of those who want to use MinGW need help fix the problems as they occur. If you have a fix then subscribe to and a send en email with the whole modified file to osg-submissions mailing list so it can be reviewed and consered to merge with svn/trunk and/or the OSG-3.2 branch. As for the specific suggestion of adding include stdlib.h, I'd be hesitate to add this for all platforms but a specific case for MinGW would be OK, although would feel a bit hacky. If there is already a MinGW code path in the header than adding it that section would be most natural. Robert. I think switching to mingw-w64 toolchain is a best variant here. Mingw-w64 don’t have any problems with it and has more completely runtime than Mingw.org toolchains. I’m developer of MSYS2 project and provide about 200 precompiled OpenSource packages for mingw-w64 both 32 and 64-bit. OSG also provided. Also we hard working with mingw-w64 developers to fix any issues that we find. Regards, Alexey. On 6 February 2014 11:06, Marc Jacquin amarc.jacq...@gmail.com wrote: Hi all, Trying to build OSG with Eclipse and MinGW on Win 7 reports a _int64 does not name a type error in GL header file at lines 147 148: #if !defined(GL_EXT_timer_query) !defined(OSG_GL3_AVAILABLE) #ifdef _WIN32 typedef __int64 GLint64EXT; typedef unsigned __int64 GLuint64EXT;[/u] #else typedef long long int GLint64EXT; typedef unsigned long long int GLuint64EXT; #endif #endif Adding a stdlib include at the top of GL.h seems to fix it. Is that the proper way to do it ? Thanks. Cheers, Marc -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58174#58174 ___ 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] multi-threading troubles with 2 graphic cards
Hi Robert, thanks very much for your answer. I have updated OpenThreads lib (3.2.0-3.3.0) but it does not help much. In fact I think that OSG works well but not like I espect it to work... Let me explain: I run my application twice (once in each X server) in parallel. So there is just one camera per application, then first draw thread works with cpu 1 and second draw thread (that is in fact also first draw thread for the second application) works also with cpu 1 ! I think that's a normal behaviour for OSG, (example with drawThreadPerContext model) because first cpu number is initialized to 1 in this loop: ViewerBase.cpp line 381... Code: unsigned int processNum = 1; for(citr = contexts.begin(); citr != contexts.end(); ++citr, ++processNum) { ...gc-getGraphicsThread()-setProcessorAffinity(processNum % numProcessors); ... } Perhaps I could get a pointer on draw thread with viewer::getAllThreads and force draw thread cpu affinity... Cheers, Thierry -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59036#59036 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Wrong geode display on screen
Hi Robert, We use the last stable release 3.2. Thank you! Cheers, Sylvain -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59037#59037 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgQt QWidgetImage as HUD not getting events
I have tried adding the InteractiveImageHandler to the view that I want to handle them, but they still do not get any events. Any other suggestions? Cheers, Nick -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59038#59038 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgQt QWidgetImage as HUD not getting events
I found that I was using the wrong constructor for the Interactive Image Handler, I think; It seems that the IIH expects the image to either be part of the scene OR be a full screen HUD, not the sort of half-and-half that I have. Using the other constructor for the IIH, one of my widgetImages gets events, but the other doesn't, and the position and aspect ratio of them gets broken. The Handler doesn't seem to support non-fullscreen HUDs. Working on a subclass... Anyone have a similar experience before / have a quick fix? Cheers, Nick -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59039#59039 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Issues with alpha blended texture overlay
Hi, I tried to add a texture overlay that gets rendered through an orthographic projection at the top of the scene graph. When I do so all objects in the background of the scene that have transparency are no longer visible. What am I doing wrong? The texture is a png with transparency applied to a quad and GL_BLEND is turned on. Objects without transparency can still be seen. stateset-setMode(GL_BLEND,osg::StateAttribute::ON); Thank you! Cheers, Steven -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59040#59040 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Issues with alpha blended texture overlay
On 04/17/2014 01:06 PM, Steven Powers wrote: Hi, I tried to add a texture overlay that gets rendered through an orthographic projection at the top of the scene graph. When I do so all objects in the background of the scene that have transparency are no longer visible. What am I doing wrong? The texture is a png with transparency applied to a quad and GL_BLEND is turned on. Objects without transparency can still be seen. stateset-setMode(GL_BLEND,osg::StateAttribute::ON); Thank you! Cheers, Steven Hi Steven, One idea - did you place the geometry into the TRANSPARENT_BIN? stateset-setRenderingHint(osg::StateSet::TRANSPARENT_BIN); -Josh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Issues with alpha blended texture overlay
That was it! I thought I had already tried that but I think I might have put it on the wrong node. Thank you! Cheers, Steven -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59042#59042 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] A suspicious bug of MatrixD
Dear Robert, thank you very much for your time. I still have doubt about the interpretion of the experiment: ...so we'd expect the scale of the x and y axis to be swapped.. I think that means, after rotation, the scale is still represented in the original frame, instead of the rotated one (otherwise the scale would be independent from the rotation). But when the rotation is, say, 30 degree, then the scale cannot generally be represented in the original frame without introducing sheering. Another argument is that the current Matrixd::getScale() is INconsistent with Matrixd::decompose( ). The following is the test code, which shows that the result of getScale() is not the same as decompose(), whereas getTrans() gives consistent result. This behavior is somewhat confusing for me. /**Test Code**/ osg::Matrixd S = osg::Matrixd::scale(3.0, 4.0, 5.0); osg::Matrixd R = osg::Matrixd::rotate(osg::inDegrees(30.0f),osg::Vec3d(0.0,0.0,1.0)); osg::Matrixd T = osg::Matrixd::translate(7.0, 8.0, 9.0); osg::Matrixd mat = S*R*T;//combine scale, rotation, and translation std::cout getScale() = mat.getScale().x() mat.getScale().y()mat.getScale().z() std::endl;//looks strange osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout new_getScale() = x_vec2.length() y_vec2.length() z_vec2.length() std::endl;//3 4 5 osg::Vec3d trans; osg::Quat rot; osg::Vec3d scale; osg::Quat so; mat.decompose(trans, rot, scale, so); osg::Vec3d trans2 = mat.getTrans(); //The result of getTrans() is consistent with decompose() std::cout decomposed Trans trans.x() trans.y() trans.z() std::endl;//7 8 9 std::cout getTrans() = trans2.x() trans2.y() trans2.z() std::endl;//also 7 8 9 //The result of getScale() is INconsistent with decompose(), with is confusing std::cout decomposed scale scale.x() scale.y() scale.z() std::endl;//3 4 5 std::cout decomposed so so.x() so.y() so.z() so.w() std::endl;//zero rotation /**End of Test Code*/ In summary, I think the newly proposed version of getScale() gives (the correct) rotation-independent scale information, which results in similar behavior as that of getTrans() and decompose(), and is probably more intuitive to use. Thank you again for your precious time. Best regards, Tianlan Shao On Thu, Apr 17, 2014 at 4:26 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Tianlan, I have done the following test where I provide a non unifom scale matrix then rotate it by 90 degrees, and then output the result of getScale() and the result of you suggested above: osg::Matrixd scale_then_rotated = osg::Matrixd::scale(3.0,4.0,1.0)*osg::Matrix::rotate(osg::inDegrees(90.0f),osg::Vec3d(0.0,0.0,1.0)); OSG_NOTICEMatrixd.getScale() = scale_then_rotated.getScale()std::endl; osg::Matrixd mat(scale_then_rotated); osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout x_vec2.length() y_vec2.length() z_vec2.length() std::endl; //seems correct The result I get on the console is: Matrixd.getScale() = 4 3 1 3 4 1 The getScale() version is correct, your suggestion is wrong as the matrix is now rotated 90 degrees so we'd expect the scale of the x and y axis to be swapped. If you were to compute the rotation and then remove this rotation and then do the getScale() I believe you'll get the result you are looking for with the existing code. Robert. On 17 April 2014 13:53, Tianlan Shao shaotianlan...@gmail.com wrote: Dear Robert, thank you for your reply, below is the code to reproduce the bug: // osg::Matrixd S = osg::Matrixd::scale(3.0, 4.0, 5.0); osg::Matrixd R = osg::Matrixd::rotate(osg::Quat(0.1, 0.5, 0.6, 0.7)); osg::Matrixd T = osg::Matrixd::translate(7.0, 8.0, 9.0); osg::Matrixd mat = S*R*T;//combine scale, rotation, and translation std::cout mat.getScale().x() mat.getScale().y() mat.getScale().z() std::endl;//Oops...seems wrong osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout x_vec2.length() y_vec2.length() z_vec2.length() std::endl; //seems correct // If the matrix combination above makes sense, then I guess what I found is indeed a bug. Thank you for your time and work. Best regards, Tianlan Shao On Thu, Apr 17, 2014 at 11:36 AM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Tianlan, Could you provide a small example that illustrates the problem? I did a quick test of: osg::Matrixd
Re: [osg-users] A suspicious bug of MatrixD
Dear Robert, I'd like to add that, when the x, y, and z scale factors are identical, the current getScale() gives the same result as the newly proposed one. I guess that's the reason why this issue was not reported before. Thank you very much. Best regards, Tianlan Shao On Fri, Apr 18, 2014 at 12:04 AM, Tianlan Shao shaotianlan...@gmail.comwrote: Dear Robert, thank you very much for your time. I still have doubt about the interpretion of the experiment: ...so we'd expect the scale of the x and y axis to be swapped.. I think that means, after rotation, the scale is still represented in the original frame, instead of the rotated one (otherwise the scale would be independent from the rotation). But when the rotation is, say, 30 degree, then the scale cannot generally be represented in the original frame without introducing sheering. Another argument is that the current Matrixd::getScale() is INconsistent with Matrixd::decompose( ). The following is the test code, which shows that the result of getScale() is not the same as decompose(), whereas getTrans() gives consistent result. This behavior is somewhat confusing for me. /**Test Code**/ osg::Matrixd S = osg::Matrixd::scale(3.0, 4.0, 5.0); osg::Matrixd R = osg::Matrixd::rotate(osg::inDegrees(30.0f),osg::Vec3d(0.0,0.0,1.0)); osg::Matrixd T = osg::Matrixd::translate(7.0, 8.0, 9.0); osg::Matrixd mat = S*R*T;//combine scale, rotation, and translation std::cout getScale() = mat.getScale().x() mat.getScale().y()mat.getScale().z() std::endl;//looks strange osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout new_getScale() = x_vec2.length() y_vec2.length() z_vec2.length() std::endl;//3 4 5 osg::Vec3d trans; osg::Quat rot; osg::Vec3d scale; osg::Quat so; mat.decompose(trans, rot, scale, so); osg::Vec3d trans2 = mat.getTrans(); //The result of getTrans() is consistent with decompose() std::cout decomposed Trans trans.x() trans.y() trans.z() std::endl;//7 8 9 std::cout getTrans() = trans2.x() trans2.y() trans2.z() std::endl;//also 7 8 9 //The result of getScale() is INconsistent with decompose(), with is confusing std::cout decomposed scale scale.x() scale.y() scale.z() std::endl;//3 4 5 std::cout decomposed so so.x() so.y() so.z() so.w() std::endl;//zero rotation /**End of Test Code*/ In summary, I think the newly proposed version of getScale() gives (the correct) rotation-independent scale information, which results in similar behavior as that of getTrans() and decompose(), and is probably more intuitive to use. Thank you again for your precious time. Best regards, Tianlan Shao On Thu, Apr 17, 2014 at 4:26 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Tianlan, I have done the following test where I provide a non unifom scale matrix then rotate it by 90 degrees, and then output the result of getScale() and the result of you suggested above: osg::Matrixd scale_then_rotated = osg::Matrixd::scale(3.0,4.0,1.0)*osg::Matrix::rotate(osg::inDegrees(90.0f),osg::Vec3d(0.0,0.0,1.0)); OSG_NOTICEMatrixd.getScale() = scale_then_rotated.getScale()std::endl; osg::Matrixd mat(scale_then_rotated); osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout x_vec2.length() y_vec2.length() z_vec2.length() std::endl; //seems correct The result I get on the console is: Matrixd.getScale() = 4 3 1 3 4 1 The getScale() version is correct, your suggestion is wrong as the matrix is now rotated 90 degrees so we'd expect the scale of the x and y axis to be swapped. If you were to compute the rotation and then remove this rotation and then do the getScale() I believe you'll get the result you are looking for with the existing code. Robert. On 17 April 2014 13:53, Tianlan Shao shaotianlan...@gmail.com wrote: Dear Robert, thank you for your reply, below is the code to reproduce the bug: // osg::Matrixd S = osg::Matrixd::scale(3.0, 4.0, 5.0); osg::Matrixd R = osg::Matrixd::rotate(osg::Quat(0.1, 0.5, 0.6, 0.7)); osg::Matrixd T = osg::Matrixd::translate(7.0, 8.0, 9.0); osg::Matrixd mat = S*R*T;//combine scale, rotation, and translation std::cout mat.getScale().x() mat.getScale().y() mat.getScale().z() std::endl;//Oops...seems wrong osg::Vec3d x_vec2(mat(0,0), mat(0,1), mat(0,2)); osg::Vec3d y_vec2(mat(1,0), mat(1,1), mat(1,2)); osg::Vec3d z_vec2(mat(2,0), mat(2,1), mat(2,2)); std::cout x_vec2.length() y_vec2.length() z_vec2.length() std::endl; //seems correct
Re: [osg-users] [vpb] Windows and weird error messages
Greetings All! I just went through the same thing! It would be good to make note of it some ware in a readme about it! I had to search though the forum to figure it out and I'm not sure I like the fix, but I can't find any better idea to work around it, but it works. The only other advice I have is to make sure you preinstall G-Dal and test it before you compile Open Scene Graph and VPB to them. I used G-Dal 1.10.1 that has installs and prebuilt lib’s and include that worked well for me. I used Visual Studio 2010 Professional with Service Pack 1 added. The only other suggestion I have is to add a command line shell that you can use to run VPB properly. I hacked mine using the shell that I found on the G-Dal core install and modified it so it can see all the g-dal stuff. I learned by antialiasing Q-GIS that the best way to do OSG anything in Windows is to have all the lib and executables in a single directory and use it from there. I moved all the binary’s to a single directory starting with the OSG binary stuff I compiled plus the plug-ins and adding the VPB stuff on top of that! I make sure that I added that to my path environmental variable. I open up the vpb command line shell, cd to the directory that I what to build my stuff and let her rip! No complaints yet!! David Glenn --- D Glenn 3D Computer Graphics Entertainment. www.dglenn.com -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59045#59045 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org