[osg-users] Texture, Materials and Effects
Hi, Is there any example that deals with simple-to-use effects, change of texture, etc, so I can make my scene a little bit more attractive? Like making drawables have a metallic appearance. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texture, Materials and Effects
Thanks, Robert. I'll have a look. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Camera control and view matrix
Hi, I need some references on camera control and view matrices. The tutorial in OSG's website is outdated, for it still makes use of osg::Producer. Can anyone send me a few suggestions? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera control and view matrix
Robert, The page I'm talking about that still references osg::Producer is http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/CameraControl. Basically, all pages related to camera control tutorials. It even has a wiki editing note about this. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera control and view matrix
Hi, Robert. You've said: "As for examples of manage the view matrix, there should be examples in the archives, but in the end it all boils down to not using a CameraManipulator and instead calling on each frame: viewer.getCamera()->setViewMatrix(viewMatrix);" How do I stop using the default camera manipulator, that I believe is TrackballManipulator? Thanks. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Linear Systems Solvers
Hi, there. I was wondering if there were any preexisting member functions that solve linear systems of 2 and 3 variables, already considering cases of numerical instability. I could create my own method, but I would be a little insecure about these particular situations... If anyone know that, please answer. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Events and Key Detection
Hi, everyone. My messages have been kind of ignored these days, but I'll give it another try with a different problem: In my GUIEventHandler derived class, I'm doing the usual override of the osgGA::GUIEventHandler::handle() function. Well, I made that whole switch-case structure and I would like to know if it would be possible to get, for example, an event inside another one. Let me give you an example: switch(ea.getEventType()) { case(osgGA::GUIEventHandler::DRAG) { // Here I'd like to check if a key was pressed -- how can I do it? } } I'd appreciate any help. Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Events and Key Detection
Sorry, Robert, I think I wasn't very clear. What I meant was: when I detect a drag event, I'd like to also detect a keydown event. It would be like testing for simultaneity of events... Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Events and Key Detection
Yeah, that was the kind of approach I was thinking in the beginning. I thought there would be something else. OK, then. Thanks, Jean and Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Events and Key Detection
Thanks, Robert, that' s some useful information. Another thing: when is the handle method called exactly? My point is: If I want some other function to be called continuously, do I have to put it on the FRAME event, or if I only put it inside the handle method my objectives will be accomplished? Thanks again, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Events and Key Detection
Thanks, Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] setViewMatrixAsLook at and getViewMatrixAsLookAt
Hi, I am using these two methods: setViewMatrixAsLookAt(eye, center, up) and getViewMatrixAsLookAt(&eye, ¢er, &up) with the viewer's camera in this order and WITHOUT manipulating the camera elsewhere in my code. I don't have much experience with OSG but isn't the last method supposed to return in the eye, center and up objects the same parameters that I have used to set the view matrix before? I've made a simple test: viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3f(10., -10., 2.), osg::Vec3f(0., 0., 0.), osg::Z_AXIS); osg::Vec3f eye; osg::Vec3f center; osg::Vec3f up; viewer.getCamera()->getViewMatrixAsLookAt(eye, center, up); cout << "eye " << eye.x() << " " << eye.y() << " " << eye.z() << endl; cout << "center " << center.x() << " " << center.y() << " " << center.z() << endl; cout << "up " << up.x() << " " << up.y() << " " << up.z() << endl; And what I've got from the cout's was: eye: 10 -10 2 (OK) center: 9.29986 -9.29986 1.85997 up: -0.0990148 0.0990148 0.990148 What am I doing wrong here? Did I misunderstand the purpose of the method? Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setViewMatrixAsLook at and getViewMatrixAsLookAt
Thanks, Paul and Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setViewMatrixAsLook at and getViewMatrixAsLookAt
Now that you have explained to me how it works, maybe you could give me an idea on how to solve a small problem I have. In my application, the user can move the camera freely (all directions and eye positions), but when the camera's direction is close to a given one, it snaps into that given direction, maintaining though, the distance from the objects of the scene. My doubt is on how to set the new view matrix if I can't get from the old matrix the true center of my view... Any ideas? Thanks. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Callbacks: operator() call
Hi, I'm having some trouble when using a whole lot of callbacks at the same time... Apparently it has something to do with the order that they're being called. I want to know how is it done. Are the operator()'s executed one by one in a given order or are they executed in a parallel manner? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Debugging using Visual Studio
Hi, Until the present date, I've been using cout's to debug my application, which is really annoying, for I didn't know how to configure Visual Studio to be able to debug running a OSG application. At one time I've read how to do it, but I lost that source... Can anyone teach me how? Thanks. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Debugging using Visual Studio
Hi, J-S. You've said that: If you want to debug into OSG itself, you'll need to have compiled OSG with debug symbols too (i.e. in Debug configuration), and link to that. I didn't understand this... What does it mean to "debug into OSG itself"? Another remark: You can debug your application without doing anything specific. Just compile it with debug symbols and you'll be able to set breakpoints, watch variables etc. In general, if you select the Debug configuration (in the box at the top-center of the Visual Studio window) you'll have debug symbols. Do a web search for details. I am doing what you're saying, but some unhandled exceptions, apparently regarding OpenGL, appear when I put a breakpoint and run as debug that weren't there when I simply executed the .exe file... I don't know what that can be about. That's why I thought there was more to debugging than just hitting the play button and entering the breakpoints... Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Debugging using Visual Studio
> > If you get more crashes when doing that, you'll need to be more specific > and provide for example a stack trace for us to help you find out what's > going on. I've realized I wasn't too specific... Next time I'll come with details. But thanks, anyway. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::Plane
Stupid but fast question. Just want to make sure I'm getting it right, as notations can vary and there is no explanation at the reference docs. Let's say I have an osg::Plane that can be represented as ax + by + cz + d = 0. The method asVec4() from that class gives me an osg::Vec4 object with x = a, y = b, z = c and w = d? Thanks for your answer. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Pergunta
Hi, In my application, I'm trying to create a point (a small sphere) and alter its properties, like shininess and transparency. When I execute the following method, the point is created with shininess effects alright. However, no matter how much I change the values related to transparency (values from 0. to 1.), nothing seems to be different in my view... What do I have to do to get the right result? osg::Geode* Point::createPoint(osg::Vec3f position) { this->geode = new osg::Geode() // geode is an osg::ref_ptr, member of my class this->drawable = new osg::ShapeDrawable(new osg::Sphere(position, RADIUS)); // drawable is an // osg::ref_ptr, member of my class this->drawable->setColor(osg::Vec4(0.0, 0.0, 1.0, 1.0)); this->geode->addDrawable(this->drawable); this->material -> setColorMode(osg::Material::DIFFUSE); this->material -> setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(1, 1, 1, 1)); this->material -> setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(1, 1, 1, 1)); this->material -> setShininess(osg::Material::FRONT_AND_BACK, 128.0f); this->material -> setTransparency(osg::Material::FRONT_AND_BACK, 0.5f); geode -> getOrCreateStateSet() -> setAttributeAndModes(this->material.get(), osg::StateAttribute::ON); return geode.get(); } Thanks for your help, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Pergunta
Hi, Can. The stateSet whose mode you are setting is from the drawable or the geode? And how exactly can I do that without destroying my previous settings? (geode -> getOrCreateStateSet() -> setAttributeAndModes(this->material.get(), osg::StateAttribute::ON);) Thanks again, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Plane
OK, thanks. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgViewer osgCool
Hi, everyone. I was looking through the examples and found an effect that can be useful to my application. It is in osgviewer osgcool, but I can't find the code neither in the examples I've download with the osg package nor at the osg website... Does anyone have it and can send it to me? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewer osgCool
My mistake, I thought it was an example but it is only an argument for the application. Either way, I really wanted to learn how that particular particle effect was generated... How can I do it? Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewer osgCool
I will look into that. Thanks J-S. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewer osgCool
Thanks. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Text at fixed position on screen
Hi, everyone. I'm using the osgText::Text class to create texts that are always parallel to the screen. In addition to that, I would like to fix them at a certain position of the screen, say on given coordinates (x,y). Any suggestion on how to do it? Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Text at fixed position on screen
Hi, Dusten. I've looked at the osgtext example, but I couldn't figure out one thing (perhaps because I didn't know what to look for). There is one piece of text that says: text->setFontResolution(10,10); // blocky but small texture memory usage and it is displayed on the top left corner. No matter how much I rotate the scene, it won't move (this text is one example). That's what I wanted, so I have searched the code for the above mentioned string and I found out that this text is created and set like this: { osgText::Text* text = new osgText::Text; text->setFont(font); text->setColor(fontSizeColor); text->setCharacterSize(fontSizeCharacterSize); text->setPosition(cursor); // use text that uses 10 by 10 texels as a target resolution for fonts. text->setFontResolution(10,10); // blocky but small texture memory usage text->setText("text->setFontResolution(10,10); // blocky but small texture memory usage"); geode->addDrawable(text); } Where: osgText::Font* font = osgText::readFontFile("fonts/arial.ttf"); osg::Vec4 fontSizeColor(0.0f,1.0f,1.0f,1.0f); float fontSizeCharacterSize = 30; osg::Vec3 cursor = osg::Vec3(margin*2,windowHeight-margin*2,0.0f); Strangely enough there was nothing concerning a mode that would make it fixed at a certain position. I've tried some other attributes but the best I can do is get the text to be always parallel to the screen, but ot fixed. Can you give me another hint? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Text at fixed position on screen
> > What you need are multiple cameras. One moves when navigating in the scene, > the other doesn´t. This is done in osgHud. > > But why does it work on osgText? I'm not sure I understand. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Text at fixed position on screen
It works. Thank you Sukender and Andreas. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Creating window
Hi, I'm currently running my application on full screen mode, because that's the default configuration. I wanted to know how to change this configuration to a true window. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Creating window
Well, this is simple. Thanks! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Creating window
Thanks, Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Picking
Hi, My question is regarding picking using LineSegmentIntersector. Based on what I have seen at the osg documentation, the following steps are required to get the coordinates of the intersection between a drawable at the scene and a line segment: 1) Create a LineSegmentIntersector: osgUtil::LineSegmentIntersector* lineSegmentIntersector = new osgUtil::LineSegmentIntersector(lineStart, lineEnd); // lineStart and lineEnd are fictitious 2) Get the first intersection: osgUtil::LineSegmentIntersector::Intersection intersection = lineSegmentIntersector->getFirstIntersection(); 3) Get world coordinates of the intersection osg::Vec3f pos = intersection.getWorldIntersectPoint(); Assuming that this is right, I ask one thing: how to use the mouse coordinates to create a line that will intersect the drawable upon which the mouse cursor stands? Thanks again. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Picking
Thanks, J-S. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Using OSG on Windows on Bootcamp
Hi, I have a MacBook and I'm using OSG on Windows, installed with bootcamp. My application doesn't detect the right mouse button even though I am using a regular two-button mouse (Microsoft's). I was wondering if anyone stumbled upon anything of the kind and could tell me wether the problem is the running windows on bootcamp or not. Here's the code I'm using: (inside handle method) switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON): cout << "right button" << endl; break; case(osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON): cout << "left button" << endl break; default: break; } Thanks a lot. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Using OSG on Windows on Bootcamp
Thanks, Robert, that really helped. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Problem with moving a group
Hi, everyone. In my application the user is suuposed to be able to select several shapes (cylinders, boxes and spheres) and move them altogether as if they were one. The obvious solution would be to attach this group of shapes to a matrixtransform node, and only change the matrix of this node. The thing is: the classes that I have created to represent each one of those shapes have a few attributes that change according to the position and orientation of the shape. So, I have created a method movePrimitive(osg::Matrix m) to perform the transformation of the shape itself and the adjustment of the mentioned attributes. So, if I use that matrixtransform node I talked about, the primitives will be rotated/translated accordingly, but the attributes won't be changed. Just so you know, the attributes are osg::LineSegment and osg::Plane pointers and what I do in movePrimitive(osg::Matrix m) is multiply the osg::LineSegments and osg::Plane by that matrix. osg::LineSegments and osg::Planes are not nodes, so I can't attach them to my primitive. So what do you think I can do? Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] World to Local Coordinates
Hi, I wanted to have the position of a certain shape of my scene in relation to another shape's coordinate system. As I read in the documentation, there is a member function of MatrixTransform that computes "WorldToLocalMatrix", but I'm not sure on how to use it properly. This function has two arguments: a reference to a matrix and a pointer to a NodeVisitor. My questions are: 1) Which matrix goes on the matrix type argument? A blank matrix? The matrix of the shape I'm willing to get its coordinates transformed? 2) What do I have on the resultant matrix? 3) What is the NodeVisitor for? Thank you, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] World to Local Coordinates
Vincent, Thanks for your help, but what I want is exactly the opposite. To transform from world to local... Does anybody know the answer to my last email? Thank you. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Conical and Parallel Projections
Hi, I'd like to know if there was a way to change the default projection in OSG. By default the view uses conical projection, but in some situations I'd need a parallel projection. How can I do that? Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Conical and Parallel Projections
Thanks J-S and Gordon, that was exactly what I wanted. I'm sorry about the terminology, I was just translating literally from Portuguese, since I'm not familiarised with the terms in English. Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Traversing
Hi, everyone. I have a class called Point that is derived from MatrixTransform. An instance of this class always has a Geode child, which has a Drawable, which is a ShapeDrawable. For better understanding of things, I'll use a simple shape for a drawable, let's say a sphere. Let's suppose I have an instance of my Point class, which is attached to the viewer, being displayed on the screen I use a PickHandler class that is as follows: bool PickHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { osgViewer::Viewer* viewer = dynamic_cast( &aa ); osgUtil::LineSegmentIntersector::Intersections intersections; if(!viewer) { return false; } switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::PUSH): { if(Intersecao(viewer, ea)) { ... } // I'LL TALK ABOUT THESE BRACKETS FURTHER AHEAD } } } bool PickHandler::Intersecao(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea, osg::Util::LineSegmentIntersector::Intersections intersections) { return (viewer->computeIntersections(ea.getX(),ea.getY (),intersections)); } So, I guess my question is: what do I write inside those brackets that I marked above to traverse till the drawable and change its color? What I really need here is some language learning, not only theoretical, OK? In other words: if you could write a little bit of source code to clarify what you are saying, that'd be great. Thanks, everyone. If you manage to explain how it's done to the newbie you're talking to, I'd be grateful. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
Hi, Robert. I'm sorry, Robert, but would you mind explaining a little bit more on how do I get access to this list? And from this, how do I choose specifically the Drawable leaf? Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
Hello, Jean-Sébastien. Although it didn't seem so, I have looked through the doxygen documentation. The thing is that they aren't good enough for someone who hasn't any experience what so ever with this kind of programming. Some of the methods aren't fully explained, at least to my understanding, and even if they were, is kind of weird reading that whole documentation without knowing what you are looking for. This last part, I believe, is the function of a tutorial or something alike. For instance, I didn't know that an intersection was made directly with the Drawable, even though my instance connected to the viewer is a MatrixTransform... But I think now I can at least use the Intersections properly, even if I don't fully understand it. I thank you and Robert for the help. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
Hi, Jean-Sébastien. I'm gonna take advantage of the fact you are there and ask you one thing. I tried using that last part of code you've given me, but my compiler acused an error: 1>.\Classe Pick Handler.cpp(23) : error C2682: cannot use 'dynamic_cast' to convert from 'osg::ref_ptr' to 'osg::ShapeDrawable *' 1>with 1>[ 1>T=osg::Drawable 1>] given that the line where the error ocurred was: osg::ShapeDrawable* shapedrawable = dynamic_cast(hitr->drawable); Can you tell me what's wrong? Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
Hey, don`t you ever worry about it! I'm lucky enough you do answer my questions. Thanks again, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
Hi, Jean-Sébastien. When you've given me that code I've rearranged it in a way that would be more intuitive to me and it turned out to be this one below. Nothing much really. Just some methods calls,... well, see for yourself - nothing really changed. But I'm worried about something, since it didn't work. I've realized that the 'for' marked in the code is a little bit strange for what I want to happen. As I recall, it was used as it is to keep showing the coordinates of the point you were on with the mouse cursor, in the osgpick example. Is it appropriate in my case? I just want the color to change when I push the left button... Thanks again, Renan M Z Mendes bool PickHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { osgViewer::Viewer* viewer = dynamic_cast( &aa ); osgUtil::LineSegmentIntersector::Intersections intersections; if(!viewer) { return false; } switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::PUSH): { if(Intersecao(viewer, ea, intersections)) { osg::notify(osg::NOTICE)<< "SELECAO" << std::endl; for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); hitr != intersections.end(); ++hitr) // I'M TALKING ABOUT THIS ONE { if(hitr->drawable.valid()) { osg::ShapeDrawable* shapedrawable = dynamic_cast(hitr->drawable.get()); shapedrawable->setColor(osg::Vec4(1.0, 0.0, 0.0, 1.0)); } } } } } } bool PickHandler::Intersecao(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea, osgUtil::LineSegmentIntersector::Intersections intersections) { return (viewer->computeIntersections(ea.getX(),ea.getY (),intersections)); } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
> > The for loop you point to is actually because the intersection test > might return multiple results (objects behind one another, for > example). In your case, you probably just want the closest > intersection. Check the documentation for the > osgUtil::LineSegmentIntersector::Intersection structure to find out > how to get that. > Well, I have tried running my application with only a shape drawable sphere, and nothing else. But even so, it didn't work. I've put an osg::notify(osg::NOTICE) inside the 'for' nest and outside the if(drawable.valid()) nest and I saw that it never entered the 'for'... Just in case you've erased my previous messages, I'm copying the new code with the appear-if-worked messages (that didn't appear). Thanks Renan Mendes bool PickHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { osgViewer::Viewer* viewer = dynamic_cast( &aa ); osgUtil::LineSegmentIntersector::Intersections intersections; if(!viewer) { return false; } switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::PUSH): { if(Intersecao(viewer, ea, intersections)) { osg::notify(osg::NOTICE)<< "SELECAO" << std::endl; for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); hitr != intersections.end(); ++hitr) { osg::notify(osg::NOTICE)<< "ENTERED THE FOR" << std::endl; if(!hitr->drawable.valid()) { osg::notify(osg::NOTICE)<< "ENTERED HERE" << std::endl; osg::ShapeDrawable* shapedrawable = dynamic_cast(hitr->drawable.get()); shapedrawable->setColor(osg::Vec4(1.0, 0.0, 0.0, 1.0)); } } } } } } bool PickHandler::Intersecao(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea, osgUtil::LineSegmentIntersector::Intersections intersections) { return (viewer->computeIntersections(ea.getX(),ea.getY (),intersections)); } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
There was a mistake in my previous message. I was testing the code after subtle changes but I forgot to change it back to normal... (But it doesn't work all the same...) bool PickHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { osgViewer::Viewer* viewer = dynamic_cast( &aa ); osgUtil::LineSegmentIntersector::Intersections intersections; if(!viewer) { return false; } switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::PUSH): { if(Intersecao(viewer, ea, intersections)) { osg::notify(osg::NOTICE)<< "SELECAO" << std::endl; for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); hitr != intersections.end(); ++hitr) { osg::notify(osg::NOTICE)<< "ENTERED THE FOR" << std::endl; if(hitr->drawable.valid()) // it was written '!hitr->drawable.valid()', but I've corrected it { osg::notify(osg::NOTICE)<< "ENTERED HERE" << std::endl; osg::ShapeDrawable* shapedrawable = dynamic_cast(hitr->drawable.get()); shapedrawable->setColor(osg::Vec4(1.0, 0.0, 0.0, 1.0)); } } } } } } bool PickHandler::Intersecao(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea, osgUtil::LineSegmentIntersector::Intersections intersections) { return (viewer->computeIntersections(ea.getX(),ea.getY (),intersections)); } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
Hi, Jean-Sébastien. OK, I've had some trouble with the first bug, but the second one I've corrected. I've sent you two messages. The last one got rid that ! problem. I was just testing the program in various manners to see where was the mistake. About the first error: I was told that the 'intersections' was an array, so that's why I have used it in the function call as it is. Once again, thanks for your help. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Traversing
Hi, Jean-Sébastien. I agree with you on the "read more the provided documentation" part. My last message was just so you knew I'm not completely idiot on the subject, although I recognise I need a lot of learning to do. Well, I thank you for this good lesson you've given me on picking. Bonnes fêtes, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Path from ShapeDrawable to Parents above...
Hello, everyone. In my application, I use ShapeDrawables, which are selected by the user by mouse picking. An extract of the code concerning the picking is as follows: bool PickHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { osgViewer::Viewer* viewer = dynamic_cast( &aa ); osgUtil::LineSegmentIntersector::Intersections intersections; if(!viewer) { return false; } switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::PUSH): { if(Intersecao(viewer, ea, intersections)) { osg::notify(osg::NOTICE)<< "Selecao de "; osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); if(hitr->drawable.valid()) { osg::ShapeDrawable* shapedrawable = dynamic_cast(hitr->drawable.get()); changeColor(shapedrawable); std::string nome = shapedrawable->getName(); } } } } } bool PickHandler::Intersecao(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea, osgUtil::LineSegmentIntersector::Intersections &intersections) { return (viewer->computeIntersections(ea.getX(),ea.getY (),intersections)); } I've looked through the doxygen documentation but couldn't find any method that would return the drawable where the shapedrawable is attached to. This way I would be able to get to the parent that has all the information I need. Let me give an example to simplify. I have selected a sphere on the screen that is the drawable (in the form of a shapedrawable) of an instace of the class Sphere (not the osg's). How do I access the data that is inherent to every intance of that class? A ShapeDrawable is not a Node, so I can't get a Parent... How do I do it? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Path from ShapeDrawable to Parents above...
Hi, Paul. What I really want to do is to be able to deal with the instance of the class created by me, which has a drawable part that is selectes on the screen. All the methods return the parents in the form of osg::Node, but what I want is to be able to deal with that instance of the class I've created that has its drawable part on the screen. You see? I click on the drawable, but I get the class instance attached to it. Here's what I've tried to do, but some major error occured and my application stopped working: if(hitr->drawable.valid()) { osg::ShapeDrawable* shapedrawable = dynamic_cast(hitr->drawable.get()); changeColor(shapedrawable); MyClass* myclass = dynamic_cast(shapedrawable->getParent(1));/* maybe the problem is this number. I was looking for the second parent from the root (including the root that I assumed it was 0). Is it how it's done? */ myclass->printPosition(); // there's is an osg::Vec3f that stores the position of an instance of the class MyClass } Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Path from ShapeDrawable to Parents above...
Hi, Paul. I've managed to do it on my own. Thanks anyway. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] STL vectors and function calls
Hi, everyone. I've got quick question on STL vectors. I've created a class (let's call it MyClass) with the method 'bool MyMethod(std::vector MyVector)' that calls another method 'void AnotherMethod()' that makes a simple check on a variable inherent to every instance of MyClass. How do I write that method? Or better put: how do I change the following code to make it right? bool MyClass::MyMethod(std::vector MyVector) { std::vector::iterator MyIterator; for(MyIterator = MyVector.begin(); MyIterator != MyVector.end(); MyIterator++) { *MyIterator->AnotherMethod(); } } I read that an iterator was a pointer to the content of the vector, why doesn't it work? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] STL vectors and function calls
Thanks, Gordon. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Error: 'Debug Assertion Failure!'
Hi, everyone. When testing my application, an error message appeared saying: 'Debug Assertion Failure' and 'vector subscription out of range'. This error occured when: 1) I wrote the following code: case(osgGA::GUIEventAdapter::KEYDOWN): { if(!ponto.empty()) // ponto is defined as: std::vector ponto; in which Ponto is a class created by me. { for(ponto_itr = ponto.begin(); ponto_itr != ponto.end(); ponto_itr++) { if((*ponto_itr)->verifySelection()) // verifies if the shape associated with an instance of the class Ponto was picked { switch(ea.getKey()) { case(ea.KEY_Delete): { osg::Group* root = (*ponto_itr)->getParent(0); root->removeChild(root->getChildIndex((*ponto_itr)), 1); } } } } } 2) AND when I do the following: 1 - select one point; 2 - delete it; 3 - press delete again, having or NOT selected another 'ponto' (instance of class Ponto) on the screen. NOTE: when a drawable from 'ponto' is selected (picked), the 'ponto' is allocated in the vector. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Error: 'Debug Assertion Failure!'
Hi, Gordon. I've looked up the doxygen documentation, and the second argument of removeChild is numChildrenToRemove, which I thought stood for 'number of children to remove'. If so, wouldn't I want 1 child to be removed? Isn't my index correct? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Error: 'Debug Assertion Failure!'
Hi, Rafa. I'll try and do that. Thanks. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Error: 'Debug Assertion Failure!'
Hi, Rafa, I've tried doing something like what you've said before: every time before I checked for selections with verifySelection(), I searched for a NULL member and erased it, like it's done below. Can you tell me why it still isn't working? Is there a logical flaw in my code? Thanks, Renan M Z Mendes case(osgGA::GUIEventAdapter::KEYDOWN): { if(!ponto.empty()) { for(ponto_limp = ponto.begin(); ponto_limp != ponto.end(); ponto_limp++) { if(*ponto_limp == NULL) { ponto.erase(ponto_limp); } } for(ponto_itr = ponto.begin(); ponto_itr != ponto.end(); ponto_itr++) { if((*ponto_itr)->verifySelection()) { switch(ea.getKey()) { case(ea.KEY_Delete): { osg::Group* root = (*ponto_itr)->getParent(0); root->removeChild(root->getChildIndex((*ponto_itr)), 1); } } } } } } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Bizarre crash
Hi, The most bizarre happened in my application during tests. When I open the prompt window to check some printed data, the program crashes and Windows closes it automatically. The most weird thing is that when I don't select the prompt window on the task bar, my application runs perfectly. But if I do the same actions and select the prompt window on the task bar, the program stops working... Any ideas? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Bizarre crash
No need. Solved. Thanks, Renan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Creating shapes under mouse cursor
Hi everyone. In my application, when I press the 'p' key, when no shape is selected, I create a small ShapeDrawable sphere and add it to the root node. I'd like to be able to create that shape right under the mouse cursor. I've tried using the coordinates from ea.getX() and ea.getY(), but they are not the same as my world coordinates. Which is logically fine, since they can't coincide when my view is rotated from the original position. Is there a way to perform this action? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Mathematical foundations
Hi everyone, Since I'm new on the whole computer graphics world, I don't have the mathematical foundations needed to fully comprehend the geometric transformations involved in a scene graph and used by OSG in its methods. I'd like to ask anybody who knows about a good website that deals with this kind of subject. Thanks in advance. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Creating shapes under mouse cursor
In 3d coordinates... I know, we'll have to do something about the depth. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Mathematical foundations
Oh, that is already done, but thanks for the advice. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Creating shapes under mouse cursor
> Hi Renan, > > what I do for this is the following: > > - compute the line behind the mouse cursor perpendicular to the screen. > You will ned the transformation and view matrices for this > > - intersect this line with a plane parallel to the screen through the > origin. You can use the line computed before as a normal vector for this > plane > > The intersection gives a point that is > a) behind the mouse > b) as close to the origin as possible > > The choice for the depth might be another, but this one makes sense in > some way! > > Regards, > > Andreas Hi, Andreas. Sorry I took so long to reply. I still haven't tried your method, but that's because I didn't understand it right away. I'll read a little bit more of the documentation to see the classes and methods that I need, and when I do it, I'll let you know. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] decompose and osg::Quat
Hi, everyone. I've got a simple question that I'm sure everyone will be able to answer. When I have a matrix and use it in matrix.decompose (osg::Vec3 &translation, osg::Quat &rotation, osg::Vec3 &scale, osg::Quat &so), my second argument will be filled with numbers that are supposed to represent the rotation. But what exactly these four numbers relate to the rotation matrix? More specifically, how do they relate to the arguments of the constructor osg::Quat(angle1, &axis1, angle2, &axis2, angle3, &axis3). Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] decompose and osg::Quat
Hi, Jean-Sébastien. Thanks for the interest, I'll check into that link you gave me. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Creating shapes under mouse cursor
Hi, Andreas here a bit of code, which you will have to adjust to your setup (meaning > that I use a GUI and you use a Viewer, where Functions for retrieving > the mouse are different): // //Here you get the mouse, you will have to do this differently > int lastx = event.GetX(); > int lasty = event.GetY(); > //Here you get the size of your viewport, you will have to do this > differently: > int w=0; int h=0; GetSize(&w, &h); > //Here I normalize the mouse to floats between -1 and 1 > float x = -1.0f + (float)(2*(lastx))/(float)w; > float y = -1.0f + (float)(2*(h -lasty))/(float)h; /***/ I've substituted the above with float x = ea.getXNormalized();, I've figured it would be the same. /**/ //You will have to do this slightly differently, using the > corresponding functions of your viewer: > osg::Matrix pm = sceneView->getProjectionMatrix(); > osg::Matrix vm = sceneView->getViewMatrix(); /*/ About the your commentary right above: I've searched thoroughly in the doxygen documentation and I haven't found any method equivalent to getProjectionMatrix, in osgUtil::SceneView, in osgViewer::Viewer. Is there a way to transfer the data from the viewer to SceneView and then use getProjectionMAtrix(). For example getting scene data from the same root node? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Creating shapes under mouse cursor
Hi, Jean-Sébastien. Andreas told me that I needed to create a method to compute the intersection of the line and plane. I was searching for a way reading the doxygen documentation and expecting something similar to what I had done with shapedrawable picking when I realised that neither lines nor planes are nodes, let alone drawables. The code I used with picking (to select the first visible drawable) was the following: bool PickHandler::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { osgViewer::Viewer* viewer = dynamic_cast( &aa ); osgUtil::LineSegmentIntersector::Intersections intersections; if(!viewer) { return false; } switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::RELEASE): { if(Intersecao(viewer, ea, intersections)) // a method that called computeIntersections with the right parameters { osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); if(hitr->drawable.valid()) { . } } I was thinking of doing the same with the plane, but since it isn't a drawable, I don't know what to do. I mean, what is a plane according to OSG ? I can't add it to a root node, for instance, to be shown on screen, so what is it? Sorry Lots of basic questions that I need to understand before creating that method... Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] ShapeDrawables intersection
Hi, everyone. I'd like to know a way to detect intersection between two ShapeDrawables and its position. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShapeDrawables intersection
Hi, Robert. I think I really need a tutorial on intersections. How to compute them, how to locate it in my world coordinates, etc. I don't really know what Polytopes are, let alone deal with them... Could you give me a reference (or several) on the subject? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Shape Intersection
Hi everyone, I need to detect when two shapes intersect and I need to know the point (or set of points) where it happens. I'm using shape drawables and I've been told that OSG doesn't have any support in that case. I was suggested, then, to fit a polytope around my shapedrawables and compute the intersections with that. Well, as you all know I'm new at computer graphics, so, I'm going to ask simple questions to help me understand all this a little bit better. As I've read in the doxygen documentation, a polytope is a volume determined by a set of planes. My first question would be about how to attach this polytope to my shapedrawable, being rotate and translated when necessary. I've searched for an intersection method between polytopes within the class but couldn't find any. Have I overlooked it? I'd be grateful if anyone could answer my questions, and if you have any better solution to that (like stop using shapedrawables!), please tell me. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Stereoscopy in OSG
Hi, everyone. What is OSG's support on stereoscopy? I have a dual-head video card and I needed that the images shown in the two monitors were slightly different in terms of view angle (my final objective, of course, is to project these two images on a screen making use of the stereoscopic polarized projection technique). Does anyone have any reference on the subject? Or even some already developed code? I'd really appreciate it. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] LineSegment and Plane Intersection
Hi, everyone. I'm having some trouble with computing the coordinates of the intersection between a osg::Plane and an osg::LineSegment. In addition, I'd like to be able to compute only the intersection with the plane, and forget about the rest of my scene... Is it possible? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineSegment and Plane Intersection
Hi, Robert. I am aware of the analytical way of solving my problems. Thanks, anyway. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Setting BoundingBox
Hi, everyone. I am currently trying to implement 'snaps' in my application. I don't know if that's the standard nomenclature, so I'll explain briefly what I mean with that. A snap is basically a sudden transformation of the shape on the screen to a certain orientation and position in space when it reaches a certain state in the scene. For example, when a point gets close to a plane, it gets translated to its projection on the plane, which is exactly what I'm trying to do in my application. For that, I thought of using bounding boxes. But to be able to control the minimum distance in which the bb's will intersect, I must set their extensions. While trying to do that with the function 'set', my compiler accused the following error: "2 overloads have no legal conversion for 'this' pointer" I'll paste the source code I am using: osg::ShapeDrawable* drawable = new osg::ShapeDrawable(new osg::Box(posicao, largura, comprimento, espessura)); // these are the same arguments of the function (drawable->getBound()).set(-COMPRIMENTO - 0.1, -LARGURA - 0.1, -ESPESSURA - 0.1, COMPRIMENTO + 0.1, LARGURA + 0.1, ESPESSURA + 0.1); // constants in capital letters Anyone could explain to me what's happening? Thanks for your help. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Stereoscopy, part 2
Hi, It's been a couple of weeks since I first asked about stereoscopy in OSG. I've had an answer from Rémy (which I forgot to thank for, sorry), but I still have some questions on the subject. I've managed to use the stereoscopy option, which provided me with a split image of my scene. When I finally tried to use the second video monitor (I have a NVIDIA GeForce 6200 dual-head video card), something unexpected happened. I have only managed to split the image between the two monitors when I used the 800x600 resolution - and I had to drag the window to the edge of the first video monitor for that to happen... What I wanted to know, is how to perform this action with the full screen (1024x768). Any suggestions and tips are quite welcome... Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Representing projections
Hi, In my application, I need to represent simple shapes' projections. For instance, project a line on a plane. I was thinking about using textures, but my problem is that my projection will have to be to be rotated and translated all the time, which, according to what I've noticed in some examples, is not a very simple task. Another idea I've had was to use indeed a light-and-shadow effect, but that wouldn't work either, for I need to project that line on that plane even if some other shape comes in between them. Anyone has any suggestions? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Setting BoundingBox
Hi, Ulrich. This is what I've said in my first email: "I am currently trying to implement 'snaps' in my application. I don't know if that's the standard nomenclature, so I'll explain briefly what I mean with that. A snap is basically a sudden transformation of the shape on the screen to a certain orientation and position in space when it reaches a certain state in the scene. For example, when a point gets close to a plane, it gets translated to its projection on the plane [...]" What I thought was that the function intersects() would give me a 'warning' when two shapes got close enough. That's what I've thought when I decided to use BoundingBox. Is there a better way to do that? Thanks for your help, Ulrich. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Stereoscopy, part 2
Thanks for your help. everyone. I haven't tested your suggestion yet, but when I do (probably Tuesday), I'll let you know. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transforms
Quick notation question: When I have a MatrixTransform* mt and a Matrix m and I do this: mt->postMult(m), which of the following am I mathematically doing? mt = mt * m; or mt = m * mt Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] SpaceNavigator
Hi, Has anyone used the 3Dconnexion SpaceNavigator in an OSG application? I'm intending on using it as a mouse substitute (somehow create a mouse-like cursor to be displayed), and use its 3D direction signals to rotate and translate my shapes, and also my viewer. I don't know where to begin, any information might be helpful. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] SpaceNavigator
OK, Mike. I'll have a look and come back with my questions. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Saving and Loading Scenes
Hi, I need some help on saving and loading scenegraphs. Reading the OSG documentation, specifically the osgDB namespace, I saw that I have no idea where to begin! Can someone give me a reference? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving and Loading Scenes
Benjamin, I've used this function (it compiled alright), but when running my aplication, there was an error message, saying that I didn't have the plugin for reading and writing files... I went to the OSG website and searched for reading and writing plugins, but there were so many, I didn't know which one to choose. Do you have a suggestion? Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] get function in osg::Matrixf
Hi, I'm new in using open source software. Because of that I don't know how to modify the library's code according to my needs. For instance, I'd like to create a getCoefficients() function in osg::Matrix, but I don't know where to make that change. I'm using windows and I've followed the installation step-by-step guide shown on OSG's website. Can anybody teach me how to do it? Thanks. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] get function in osg::Matrixf
Robert, Sorry it took me forever to reply. The getCoefficients was just an example. The point was just to be able to change OSG's source code when I felt the need. Sorry if it was a bad example... Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] get function in osg::Matrixf
Thanks, Gordon. I'll keep that in mind when I manage to change OSG's code. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Assertion failure - using removeChild
Hi, everyone. I wrote the following code: case(osgGA::GUIEventAdapter::KEYDOWN): { if(ea.getKey() == ea.KEY_Delete) { if(!vprim.empty()) { vprim_itr = vprim.begin(); while(vprim_itr != vprim.end()) { if((*vprim_itr)->checkSelection()) // No problems in this line { // HERE'S WHERE THE PROBLEM IS root->removeChild(root->getChildIndex((*vprim_itr)), 1); vprim_itr = vprim.erase(vprim_itr); } else { vprim_itr++; } } } } } where vprim is a STL vector and vprim_itr its iterator. When using the combination of the two lines below the commentary in capitals, I get an assertion failure that says: 'vector iterator not deferencable'. I don't know if removeChild() has any particular property that would mess things up, or if its just some subtle memory management aspect that I forgot to consider... I would really appreciate if someone could give me an idea of what's happening. Thanks. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Callbacks
Hi, I'm new in OSG and when I was reading about callbacks and how to implement them, I couldn't understand one thing: for every different callback you need a different class? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Callbacks
OK, thank you. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] LINE
Hi, I'd like to know if there is some way of making the LINE that is used to draw geometry based on OpenGL primitives a little bit thicker. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LINE
Thank you all, for the help provided. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Highlights
Hi, everyone. I'd like to know how to create highlights around drawables. In my case I'm using ShapeDrawables, I don't know if that changes anything. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Colors and Lighting
Hi, I'm new at OSG and computer graphics in general, so I'd like to ask a few very simple questions: 1) When I use an osg::Vec4 for setting the clear color, I have, of course, 4 parameters. The first three are the proportion of red, green and blue. But what does the last one do? 2) This question is linked to the last one, I think: how do I change the intensity of the light in my scene? Thank you, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] New Device Input
Hi, I'm working on a project that requires the use of a new input device, called space navigator. I have the method that gets the 6 coordinates from it. I'd like to know how to get it at every frame. I thought of using a callback, but it doesn't seem right, for the object from that class is not conceptually a osg::Node. Can I include it in my viewer.run() ? Thanks for your tip, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] New Device Input
Thank you, all. Very good ideas. I'll check into what you've said. Once again, thanks. Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org