[osg-users] Fwd: Fwd: Fwd: shader implementation - newbie
Hello Robert, I have already implemented the scenario that i am looking for in OpenGL by setting the glUseProgram(0) to glUseProgram(whichShader). And i wanted to implement the same scenario in OSG. None of the example that accompany the repository have implemented the scenario that i m looking for except a discussion in the mailing list. One of it was forwarded to you in the previous mail since among many other suggested methods yours one to be the better one considering the fact that you described the cons of the others. Regards Sajjad -- Forwarded message -- From: Robert Osfield Date: Tue, Apr 28, 2009 at 10:34 AM Subject: Re: [osg-users] Fwd: Fwd: shader implementation - newbie To: OpenSceneGraph Users Hi Sajjad, This is almost certainly more complicated than you need. As I said I not have to time to nurse maid you through learning about shaders. The OSG has a number of places where it use shaders in its implementation, and number of examples as well. Robert. On Tue, Apr 28, 2009 at 8:32 AM, ami guru wrote: > Hello Robert, > > After going through the archives i have found that it has already discussed > the issue that is not present yet within the API. > > Something like SwitchStateSet. > > But you did have pave a way to get that done. I am not sure if anyone has > done that and updated the repository.Your recommendation is as follows: > > ' > > Re: [osg-users] Rendering the scene multiple times with different shaders. > > Robert Osfield > Thu, 22 May 2008 08:10:39 -0700 > > Hi Stephane, > > On Thu, May 22, 2008 at 4:02 PM, Stephane Lamoliatte > <[EMAIL PROTECTED]> wrote: >> Robert, don't you think this feature could be done by some kind of custom >> osgFX::Effect node ? > > > You could probably write a custom node that overrides the cull > callback and post processes/rebuild the StateGraph it's generated. I > don't think this is an example of a osgFX::Effect though, such as > class might belong in osgFX though. > > > It might still be most efficient to tailor CullVisitor to do the > remapping of the StateSet, such as by tweaking the pushStateSet > method, that currently looks like: > > inline void pushStateSet(const osg::StateSet* ss) > > { > _currentStateGraph = _currentStateGraph->find_or_insert(ss); > if (_numberOfEncloseOverrideRenderBinDetails==0 && > ss->useRenderBinDetails() && !ss->getBinName().empty()) > > { > _currentRenderBin = > _currentRenderBin->find_or_insert(ss->getBinNumber(),ss->getBinName()); > } > if > (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS) > > { > ++_numberOfEncloseOverrideRenderBinDetails; > } > } > > One could possible add a check against an internal map of StateSet > inside this function. The only draw back to adding this into > > CullVisitor is that it'd add an extra bool check to see if one needed > to do the look up. i.e. > > > inline void pushStateSet(const osg::StateSet* ss) > { > if (_doStateSetSubstituion) > > { > StateSetMap::iterator itr = > _statesetSubsitutionMap.find(ss); > if (itr!= _statesetSubsitutionMap.end()) ss = > itr->second.get(); > } > _currentStateGraph = _currentStateGraph->find_or_insert(ss); > > if (_numberOfEncloseOverrideRenderBinDetails==0 && > ss->useRenderBinDetails() && !ss->getBinName().empty()) > { > _currentRenderBin = > _currentRenderBin->find_or_insert(ss->getBinNumber(),ss->getBinName()); > > } > if > (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS) > { > ++_numberOfEncloseOverrideRenderBinDetails; > } > } > > > The custom node would then populate the push and pop > _statesetSubsitutionMap settings in its cull traversal. > > Feel free to experiment with such an implementation and it works out > send it in to osg-submissions for consideration as > > part of the core OSG. > > Robert. > > > > ***'' > > If i have understood that correctly you have suggested to to tailor the > CullVisitor which means to make a subclass of CullVisitor like > MyCullVisitor and override the functions that you have specified. Now i wa
[osg-users] Fwd: Fwd: shader implementation - newbie
Hello Robert, After going through the archives i have found that it has already discussed the issue that is not present yet within the API. Something like SwitchStateSet. But you did have pave a way to get that done. I am not sure if anyone has done that and updated the repository.Your recommendation is as follows: ' Re: [osg-users] Rendering the scene multiple times with different shaders. Robert Osfield Thu, 22 May 2008 08:10:39 -0700 Hi Stephane, On Thu, May 22, 2008 at 4:02 PM, Stephane Lamoliatte <[EMAIL PROTECTED]> wrote: > Robert, don't you think this feature could be done by some kind of custom > osgFX::Effect node ? You could probably write a custom node that overrides the cull callback and post processes/rebuild the StateGraph it's generated. I don't think this is an example of a osgFX::Effect though, such as class might belong in osgFX though. It might still be most efficient to tailor CullVisitor to do the remapping of the StateSet, such as by tweaking the pushStateSet method, that currently looks like: inline void pushStateSet(const osg::StateSet* ss) { _currentStateGraph = _currentStateGraph->find_or_insert(ss); if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty()) { _currentRenderBin = _currentRenderBin->find_or_insert(ss->getBinNumber(),ss->getBinName()); } if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS) { ++_numberOfEncloseOverrideRenderBinDetails; } } One could possible add a check against an internal map of StateSet inside this function. The only draw back to adding this into CullVisitor is that it'd add an extra bool check to see if one needed to do the look up. i.e. inline void pushStateSet(const osg::StateSet* ss) { if (_doStateSetSubstituion) { StateSetMap::iterator itr = _statesetSubsitutionMap.find(ss); if (itr!= _statesetSubsitutionMap.end()) ss = itr->second.get(); } _currentStateGraph = _currentStateGraph->find_or_insert(ss); if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty()) { _currentRenderBin = _currentRenderBin->find_or_insert(ss->getBinNumber(),ss->getBinName()); } if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS) { ++_numberOfEncloseOverrideRenderBinDetails; } } The custom node would then populate the push and pop _statesetSubsitutionMap settings in its cull traversal. Feel free to experiment with such an implementation and it works out send it in to osg-submissions for consideration as part of the core OSG. Robert. ***'' If i have understood that correctly you have suggested to to tailor the CullVisitor which means to make a subclass of CullVisitor like MyCullVisitor and override the functions that you have specified. Now i want to get that implemented. And i need your suggestion on the items i have to cover more to understand and implement the scenario. First of all is there any example in OSG that implemented the CullVisitor concept. When i have have impelemented it how do i use that from the my createSceneGraph() function when i have the very same model that will be loaded with different shaders with user interaction. Regards Sajjad -- Forwarded message -- From: Robert Osfield Date: Mon, Apr 27, 2009 at 9:57 AM Subject: Re: [osg-users] Fwd: shader implementation - newbie To: OpenSceneGraph Users Hi Sajjad, A lot has been written about shaders and OSG over the years, so rather than me waste time going over old ground please could you search the archives. Robert. On Mon, Apr 27, 2009 at 2:47 AM, ami guru wrote: > Hello Robert, > > After going through several source code regarding shaders, i think that > using seperate program for different type of shader is a better > choice. > > In that case i am creating a vector<> of osg::Program initially, and > attaching the shaders corresponding to the programs. > > Now with user input i am trying to enable a particular program . In OpenGL > there is a command named > > glUseProgram(id); > > To enable the program which we can link and validate later. It is like > toggling between different program object. > > > In OSG i think we have to toggle between StateSet. > > > Can you suggest any example with in OSG that does that s
[osg-users] Fwd: shader implementation - newbie
Hello Robert, After going through several source code regarding shaders, i think that using seperate program for different type of shader is a better choice. In that case i am creating a vector<> of osg::Program initially, and attaching the shaders corresponding to the programs. Now with user input i am trying to enable a particular program . In OpenGL there is a command named glUseProgram(id); To enable the program which we can link and validate later. It is like toggling between different program object. In OSG i think we have to toggle between StateSet. Can you suggest any example with in OSG that does that state changes in an interactive way? Regards Sajjad -- Forwarded message -- From: ami guru Date: Sun, Apr 26, 2009 at 7:30 AM Subject: Fwd: [osg-users] shader implementation - newbie To: OpenSceneGraph Users Hello Robert, Thanks for the feedback. I am trying to design the interface as follows: if(userEvent == "Toon Shader") { //adding the corresponding shader to the program for the StateSet of the model } else if(userEvent == "Gooch Shader") { //adding the corresponding shader to the program for the StateSet of the model } Now If the user select the Toon Shader several times at several instances the very same shader will be added several times. I was thinking about loading all the shaders that i want to incorporate within in my application during the class's constructor and make the particular shader active during user selection . Is there any way within OSG to activate a particular shader while deactivating the rest of them? I have one model in my scene that i want to apply different shader on it. Regards Sajjad -- Forwarded message -- From: Robert Osfield Date: Sat, Apr 25, 2009 at 10:43 AM Subject: Re: [osg-users] shader implementation - newbie To: OpenSceneGraph Users HI Sajjad, osg::Program has have a list of shaders, think of shaders like .cpp's that go together to make a C++ program. You can have just the main or a whole series of separate files. The osg::Program is what tells the OSG/OpenGL what shaders should linked together to make the final program downloaded to the GPU. Now if you want different compositions of shaders at different points in your scene graphs then you'll need to link them together with separate osg::Program, or use a single osg::Program and uniforms to option select different paths in the shaders. Robert. On Sat, Apr 25, 2009 at 7:54 AM, ami guru wrote: > Hello forum, > > I am trying to implement some of the shaders in a single OSG application. > At the same time i was going through the osgshaders example and if i have > understood that correctly, > i saw that the example has separate osg::program for different shaders > > I was wondering if it is possible to have one single program to manage all > the shaders. I think osg::Program > contains a vector of shaders. > > Is that possible to store different shaders by different name and load that > according to the user selection; > delete previous shader and load the currently selected one. > > > Or separate osg::program for different shader example is best approach. > > I am considering different design issue here. > > Any opinion regarding that will be helpful. > > > Thanks > Sajjad > > ___ > 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] Fwd: shader implementation - newbie
Hello Robert, Thanks for the feedback. I am trying to design the interface as follows: if(userEvent == "Toon Shader") { //adding the corresponding shader to the program for the StateSet of the model } else if(userEvent == "Gooch Shader") { //adding the corresponding shader to the program for the StateSet of the model } Now If the user select the Toon Shader several times at several instances the very same shader will be added several times. I was thinking about loading all the shaders that i want to incorporate within in my application during the class's constructor and make the particular shader active during user selection . Is there any way within OSG to activate a particular shader while deactivating the rest of them? I have one model in my scene that i want to apply different shader on it. Regards Sajjad -- Forwarded message -- From: Robert Osfield Date: Sat, Apr 25, 2009 at 10:43 AM Subject: Re: [osg-users] shader implementation - newbie To: OpenSceneGraph Users HI Sajjad, osg::Program has have a list of shaders, think of shaders like .cpp's that go together to make a C++ program. You can have just the main or a whole series of separate files. The osg::Program is what tells the OSG/OpenGL what shaders should linked together to make the final program downloaded to the GPU. Now if you want different compositions of shaders at different points in your scene graphs then you'll need to link them together with separate osg::Program, or use a single osg::Program and uniforms to option select different paths in the shaders. Robert. On Sat, Apr 25, 2009 at 7:54 AM, ami guru wrote: > Hello forum, > > I am trying to implement some of the shaders in a single OSG application. > At the same time i was going through the osgshaders example and if i have > understood that correctly, > i saw that the example has separate osg::program for different shaders > > I was wondering if it is possible to have one single program to manage all > the shaders. I think osg::Program > contains a vector of shaders. > > Is that possible to store different shaders by different name and load that > according to the user selection; > delete previous shader and load the currently selected one. > > > Or separate osg::program for different shader example is best approach. > > I am considering different design issue here. > > Any opinion regarding that will be helpful. > > > Thanks > Sajjad > > ___ > 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] Keyboard or mouse handler from Qt
Hello forum, I am using the Qt's GUI framework to interact with the osg scene. i am using AdapterWidget and i would like to capture the GUI events from the Qt and pass that to the OSG's key-board handler. in the AdapterWidget.cpp there is a function : *' void AdapterWidget::keyPressEvent( QKeyEvent* event ) { _gw->getEventQueue()->keyPress( (osgGA::GUIEventAdapter::KeySymbol) *(event->text().toAscii().data() ) ); } ** And i have my own keyboard handler class that is the subclass of osgGA::GUIEventHandler and i have over-ridden the handle( ) function to capture keyboard events and act acccodingly. I do not undestand how map the above 2 together so that the event triggered from Qt will be caught by my keyboard handler. Any hint? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] shader implementation - newbie
Hello forum, I am trying to implement some of the shaders in a single OSG application. At the same time i was going through the osgshaders example and if i have understood that correctly, i saw that the example has separate osg::program for different shaders I was wondering if it is possible to have one single program to manage all the shaders. I think osg::Program contains a vector of shaders. Is that possible to store different shaders by different name and load that according to the user selection; delete previous shader and load the currently selected one. Or separate osg::program for different shader example is best approach. I am considering different design issue here. Any opinion regarding that will be helpful. Thanks Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ray tracing using OSG
Thanks for all the feedback I wondering if osgvolume is doing ray tracing and what is its type. Did that framework follow any published paper? Sajjad On Tue, Apr 14, 2009 at 4:12 PM, Paul Melis wrote: > ami guru wrote: > >> Hello Forum, >> >> >> I was wondering if there is anyone have done ray tracing using OSG. >> > I once made a very quick and dirty example that merely uses OSG's KD-tree > support to do ray tracing. > See this thread: > > http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2008-July/014399.html > > Regards, > Paul > > >> >> So far i have got from the forum Jean-Sébastien Guay did his Masters >> thesis >> on that domain and it would be really nice >> if he provide the link to the report, at least it would be a starting >> point for me. >> >> What do you think Jean? >> >> >> Regards >> Sajjad >> >> >> >> >> >> ___ >> 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] OpenSceneGraph-2.8.1 release candidate one tagged
compiled fine on Ubuntu 64 -bit (8.04) - dual core AMD 64-bit osgviewer worked fine Sajjad On Sun, Apr 12, 2009 at 10:01 PM, Cedric Pinson wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Compile fine on gentoo 32 bits with gcc (Gentoo 4.3.2-r3 p1.6, > pie-10.1.5) 4.3.2 dual core2 > Run osgviewer and all osgAnimation examples, everything seems fine > > Cheers, > Cedric > > Robert Osfield wrote: > > On Sat, Apr 11, 2009 at 11:02 PM, Paul Martz > > wrote: > > > >> Hi Robert -- The 2.8.1 tag builds and runs fine on WinXP VS8. > >> > >> The ChangeLog in the 2.8.1 tag appears to contain _all_ changes, > >> even those made to svn head, not necessarily just to the branch, > >> is that correct? > >> > > > > Opps, looks like make ChangeLog script must not be perfected yet... > > it must have picked up on my svn/trunk checkout rather than the > > OSG-2.8 branch. I'll investigate and look to fix it then make a > > rc2. > > > > Robert. > > > > > > -- > > > > > > ___ osg-users mailing > > list osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > - -- > +33 (0) 6 63 20 03 56 Cedric Pinson mailto:morni...@plopbyte.net > http://www.plopbyte.net > > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkniSKAACgkQs6ZHzVQN0IjsegCgh2ad8g7Ug5GYTKMe/KNrth+z > PdUAniWJMViHsZKct80vcCotv7Az8Qn6 > =p3HB > -END PGP SIGNATURE- > > ___ > 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] ray tracing using OSG
Hello Charles, It would be nice if you can provide me the links of reference that you have preserved about ray tracing or anything related to that field that will help to get started. I have going through the ground up Scanline conversion and then the usual Ray Tracing Want to do that using the GPU and the OSG framework. Any of your suggestion would be a great help i believe Thanks Sajjad On Sat, Apr 11, 2009 at 10:53 PM, ami guru wrote: > Hello Adrian > > > I am afraid that i will be getting into off-topic now, so you can mail me > at dosto.wa...@gmail.com > > I tried as follows: > > cmake -i . > > and got the following error: > > > *** > saj...@sajjad:~/downloads/RayTracer/RayTracer$ cmake -i . > Would you like to see advanced options? [No]:y > Please wait while cmake processes CMakeLists.txt files > > CMake Error: The source directory "/Users/PWD/dev/RayTracer" does not > exist. > Specify --help for usage, or press the help button on the CMake GUI. > > > *' > > > I am not that into Cmake that is why most of the error output is not making > much sense to me. > > > Tried with my Own Make file but get error for the ply reader > > > Sajjad > > > > On Sat, Apr 11, 2009 at 8:19 PM, Adrian Egli OpenSceneGraph (3D) < > 3dh...@gmail.com> wrote: > >> cmake -i . make >> ./RayTracer [model.osg] >> >> default model plane and cow.osg >> >> 2009/4/11 Adrian Egli OpenSceneGraph (3D) <3dh...@gmail.com> >> >>> cmake -i . make >>> ./RayTracer [model.osg] >>> >>> default model plane and cow.osg >>> >>> 2009/4/11 Adrian Egli OpenSceneGraph (3D) <3dh...@gmail.com> >>> >>> Well i don't know, i just build my raytracer this morning on mac os/x >>>> with osg trunk. (svn ) >>>> >>>> i will send the code and cmake file >>>> >>>> /adrian >>>> >>>> >>>> 2009/4/11 ami guru >>>> >>>> Thanks >>>>> >>>>> >>>>> For the code skeleton, that will pave a way to get started i believe. >>>>> Now i am going through the following issues: >>>>> >>>>> Just updated the installation from the trunk to 2.9.3. >>>>> >>>>> i executed the make file to compile the code that you have sent and >>>>> the following error showed up: >>>>> >>>>> >>>>> ** >>>>> g++ -c kdTree.cpp >>>>> g++ -c main.cpp >>>>> g++ -c plymeshreader.cpp >>>>> g++ -c sphereunitvecpool.cpp >>>>> g++ -c TriangleNodeVisitor.cpp >>>>> TriangleNodeVisitor.cpp: In member function ‘void >>>>> TriangleNodeVisitor::processGeometry(osg::Geometry*)’: >>>>> TriangleNodeVisitor.cpp:294: error: cannot declare variable ‘pif’ to be >>>>> of abstract type ‘PrimitiveIndexWriter’ >>>>> TriangleNodeVisitor.cpp:79: note: because the following virtual >>>>> functions are pure within ‘PrimitiveIndexWriter’: >>>>> /usr/local/include/osg/PrimitiveSet:134: note: virtual void >>>>> osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const >>>>> osg::Vec2d*) >>>>> /usr/local/include/osg/PrimitiveSet:135: note: virtual void >>>>> osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const >>>>> osg::Vec3d*) >>>>> /usr/local/include/osg/PrimitiveSet:136: note: virtual void >>>>> osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const >>>>> osg::Vec4d*) >>>>> make: *** [TriangleNodeVisitor.o] Error 1 >>>>> >>>>> >>>>> >>>>> ********** >>>>> >>>>> >>>>> I checked the code but i have not found any function with pure virtual >>>>> as the message above said. >>>>> >>>>> Any hint to get around that issue? >>>>> >>>>> >>>>> Regards >>>>> Sajjad >>>>> >>>>> On Sat, Apr 11, 2009 at 7:54 PM, Adrian Egli OpenSceneGraph (3D) < >>>>> 3dh...@gmail.com> wrote: >>>>> >>>>>> :-) Once you have some questions, i could answer them, the code is >>>>>> fast but not very fast :-) have also a look at o
Re: [osg-users] ray tracing using OSG
Hello Adrian I am afraid that i will be getting into off-topic now, so you can mail me at dosto.wa...@gmail.com I tried as follows: cmake -i . and got the following error: *** saj...@sajjad:~/downloads/RayTracer/RayTracer$ cmake -i . Would you like to see advanced options? [No]:y Please wait while cmake processes CMakeLists.txt files CMake Error: The source directory "/Users/PWD/dev/RayTracer" does not exist. Specify --help for usage, or press the help button on the CMake GUI. *' I am not that into Cmake that is why most of the error output is not making much sense to me. Tried with my Own Make file but get error for the ply reader Sajjad On Sat, Apr 11, 2009 at 8:19 PM, Adrian Egli OpenSceneGraph (3D) < 3dh...@gmail.com> wrote: > cmake -i . make > ./RayTracer [model.osg] > > default model plane and cow.osg > > 2009/4/11 Adrian Egli OpenSceneGraph (3D) <3dh...@gmail.com> > >> cmake -i . make >> ./RayTracer [model.osg] >> >> default model plane and cow.osg >> >> 2009/4/11 Adrian Egli OpenSceneGraph (3D) <3dh...@gmail.com> >> >> Well i don't know, i just build my raytracer this morning on mac os/x >>> with osg trunk. (svn ) >>> >>> i will send the code and cmake file >>> >>> /adrian >>> >>> >>> 2009/4/11 ami guru >>> >>> Thanks >>>> >>>> >>>> For the code skeleton, that will pave a way to get started i believe. >>>> Now i am going through the following issues: >>>> >>>> Just updated the installation from the trunk to 2.9.3. >>>> >>>> i executed the make file to compile the code that you have sent and the >>>> following error showed up: >>>> >>>> >>>> ** >>>> g++ -c kdTree.cpp >>>> g++ -c main.cpp >>>> g++ -c plymeshreader.cpp >>>> g++ -c sphereunitvecpool.cpp >>>> g++ -c TriangleNodeVisitor.cpp >>>> TriangleNodeVisitor.cpp: In member function ‘void >>>> TriangleNodeVisitor::processGeometry(osg::Geometry*)’: >>>> TriangleNodeVisitor.cpp:294: error: cannot declare variable ‘pif’ to be >>>> of abstract type ‘PrimitiveIndexWriter’ >>>> TriangleNodeVisitor.cpp:79: note: because the following virtual >>>> functions are pure within ‘PrimitiveIndexWriter’: >>>> /usr/local/include/osg/PrimitiveSet:134: note: virtual void >>>> osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const osg::Vec2d*) >>>> /usr/local/include/osg/PrimitiveSet:135: note: virtual void >>>> osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const osg::Vec3d*) >>>> /usr/local/include/osg/PrimitiveSet:136: note: virtual void >>>> osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const osg::Vec4d*) >>>> make: *** [TriangleNodeVisitor.o] Error 1 >>>> >>>> >>>> >>>> ** >>>> >>>> >>>> I checked the code but i have not found any function with pure virtual >>>> as the message above said. >>>> >>>> Any hint to get around that issue? >>>> >>>> >>>> Regards >>>> Sajjad >>>> >>>> On Sat, Apr 11, 2009 at 7:54 PM, Adrian Egli OpenSceneGraph (3D) < >>>> 3dh...@gmail.com> wrote: >>>> >>>>> :-) Once you have some questions, i could answer them, the code is >>>>> fast but not very fast :-) have also a look at ompf.org >>>>> and search for arauna / bikker >>>>> >>>>> /adrian >>>>> >>>>> 2009/4/11 Charles Cossé >>>>> >>>>> Hi Sajjad, >>>>>> >>>>>> Attached I have tgz'd-up a file posted earlier (by Adrian Egli?) with >>>>>> his first cut at raytracing using a kd tree. I saved all the links >>>>>> to the various posts/threads on this subject, also, which can share >>>>>> with you if interested. >>>>>> >>>>>> Charles >>>>>> >>>>>> On Fri, Apr 10, 2009 at 10:16 PM, ami guru >>>>>> wrote: >>>>>> > Hello Forum, >>>>>> > >>>>>> > >>>>>> > I was wondering if there is anyone have done ray tracing using OSG. >>>>>> > >>>>&
Re: [osg-users] ray tracing using OSG
Thanks For the code skeleton, that will pave a way to get started i believe. Now i am going through the following issues: Just updated the installation from the trunk to 2.9.3. i executed the make file to compile the code that you have sent and the following error showed up: ** g++ -c kdTree.cpp g++ -c main.cpp g++ -c plymeshreader.cpp g++ -c sphereunitvecpool.cpp g++ -c TriangleNodeVisitor.cpp TriangleNodeVisitor.cpp: In member function ‘void TriangleNodeVisitor::processGeometry(osg::Geometry*)’: TriangleNodeVisitor.cpp:294: error: cannot declare variable ‘pif’ to be of abstract type ‘PrimitiveIndexWriter’ TriangleNodeVisitor.cpp:79: note: because the following virtual functions are pure within ‘PrimitiveIndexWriter’: /usr/local/include/osg/PrimitiveSet:134: note: virtual void osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const osg::Vec2d*) /usr/local/include/osg/PrimitiveSet:135: note: virtual void osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const osg::Vec3d*) /usr/local/include/osg/PrimitiveSet:136: note: virtual void osg::PrimitiveIndexFunctor::setVertexArray(unsigned int, const osg::Vec4d*) make: *** [TriangleNodeVisitor.o] Error 1 ** I checked the code but i have not found any function with pure virtual as the message above said. Any hint to get around that issue? Regards Sajjad On Sat, Apr 11, 2009 at 7:54 PM, Adrian Egli OpenSceneGraph (3D) < 3dh...@gmail.com> wrote: > :-) Once you have some questions, i could answer them, the code is fast > but not very fast :-) have also a look at ompf.org > and search for arauna / bikker > > /adrian > > 2009/4/11 Charles Cossé > > Hi Sajjad, >> >> Attached I have tgz'd-up a file posted earlier (by Adrian Egli?) with >> his first cut at raytracing using a kd tree. I saved all the links >> to the various posts/threads on this subject, also, which can share >> with you if interested. >> >> Charles >> >> On Fri, Apr 10, 2009 at 10:16 PM, ami guru wrote: >> > Hello Forum, >> > >> > >> > I was wondering if there is anyone have done ray tracing using OSG. >> > >> > >> > So far i have got from the forum Jean-Sébastien Guay did his Masters >> thesis >> > on that domain and it would be really nice >> > if he provide the link to the report, at least it would be a starting >> point >> > for me. >> > >> > What do you think Jean? >> > >> > >> > Regards >> > Sajjad >> > >> > >> > >> > >> > ___ >> > osg-users mailing list >> > osg-users@lists.openscenegraph.org >> > >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> > >> >> >> >> -- >> AsymptopiaSoftware|softw...@thelimit >> http://www.asymptopia.org >> >> ___ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > > -- > > Adrian Egli > > ___ > 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] osgvertexprogram example
Hello forum, The shader string in the vertex program example in the assembly code i guess. And it is not making much sense to me. Is that possible to provide the high-level shader (GLSL) snippet and update the patch? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] ray tracing using OSG
Hello Forum, I was wondering if there is anyone have done ray tracing using OSG. So far i have got from the forum Jean-Sébastien Guay did his Masters thesis on that domain and it would be really nice if he provide the link to the report, at least it would be a starting point for me. What do you think Jean? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Light Manager
Hello Brian, I did not understand why down-casting is not possible. Super class can be downcasted to a concrete class through dynamic cast, isnt it? I am afraid that the discussion is getting a bit off -topic now. Sajjad On Thu, Apr 9, 2009 at 3:43 PM, Brian R Hill wrote: > Sajjad, > > You can't cast a group to a switch if it wasn't created as a switch. > > osg::ref_ptr groupOfLights; > > This will always fail and return 0. > osg::Switch * your_switch = dynamic_cast(groupOfLights.get > ()); > > You need to create your groupOfLights as a switch. > > osg::ref_ptr groupOfLights; > > Since a switch is a groud, you can use it as both a group and a switch. > > Also, using dynamic_cast isn't bad. There are situations where it might not > be optimal. But for your intended use - key press events - it's absolutley > acceptable. > > Brian > > > This is a PRIVATE message. If you are not the intended recipient, please > delete without copying and kindly advise us by e-mail of the mistake in > delivery. > NOTE: Regardless of content, this e-mail shall not operate to bind CSC to > any order or other contract unless pursuant to explicit written agreement > or government initiative expressly permitting the use of e-mail for such > purpose. • > > > -osg-users-boun...@lists.openscenegraph.org wrote: - > > > To: OpenSceneGraph Users > From: René Molenaar > Sent by: osg-users-boun...@lists.openscenegraph.org > Date: 04/09/2009 09:28AM > Subject: Re: [osg-users] Light Manager > > Hi Sajjad, > > > There are asType functions is osg::Node, > this has better performance then dynamic_cast ... > > for example you can do: > > osg::ref_ptr switch = group->asSwitch(); > > Now you are using a virtual table to get the right type: > > if the object is a Switch you will get the this-pointer of the Switch > if it is not you will get 0. > > Usually there are always better ways then dynamic_cast, especially > if you are the owner of the code. > > Good Luck, > > Rene > > > > > 2009/4/9 ami guru < dosto.wa...@gmail.com > > > Hello Forum, > > > I have a LightManager class that tracks the number of lights(OpenGL Lights) > that have been created. > > Inside the class the have the following member > > > osg::ref_ptr groupOfLights; > vector > lights; > > the member groupOfLights contain the LightSource as child. > > > In the application i want to select different light (spot,point or diffuse) > with key press event and only one light is enabled during an instant OR i > may enable several lights. > > > In that case i believe that i have to do dynamic casting to cast Group to > Switch. > > In other better way to do that ? > > > > Regards > Sajjad > > ___ > 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
[osg-users] Light Manager
Hello Forum, I have a LightManager class that tracks the number of lights(OpenGL Lights) that have been created. Inside the class the have the following member osg::ref_ptr groupOfLights; vector > lights; the member groupOfLights contain the LightSource as child. In the application i want to select different light (spot,point or diffuse) with key press event and only one light is enabled during an instant OR i may enable several lights. In that case i believe that i have to do dynamic casting to cast Group to Switch. In other better way to do that ? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] MatrixManipulator
Sorry J-S, It was so stupid to make such a mistake . It did work now. Thanks a lot. On Wed, Apr 8, 2009 at 4:09 PM, ami guru wrote: > Hello J-S, > > > I have already tried that , but i am not getting the output that i am > looking for. > > The snippet is as follows: > > > ''' > if (buttonMask == GUIEventAdapter::LEFT_MOUSE_BUTTON) > { > // rotate camera. > > osg::Quat new_rotate; > osg::Quat new_rotate1; > > new_rotate.makeRotate(dx / 3.0f, osg::Vec3(0.0f, 0.0f, 1.0f)); > new_rotate1.makeRotate(dy / 3.0f, osg::Vec3(1.0f, 0.0f, 0.0f)); > > m_rotation = m_rotation * new_rotate * new_rotate1 ; > > return true; > > } > > > > **' > > I am wrong in the concept i believe . > Any hint to to do some trial and error ? > > > > Regards > Sajjad > > > > On Wed, Apr 8, 2009 at 3:04 PM, Jean-Sébastien Guay < > jean-sebastien.g...@cm-labs.com> wrote: > >> Hello Sajjad, >> >> I want to rotate the camera against X axis when the mouse is clicked and >>> dragged vertically - means against the X - axis. with very same left mouse >>> click. >>> Do i have to create another osg::Quat variable for that or use the >>> existing one ? >>> >> >> I'm confused - you have the code, why don't you experiment? You can change >> the manipulator to do whatever you want. >> >> Hint: you can multiply whatever quaternion you have by another one that >> rotates around the X axis by the y mouse input value you get. That will give >> you a compound rotation which is the combination of both rotations. >> >> J-S >> -- >> __ >> Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com >> http://www.cm-labs.com/ >>http://whitestar02.webhop.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] MatrixManipulator
Hello J-S, I have already tried that , but i am not getting the output that i am looking for. The snippet is as follows: ''' if (buttonMask == GUIEventAdapter::LEFT_MOUSE_BUTTON) { // rotate camera. osg::Quat new_rotate; osg::Quat new_rotate1; new_rotate.makeRotate(dx / 3.0f, osg::Vec3(0.0f, 0.0f, 1.0f)); new_rotate1.makeRotate(dy / 3.0f, osg::Vec3(1.0f, 0.0f, 0.0f)); m_rotation = m_rotation * new_rotate * new_rotate1 ; return true; } **' I am wrong in the concept i believe . Any hint to to do some trial and error ? Regards Sajjad On Wed, Apr 8, 2009 at 3:04 PM, Jean-Sébastien Guay < jean-sebastien.g...@cm-labs.com> wrote: > Hello Sajjad, > > I want to rotate the camera against X axis when the mouse is clicked and >> dragged vertically - means against the X - axis. with very same left mouse >> click. >> Do i have to create another osg::Quat variable for that or use the >> existing one ? >> > > I'm confused - you have the code, why don't you experiment? You can change > the manipulator to do whatever you want. > > Hint: you can multiply whatever quaternion you have by another one that > rotates around the X axis by the y mouse input value you get. That will give > you a compound rotation which is the combination of both rotations. > > J-S > -- > __ > Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com > http://www.cm-labs.com/ >http://whitestar02.webhop.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] MatrixManipulator
I have some new issue related to the camera manipulator - subclass of MatrixManipulator that is used in the osgimpostor example. If you have tried the osgimpostor example you will notice that the camera rotate against Z axis when we click the left mouse and drag it from left to right or vice versa. I want to rotate the camera against X axis when the mouse is clicked and dragged vertically - means against the X - axis. with very same left mouse click. Do i have to create another osg::Quat variable for that or use the existing one ? Any suggestion or reference would be of great help. Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: Camera Manipulator
Thanks Jean, Alberto, It did help. I have some new issue related to the camera manipulator. If you have tried the osgimpostor example you will notice that the camera rotate against Z axis when we click the left mouse and drag it left to right or vice versa. I want to rotate the camera against X axis when the mouse is draged vertically - means against the X - axis. with very same left mouse click. Do i have to create another osg::Quat variable for that or use the existing one ? Any suggestion on that . Sajjad -- Forwarded message -- From: Jean-Sébastien Guay Date: Tue, Apr 7, 2009 at 3:07 PM Subject: Re: [osg-users] Camera Manipulator To: OpenSceneGraph Users Hello Sajjad, I would like to find out when that particular function is called and who is > calling that. I am definite that it is called, but could not find out > who is calling that(some function in another class probably ). > Basic debugging technique: Run the code in the debugger, put a breakpoint in the method and when the breakpoint is hit, check the call stack. Couldn't be simpler :-) J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.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] Camera Manipulator
Hello forum, I am going through the example osgimpostor to get the idea of how the quaternion camera is implemented there. The camera manipulator has been derived from the MatrixManipulator class and one of the function that has been over-ridden is setNode(); I would like to find out when that particular function is called and who is calling that. I am definite that it is called, but could not find out who is calling that(some function in another class probably ). Any hint to find that out? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: QT4 ViewerQOSG and Q_OBJECT
Hello Roman, I think i did something similar to what you did. I designed a main window in the Qt Designer and i have created dialog as well where the user can choose the model and load it. I did the whole thing by promoting the Adapter Widget Regards Sajjad -- Forwarded message -- From: Roman Date: Sat, Apr 4, 2009 at 7:03 AM Subject: Re: [osg-users] QT4 ViewerQOSG and Q_OBJECT To: osg-users@lists.openscenegraph.org Thanx guys! Now it works Now I try to use QT wigets in osg fullscreen viewer So I have a task: user select a model from model list in dialog - dialog dissapear a user see model in fullscreen. If I try to use windowed mode all works fine dialogs appears in front of osg widget but in fullscreen mode they appear behind of osg widget and only messagebox popups. If someone made this task please inform how do you make it to work out. Thanx Bye -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=9735#9735 ___ 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] Fwd: QT4 ViewerQOSG and Q_OBJECT
Hello Martin, I have tried the way you have suggested i believe: But ended up having error: AdapterWidget.o: In function `AdapterWidget::AdapterWidget(QWidget*, char const*, QGLWidget const*, QFlags)': AdapterWidget.cpp:(.text+0x6c4): undefined reference to `vtable for AdapterWidget' AdapterWidget.cpp:(.text+0x6d1): undefined reference to `vtable for AdapterWidget' AdapterWidget.o: In function `AdapterWidget::AdapterWidget(QWidget*, char const*, QGLWidget const*, QFlags)': AdapterWidget.cpp:(.text+0x824): undefined reference to `vtable for AdapterWidget' AdapterWidget.cpp:(.text+0x831): undefined reference to `vtable for AdapterWidget' QTOSGMainWindow.o: In function `Ui_MainWindow::setupUi(QMainWindow*)': QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x229): undefined reference to `VTT for ViewerQT' QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x280): undefined reference to `vtable for ViewerQT' QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x28b): undefined reference to `vtable for ViewerQT' QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x293): undefined reference to `vtable for ViewerQT' QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x29e): undefined reference to `vtable for ViewerQT' QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x2ab): undefined reference to `vtable for ViewerQT' QTOSGMainWindow.o:QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x2b6): more undefined references to `vtable for ViewerQT' follow QTOSGMainWindow.o: In function `Ui_MainWindow::setupUi(QMainWindow*)': QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x80c): undefined reference to `vtable for AdapterWidget' QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x814): undefined reference to `vtable for AdapterWidget' QTOSGMainWindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[Ui_MainWindow::setupUi(QMainWindow*)]+0x840): undefined reference to `VTT for ViewerQT' collect2: ld returned 1 exit status make: *** [QtAdapter] Error 1 *** The functional version has the following format class ViewerQT : public osgViewer::Viewer, public AdapterWidget { public: ViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WindowFlags f = 0): AdapterWidget( parent, name, shareWidget, f ) { getCamera()->setViewport(new osg::Viewport(0,0,width(),height())); getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast(width())/static_cast(height()), 1.0f, 1.0f); . .. #ifndef QTOSGMAINWINDOW_H #define QTOSGMAINWINDOW_H #include "ui_MainWindow.h" class QTOSGMainWindow : public QMainWindow { Q_OBJECT public: QTOSGMainWindow(QWidget *parent = 0); ~QTOSGMainWindow(); protected: private slots: void open(); private: void loadFile(const QString &fileName); osg::ref_ptr createSceneGraph(osg::Node*); Ui::MainWindow ui; QString currFile; }; #endif *** Any Hint ? Sajjad -- Forwarded message -- From: Date: Mon, Oct 27, 2008 at 10:10 PM Subject: [osg-users] QT4 ViewerQOSG and Q_OBJECT To: osg-users@lists.openscenegraph.org Not a question so much as a note for the archives. If you want ViewerQOSG to be able to handle signals it must have a Q_OBJECT definition. In order to do this the viewerQT example must swap the order of the definition to "class ViewerQOSG : public QOSGWidget, public osgViewer::Viewer" The QT moc assumes that the parent class derived from QObject is first in the list. In addition QOSGWidget must not have a Q_OBJECT since you cannot inherit from multiple Q_OBJECT defined classes. Martin ___ 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] default coordinate system and camera - newbie
Hello Paul, I have made the following changes, still having the same value: *** int main() { //Creating the viewer osgViewer::Viewer viewer ; *viewer.setCameraManipulator(new osgGA::TrackballManipulator());* //add some event handler //to show the statistics viewer.addEventHandler(new osgViewer::StatsHandler); /* get camera related information */ osg::Vec3f eye; osg::Vec3f dir; osg::Vec3f up; viewer.getCamera()->getViewMatrixAsLookAt(eye,dir,up); cout << "The eye vector: " << eye.x() << " " << eye.y() << " " << eye.z() << endl; cout << "The look at position: " << dir.x() << " " << dir.y() << " " << dir.z() << endl; cout << "The up vector is: " << up.x() << " " << up.y() << " " << up.z() << endl; *** -- Forwarded message -- From: ami guru Date: Thu, Apr 2, 2009 at 2:39 AM Subject: Fwd: [osg-users] default coordinate system and camera - newbie To: OpenSceneGraph Users Hello Paul, I have the following snippet that deals with the viewer **' int main() { //Creating the viewer osgViewer::Viewer viewer ; //add some event handler //to show the statistics viewer.addEventHandler(new osgViewer::StatsHandler); /* get camera related information */ osg::Vec3f eye; osg::Vec3f dir; osg::Vec3f up; viewer.getCamera()->getViewMatrixAsLookAt(eye,dir,up); cout << "The eye vector: " << eye.x() << " " << eye.y() << " " << eye.z() << endl; cout << "The look at position: " << dir.x() << " " << dir.y() << " " << dir.z() << endl; cout << "The up vector is: " << up.x() << " " << up.y() << " " << up.z() << endl; //Creating the root node osg::ref_ptr root = createSceneGraph(); '** Could you provide some hint where the bug might be , at least the way to find it? I want to implement a very simple scenario. A camera that moves along with the key press event. I already have that implemented in OpenGL program where i can roll, pitch yaw and slide with user key press event. I want to map that in the scene graph system. I have the following information predefined *n* = eye - look; *u* = *up* * *n*; *v* = *n* * *u*; To move the camera in an ineractive way i have to have the access to there values . there is a function in the Camera Class called getViewMatrix() , i hope that it is one to access these values. Any more reference would be of great help. -- Forwarded message -- From: Paul Martz Date: 2009/4/2 Subject: Re: [osg-users] default coordinate system and camera - newbie To: OpenSceneGraph Users The CameraManipulator (like TrackballManipulator, for example) determines the default orientation. You can change this default by setting the up vector in the TrackballManipulator. By default, the TrackballManipulator uses positive Z up, so if your code is getting positive Y up, either you have a bug or you are not using the TrackballManipulator or you have changed its default. The default view position is also determined by the CameraManipulator. The TrackballManipulator, for example, has a home position that you can set. By default, it considers the scene bounding volume and tries to position the view so that the entire scene fits within a 50 degree FOV (I think it's 50, not sure). Paul Martz *Skew Matrix Software LLC* http://www.skew-matrix.com +1 303 859 9466 -- *From:* osg-users-boun...@lists.openscenegraph.org [mailto: osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *ami guru *Sent:* Wednesday, April 01, 2009 1:58 PM *To:* OpenSceneGraph Users *Subject:* [osg-users] default coordinate system and camera - newbie Hello forum, osgViewer , by default uses the world coordinate system that is oriented with positive X to right , positive Z up, and positive Y into the screen. Does that mean the camera' s defualt position is at the origin looking down into the screen which is positive Y? I have tried to extract the vectors using the function ' osg::Vec3f eye; osg::Vec3f dir; osg::Vec3f up; viewer.getCamera()->getViewMatrixAsLookAt(eye,dir,up); cout << "The eye vector: " << e
[osg-users] Fwd: default coordinate system and camera - newbie
Hello Paul, I have the following snippet that deals with the viewer **' int main() { //Creating the viewer osgViewer::Viewer viewer ; //add some event handler //to show the statistics viewer.addEventHandler(new osgViewer::StatsHandler); /* get camera related information */ osg::Vec3f eye; osg::Vec3f dir; osg::Vec3f up; viewer.getCamera()->getViewMatrixAsLookAt(eye,dir,up); cout << "The eye vector: " << eye.x() << " " << eye.y() << " " << eye.z() << endl; cout << "The look at position: " << dir.x() << " " << dir.y() << " " << dir.z() << endl; cout << "The up vector is: " << up.x() << " " << up.y() << " " << up.z() << endl; //Creating the root node osg::ref_ptr root = createSceneGraph(); '** Could you provide some hint where the bug might be , at least the way to find it? I want to implement a very simple scenario. A camera that moves along with the key press event. I already have that implemented in OpenGL program where i can roll, pitch yaw and slide with user key press event. I want to map that in the scene graph system. I have the following information predefined *n* = eye - look; *u* = *up* * *n*; *v* = *n* * *u*; To move the camera in an ineractive way i have to have the access to there values . there is a function in the Camera Class called getViewMatrix() , i hope that it is one to access these values. Any more reference would be of great help. -- Forwarded message -- From: Paul Martz Date: 2009/4/2 Subject: Re: [osg-users] default coordinate system and camera - newbie To: OpenSceneGraph Users The CameraManipulator (like TrackballManipulator, for example) determines the default orientation. You can change this default by setting the up vector in the TrackballManipulator. By default, the TrackballManipulator uses positive Z up, so if your code is getting positive Y up, either you have a bug or you are not using the TrackballManipulator or you have changed its default. The default view position is also determined by the CameraManipulator. The TrackballManipulator, for example, has a home position that you can set. By default, it considers the scene bounding volume and tries to position the view so that the entire scene fits within a 50 degree FOV (I think it's 50, not sure). Paul Martz *Skew Matrix Software LLC* http://www.skew-matrix.com +1 303 859 9466 -- *From:* osg-users-boun...@lists.openscenegraph.org [mailto: osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *ami guru *Sent:* Wednesday, April 01, 2009 1:58 PM *To:* OpenSceneGraph Users *Subject:* [osg-users] default coordinate system and camera - newbie Hello forum, osgViewer , by default uses the world coordinate system that is oriented with positive X to right , positive Z up, and positive Y into the screen. Does that mean the camera' s defualt position is at the origin looking down into the screen which is positive Y? I have tried to extract the vectors using the function ' osg::Vec3f eye; osg::Vec3f dir; osg::Vec3f up; viewer.getCamera()->getViewMatrixAsLookAt(eye,dir,up); cout << "The eye vector: " << eye.x() << " " << eye.y() << " " << eye.z() << endl; cout << "The look at position: " << dir.x() << " " << dir.y() << " " << dir.z() << endl; cout << "The up vector is: " << up.x() << " " << up.y() << " " << up.z() << endl; The eye vector: 0 0 0 The look at position: 0 0 -1 The up vector is: 0 1 0 I was wondering if the up vector be Z axis instead Regards Sajjad ___ 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] default coordinate system and camera - newbie
Hello forum, osgViewer , by default uses the world coordinate system that is oriented with positive X to right , positive Z up, and positive Y into the screen. Does that mean the camera' s defualt position is at the origin looking down into the screen which is positive Y? I have tried to extract the vectors using the function ' osg::Vec3f eye; osg::Vec3f dir; osg::Vec3f up; viewer.getCamera()->getViewMatrixAsLookAt(eye,dir,up); cout << "The eye vector: " << eye.x() << " " << eye.y() << " " << eye.z() << endl; cout << "The look at position: " << dir.x() << " " << dir.y() << " " << dir.z() << endl; cout << "The up vector is: " << up.x() << " " << up.y() << " " << up.z() << endl; The eye vector: 0 0 0 The look at position: 0 0 -1 The up vector is: 0 1 0 I was wondering if the up vector be Z axis instead Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: osgshadow not functional
Thanks Gordon, But right now it is out of means to get another system. I have checked the extensions support of my card. "GL_ARB_shadow" "GL_ARB_shadow_ambient" Are they not the one that osgshadow is using? I hope to get some solution to get around that issue Sajjad -- Forwarded message -- From: Gordon Tomlinson Date: 2009/3/28 Subject: Re: [osg-users] osgshadow not functional To: OpenSceneGraph Users One thing to get it working would be to buy a card they REALLY supports OpenGL like an Nvidia Card… __ *Gordon Tomlinson * *gor...@gordontomlinson.com* IM: *gordon3db...@3dscenegraph.com* *www.vis-sim.com www.gordontomlinson.com* __ *From:* osg-users-boun...@lists.openscenegraph.org [mailto: osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *ami guru *Sent:* Saturday, March 28, 2009 4:40 PM *To:* OpenSceneGraph Users *Subject:* [osg-users] osgshadow not functional Hello forum, osgshadow is giving the following error: * Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) I am running on ubuntu with ATI X1600 that supports OpenGL 2.1. What are things i have to look into to get that working? Regards Sajjad ___ 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] osgshadow not functional
Hello forum, osgshadow is giving the following error: * Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,) I am running on ubuntu with ATI X1600 that supports OpenGL 2.1. What are things i have to look into to get that working? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: Fwd: Fwd: CallBack issue
Hello Ulrich, So you mean that the setMatrix() function after the callback is not making any difference to the scene. But i get different scene when i toggle the matrix setup after the callback. With setMatrix() after the callback i get two cows side by side and the left one is rotating around z Without setMatrix() after the callback i still do get two cows side by side and the left one is rotating around z by the left ones head is cut by the window view. http://code.google.com/p/osgqsg/source/browse/trunk/Examples/Callback/CallbackMain.cpp Sajjad -- Forwarded message -- From: Ulrich Hertlein Date: Sat, Mar 28, 2009 at 12:26 PM Subject: Re: [osg-users] Fwd: Fwd: CallBack issue To: OpenSceneGraph Users Hello Sajjad, On 28/3/09 10:00 PM, ami guru wrote: > The following snippet may elaborate more: > > **' > mtLeft->setUpdateCallback(new RotateCB); > > osg::Matrix m; > m.makeTranslate(-6.0f,0.0f,0.0f); > mtLeft->setMatrix(m); > > *' > > On the above snippet we have made a translation after the callback. And > that one is appended to the one that has been called inside the RotateCB. > First of all, the fact that you set a translation matrix is irrelevant. The callback (as you have posted in a previous mail) will always overwrite whatever matrix you set during setup. I understand the point you're trying to make. What I'm saying is that when you use MatrixTransform->setMatrix(m) you're loosing anything that has been set before. If you want to preserve that (i.e. the translation in your example) you have to take care of that yourself. >From what I grok you're looking for a way to keep the translation part and only change the rotation. You could try to do something like: Matrix m = mt->getMatrix(); m.setRotate(quat) mt->setMatrix(m); Or use decompose(), change the rotation and re-assemble the matrix: scaling, rotation, transform and all. Or pass the translation to the update callback so that it can assemble and set the proper transformation matrix. Or split the translation and the rotation into different MatrixTransforms. Many roads lead to Rome. matrixTransform->setMatrix(Matrix::makeRotate(...)) is not one of them. ;-) Hope this helps, /ulrich ___ 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] Fwd: Fwd: CallBack issue
Hello ulrich, The following snippet may elaborate more: **' //SET THE data variance to dynamic to let OSG know that //we shall modify this node during update traversal mtLeft->setDataVariance(osg::Object::DYNAMIC); //set the update callback mtLeft->setUpdateCallback(new RotateCB); osg::Matrix m; m.makeTranslate(-6.0f,0.0f,0.0f); mtLeft->setMatrix(m); mtLeft->addChild(cow.get()); *' On the above snippet we have made a translation after the callback. And that one is appended to the one that has been called inside the RotateCB. The code snippet has been taken from the starter guide. Regards Sajjad -- Forwarded message -- From: Ulrich Hertlein Date: Sat, Mar 28, 2009 at 5:04 AM Subject: Re: [osg-users] Fwd: CallBack issue To: OpenSceneGraph Users Hi Sajjad, On 28/3/09 12:01 PM, ami guru wrote: > With callbacks we dynamically modify the node during the update > traversal.So any node that has already gone through some affine > transformation will be replaced in the call backs, but not concatenated. > > On the other hand if we specify any affine trnasformation after calling > the callback, the last transformation will be concatenated to the one > that have been assigned durng callbacks. > > And that happens to any type of dynamic transformation , not only with > the affine one. > I'm not quite sure I follow you. What you're describing has nothing to do with the update traversal as such. You're setting the transformation matrix of a certain node. Naturally this overwrites whatever was set before. If you need a certain transformation (e.g. a scale) to be preserved then either put it in a parent or child MatrixTransform or include it in the calculated matrix. Or decompose the existing matrix and re-assemble it with the modified values. Cheers, /ulrich ___ 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] Fwd: CallBack issue
Thanks Paul and Ulrich It works fine now. I have some issue to discuss about Callbacks With callbacks we dynamically modify the node during the update traversal.So any node that has already gone through some affine transformation will be replaced in the call backs, but not concatenated. On the other hand if we specify any affine trnasformation after calling the callback, the last transformation will be concatenated to the one that have been assigned durng callbacks. And that happens to any type of dynamic transformation , not only with the affine one. Please correct me if i misunderstood the concept. Regards Sajjad -- Forwarded message -- From: Ulrich Hertlein Date: Sat, Mar 28, 2009 at 12:24 AM Subject: Re: [osg-users] CallBack issue To: OpenSceneGraph Users Hello Ami, On 28/3/09 8:50 AM, ami guru wrote: > virtual void operator()(osg::Node *node, > osg::NodeVisitor *nv) > { > osg::Matrix mR; > mR.makeRotate(m_angle, osg::Vec3(0.0f,0.0f,1.0f)); > > mtLeft->setMatrix(mR); > ... > > osg::Vec3f teapotTransVec = osg::Vec3f(5,2,-12); > osg::Vec3f teapotScaleVec = osg::Vec3f(20.1f,20.1f,20.1f); > teapotTransMat.makeTranslate(teapotTransVec); > teapotScaleMat.makeScale(teapotScaleVec); > > teapotPos->setMatrix(teapotTransMat * teapotScaleMat); > You're originally including a scaling transform in the Matrix. The Callback operator replaces this with only a rotation matrix i.e. the scaling part is lost hence the object looks smaller. Cheers, /ulrich ___ 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] CallBack issue
Hello forum, I am trying to rorate an object continuously through a call back. Before calling the calback i am doing some affine transformation over that object The final rendered the scaled down to a tiny object . In the callback subclass i am overloading the () operator and i am performing the rotation, not any kind of scaling down. **code**' class RotateCB : public osg::NodeCallback { public: RotateCB() : m_angle(0) { } virtual void operator()(osg::Node *node, osg::NodeVisitor *nv) { /* Normally, check to make sure that we have an update visitor, not necessary in this simple example */ osg::MatrixTransform * mtLeft = dynamic_cast(node); osg::Matrix mR; mR.makeRotate(m_angle, osg::Vec3(0.0f,0.0f,1.0f)); mtLeft->setMatrix(mR); //Increment the angle for the next from m_angle += 0.01; /* Continue traversing so that OSG can process any other nodes with callbacks */ traverse(node,nv); } . osg::ref_ptr teapotPos = new osg::MatrixTransform; osg::Matrix teapotTransMat; osg::Matrix teapotScaleMat; osg::Vec3f teapotTransVec = osg::Vec3f(5,2,-12); osg::Vec3f teapotScaleVec = osg::Vec3f(20.1f,20.1f,20.1f); teapotTransMat.makeTranslate(teapotTransVec); teapotScaleMat.makeScale(teapotScaleVec); teapotPos->setMatrix(teapotTransMat * teapotScaleMat); //SET THE data variance to dynamic to let OSG know that //we shall modify this node during update traversal teapotPos->setDataVariance(osg::Object::DYNAMIC); //SET THE update callback teapotPos->setUpdateCallback(new RotateCB); ... *' Any hint? Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Trackball Functionality - The concept
Hello Forum, Could some one provide more reference to the trackball functionality Is there any connection to the osgGA::TrackballManipulator* tbm = new osgGA::TrackballManipulator(); I did not find enough information on that and its usage. in the osganimationmakepath i have commented that above line but did not make any difference to the entire scene It would be of great help if some provide some link regarding that Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: Fwd: osganimate
Thanks Cory, It works now. Had to separate the export command in another line. Yes i am running Ubuntu *Now export OSG_FILE_PATH=/home/sajjad/downloads/OpenSceneGraph/OpenSceneGraph-Data-2.6.0 * ***Before*** export PATH=$PATH:$ACG_PATH:$H3D_ PATH:$H3DUTIL_INCLUDE_DIR:$HAPI_INCLUDE_DIR:$WM4_PATH:$OPENSCENEGRAPH_PATH:$OSG_FILE_PATH:$FTGL_PATH: All piled up together with the other file paths ***'** Thanks for discussing that off-topic here -- Forwarded message -- From: Cory Riddell Date: 2009/3/26 Subject: Re: [osg-users] Fwd: osganimate To: OpenSceneGraph Users If you just type: osgviewer cessna.osg or osgviewer glider.osg do you see the cessna and the glider? It sounds like the files aren't being loaded for some reason. That would suggest either a permissions issue with the OSG_FILE_PATH directory, or perhaps you don't have all the OSG modules available. Did you also make the LD_LIBRARY_PATH change mentioned on that page (I'm assuming you are running Unix). When I run osganimate, I see the cessna and the glider circling above the checkerboard. Cory ami guru wrote: Thanks Cory, I already have the path set as follows: #OpenSceneGraph related flags OPENSCENEGRAPH_PATH=/usr/local/share/OpenSceneGraph/bin OSG_FILE_PATH=/home/sajjad/downloads/OpenSceneGraph/OpenSceneGraph-Data-2.6.0 OSG_NOTIFY_LEVEL=NOTICE export PATH=$PATH:$ACG_PATH:$H3D_PATH:$H3DUTIL_INCLUDE_DIR:$HAPI_INCLUDE_DIR:$WM4_PATH:$OPENSCENEGRAPH_PATH:$OSG_FILE_PATH:$FTGL_PATH: It just render the checkbox plane , but no animation But not working. -- Forwarded message -- From: Cory Riddell Date: 2009/3/26 Subject: Re: [osg-users] osganimate To: OpenSceneGraph Users According to this page: http://www.openscenegraph.org/projects/osg/wiki/Support/UserGuides/Examples you need to have OSG_FILE_PATH set. Then "osganimate --overlay" should work. It does for me. Cory ami guru wrote: Hello forum, I am going through the osg examples and i have an issue with one of the following osganimate What is the expected output of that example? - It should be some kind of animation I used the following commands , but getting no animation except the rendering of the base. osganimate --persp ../../../OpenSceneGraph-Data-2.6.0/glider.osg osganimate --ortho ../../../OpenSceneGraph-Data-2.6.0/glider.osg osganimate --object ../../../OpenSceneGraph-Data-2.6.0/glider.osg I must be missing something. Any hint? Regards Sajjad -- ___ osg-users mailing listosg-us...@lists.openscenegraph.orghttp://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 listosg-us...@lists.openscenegraph.orghttp://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] Fwd: osganimate
Thanks Cory, I already have the path set as follows: #OpenSceneGraph related flags OPENSCENEGRAPH_PATH=/usr/local/share/OpenSceneGraph/bin OSG_FILE_PATH=/home/sajjad/downloads/OpenSceneGraph/OpenSceneGraph-Data-2.6.0 OSG_NOTIFY_LEVEL=NOTICE export PATH=$PATH:$ACG_PATH:$H3D_PATH:$H3DUTIL_INCLUDE_DIR:$HAPI_INCLUDE_DIR:$WM4_PATH:$OPENSCENEGRAPH_PATH:$OSG_FILE_PATH:$FTGL_PATH: It just render the checkbox plane , but no animation But not working. -- Forwarded message -- From: Cory Riddell Date: 2009/3/26 Subject: Re: [osg-users] osganimate To: OpenSceneGraph Users According to this page: http://www.openscenegraph.org/projects/osg/wiki/Support/UserGuides/Examples you need to have OSG_FILE_PATH set. Then "osganimate --overlay" should work. It does for me. Cory ami guru wrote: Hello forum, I am going through the osg examples and i have an issue with one of the following osganimate What is the expected output of that example? - It should be some kind of animation I used the following commands , but getting no animation except the rendering of the base. osganimate --persp ../../../OpenSceneGraph-Data-2.6.0/glider.osg osganimate --ortho ../../../OpenSceneGraph-Data-2.6.0/glider.osg osganimate --object ../../../OpenSceneGraph-Data-2.6.0/glider.osg I must be missing something. Any hint? Regards Sajjad -- ___ osg-users mailing listosg-us...@lists.openscenegraph.orghttp://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] osganimate
Hello forum, I am going through the osg examples and i have an issue with one of the following osganimate What is the expected output of that example? - It should be some kind of animation I used the following commands , but getting no animation except the rendering of the base. osganimate --persp ../../../OpenSceneGraph-Data-2.6.0/glider.osg osganimate --ortho ../../../OpenSceneGraph-Data-2.6.0/glider.osg osganimate --object ../../../OpenSceneGraph-Data-2.6.0/glider.osg I must be missing something. Any hint? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: generate height map using fractal
Thanks Paul, I tried to generate the terrain according to your suggestion, and it did work for incremental value multiplied with the value generated by the fractals algorithm. I was scaling the terrain that that is why the terrain looked so flat, so rescale the normal hoping that the fractals will show up propertly. But the same flat surface without the incremental value. Regards Sajjad -- Forwarded message -- From: Paul Martz Date: Sun, Mar 22, 2009 at 11:27 PM Subject: Re: [osg-users] generate height map using fractal To: OpenSceneGraph Users Wow. That article is like 13 years old. I think I wrote it with VC4 and OpenGL 1.1. As a debugging technique, try to separate the heightfield population algorithm from the rendering issue. For example, try populating the heightfield with an array of linearly increasing values and see if it renders as you would expect. If it still renders wrong, then you know the fractal algorithm isn't to blame and the problem is probably with how you are using OSG. As a result, you'll have a much simpler example to post here. I'd also suggest using Geometry instead of some other Drawable, as Geometry is more flexible (you can run them through the Simplifier, for example). Paul Martz *Skew Matrix Software LLC* http://www.skew-matrix.com +1 303 859 9466 -- *From:* osg-users-boun...@lists.openscenegraph.org [mailto: osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *ami guru *Sent:* Sunday, March 22, 2009 7:46 AM *To:* OpenSceneGraph Users *Subject:* [osg-users] generate height map using fractal Hello forum, I have been using the Paul's article about generating terrain using fractals http://gameprogrammer.com/fractal.html I am populating the values in the osg height map structure. But The rendering is giving me a flat surface. I hope that Paul sees that as well. osg::ref_ptr myTerrain = new osg::Geode; //Now load the terrain /* osg::ref_ptr terrainNode (osgDB::readNodeFile("Terrain2.3ds")); terrainScaleMat->addChild(terrainNode.get()); */ //generate the 2D fractal float *heightData = alloc2DFractArray(512); //Define some constants for the fractal terrain static const float DEF_HEIGHT_SCALE = 0.1f; static float TILING_SURFACE = 3; int randomSeed = 1; float H = 0.3; float iteration = 10; fill2DFractArray (heightData,512, randomSeed,DEF_HEIGHT_SCALE,H); //using the height field osg::ref_ptr heightMap = new osg::HeightField; //allocate the space for the height field heightMap->allocate(512,512); //populate the height map for(unsigned int i = 0; i < heightMap->getNumColumns();i++) { for(unsigned int j = 0; j < heightMap->getNumRows();j++) { int size = heightMap->getNumRows(); heightMap->setHeight(i,j,heightData[(i*size)+j]); //std::cout << heightMap->getHeight(i,j) << std::endl; } } //now add the drawable to the terain myTerrain->addDrawable(new osg::ShapeDrawable(heightMap.get())); Regards, Sajjad ___ 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] generate height map using fractal
Hello forum, I have been using the Paul's article about generating terrain using fractals http://gameprogrammer.com/fractal.html I am populating the values in the osg height map structure. But The rendering is giving me a flat surface. I hope that Paul sees that as well. osg::ref_ptr myTerrain = new osg::Geode; //Now load the terrain /* osg::ref_ptr terrainNode (osgDB::readNodeFile("Terrain2.3ds")); terrainScaleMat->addChild(terrainNode.get()); */ //generate the 2D fractal float *heightData = alloc2DFractArray(512); //Define some constants for the fractal terrain static const float DEF_HEIGHT_SCALE = 0.1f; static float TILING_SURFACE = 3; int randomSeed = 1; float H = 0.3; float iteration = 10; fill2DFractArray (heightData,512, randomSeed,DEF_HEIGHT_SCALE,H); //using the height field osg::ref_ptr heightMap = new osg::HeightField; //allocate the space for the height field heightMap->allocate(512,512); //populate the height map for(unsigned int i = 0; i < heightMap->getNumColumns();i++) { for(unsigned int j = 0; j < heightMap->getNumRows();j++) { int size = heightMap->getNumRows(); heightMap->setHeight(i,j,heightData[(i*size)+j]); //std::cout << heightMap->getHeight(i,j) << std::endl; } } //now add the drawable to the terain myTerrain->addDrawable(new osg::ShapeDrawable(heightMap.get())); Regards, Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: creating widget for Qt
Hello Ivan, What is the difference betwen the AdapterWidget and QOSGWidget. I found one to be the subclass of GLWidget and the other is QWidget. Which one is better ? Any explanation? Regards Sajjad -- Forwarded message -- From: Iván Cuevas Date: 2009/3/19 Subject: Re: [osg-users] creating widget for Qt To: osg-users@lists.openscenegraph.org Hi Sajjad, The warnigs are because I'm rendering in a QWidget out of the paint event. These warnings doesn't appear if you render in a QGLWidget, but the CompositeViewer framework with multiple OSG views in different widgets and multi-threaded does no render properly (at least for me [Crying or Very sad] ) Recently I moved to Qt 4.5.0 and I had a new problem with undesired repaint event when the OSG widget lost the focus. For example when a modal dialog is shown, my QWidget embbeding the osg::View is repainted with the background color and the content are removed until the osg widget recovers the focus and is repainted again. I solved this problem using QWidget::setUpdatesEnabled(false) but still I have the problem of the warnings. I think is not the same situation than yours because you are extending from AdapterWidget, but tell if you discover something ;) Regards, Iván -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8755#8755 ___ 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] Fwd: OpenGL EXTENSION support
Hello Robert, Thanks for the hint. But i did not understand the idea of "Current OpenGL context" And the class that you specified requires a context id to instantiate GL2Extensions object. Any more reference into that matter would be of great help Regards Sajjad -- Forwarded message -- From: Robert Osfield Date: 2009/3/19 Subject: Re: [osg-users] OpenGL EXTENSION support To: OpenSceneGraph Users HI Sajjad, 2009/3/18 ami guru > Is there any class or interface in OSG that can query and print out the > supported extensions within the OpenGL driver ? > There isn't a single method that returns a list of all supported extensions, but there are various methods for getting OpenGL function pointers and checking whether a specific extension is supported. See include/osg/GLExtensions. Please note you'll need to have a valid graphics context, and for the extensions to be initialised before the functions will work as you can only do OpenGL calls from a thread with a valid graphics context. If you have happy do debug work on your app, then enable the verbose debug messages and this will output the lists of supported extensions for you. set the env var OSG_NOTIFY_LEVEL to DEBUG. Robert. ___ 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] question about qt example
Hello Ben, I have the same question as well. I personally using the AdapterWidget with Qt. The only diffrence i found is that AdapterWidget is derived from GLWidget and the other from QWidget. The former one is more concrete than the latter one i guess, GLwidget is using the OpenGL framework. Whereas the QWidget is using something that i did not understand much. I even put seveeral cout statement to see which one is running by default. But i did not get any output even though i think that adapter widget is running if you run it without any flag. Did you encounter that particular issue? I wanted to see how the arguments are passed to the function concerned. I hope that some one will put more light into that matter. Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OpenGL EXTENSION support
Hello forum, Is there any class or interface in OSG that can query and print out the supported extensions within the OpenGL driver ? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fwd: creating widget for Qt
Hello Ivan i shall try to elaborate the way i implemented that and your feedback is most welcome on that. 1. Separated the following files from the osgviewerQT example. AdapterWidget.h AdapterWidget.cpp ViewerQT.h And promoted the widget to the ViewerQT.h Loading the widget in the mainwindow and can load different model. And i did not recieve any warning so far. Yo said that you are having that while paint event(), Where are you exactly having that paint event() ? Did you mean that in the AdapterWidget that is the subclass of GLWidget? Regards Sajjad -- Forwarded message -- From: ami guru Date: Tue, Mar 17, 2009 at 1:04 PM Subject: Fwd: [osg-users] creating widget for Qt To: qt-inter...@trolltech.com Hello Ivan i shall try to elaborate the way i implemented that and your feedback is most welcome on that. 1. Separated the following files from the osgviewerQT example. AdapterWidget.h AdapterWidget.cpp ViewerQT.h And promoted the widget to the ViewerQT.h Loading the widget in the mainwindow and can load different model. And i did not recieve any warning so far. Yo said that you are having that while paint event(), Where are you exactly having that paint event() ? Did you mean that in the AdapterWidget that is the subclass of GLWidget? Regards Sajjad -- Forwarded message -- From: ami guru Date: Tue, Mar 17, 2009 at 12:59 PM Subject: Fwd: [osg-users] creating widget for Qt To: qt-inter...@trolltech.com Hello Ivan i shall try to elaborate the way i implemented that and your feedback is most welcome on that. 1. Separated the following files from the osgviewerQT example. AdapterWidget.h -- Forwarded message -- From: Iván Cuevas Date: 2009/3/16 Subject: Re: [osg-users] creating widget for Qt To: osg-users@lists.openscenegraph.org I don't use .pro files, but I have to include the OpenGL module because I extend from QGLWidget. Regards, Iván. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=8567#8567 ___ 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] Fwd: creating widget for Qt
Hello Ivan, In the pro file do i have to include OpenGL module or just the library linker for Openscenegraph will suffice Regards Sajjad -- Forwarded message -- From: Iván Date: Wed, Mar 4, 2009 at 11:27 PM Subject: Re: [osg-users] creating widget for Qt To: osg-users@lists.openscenegraph.org Hi Sajjad, Personally I create the whole interface in Qt designer and leave the OSG widget/s integration in the initialization code. About the header file, I 've separated the code from the original OSG file in my own files (.h and .cpp) As you can see in the Qt sample you have different options to render OSG in a Qt widget. This works for me except for some warnings because of rendering out of QPainter events, but I will deal with this later :) I hope this help you in some way, Iván. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=7966#7966 ___ 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] creating widget for Qt
Hello forum, I would like to create a viewer widget for osg using the Qt designer. To promote it i need the corresponding header file to that. As i see in the source you have the class declaration and definition in a sigle .cpp file. Do i have to separate them or the header file is located somewhere else that i did not find. Any hint? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] X3D content
Does OSG has any support node to load X3D content? Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Browser integration
me four!!! [EMAIL PROTECTED] sajjad On Fri, Oct 31, 2008 at 8:32 PM, Charles Cossé <[EMAIL PROTECTED]> wrote: > me three! > > On Fri, Oct 31, 2008 at 12:43 PM, Mario Mango Furnari > <[EMAIL PROTECTED]> wrote: > > Quoting Wang Rui <[EMAIL PROTECTED]>: > > Hi Wang, > > > > I'm interested too ([EMAIL PROTECTED]) > > Thank you in advance. > > > > Mario Mango Furnari > >> Hi, > >> > >> I don't think it easy for me to translate the whole page into english in > a > >> short time. :) But I'm glad to share my project freely. I will send you > a > >> private mail later in order not to bother others. > >> > >> Wang Rui > >> 2008/10/31 Andreas Goebel <[EMAIL PROTECTED]> > >> > >> > Hello Wang Rui, > >> > > >> > if this is all code needed, it is quite simple. Very nice! Thank you > for > >> > posting this. > >> > > >> > Unfortunately I do not understand enough to see if this would be > useful > >> for > >> > me. Maybe my interest motivates you to translate your wiki (at least > this > >> > part of it) to english, I am sure other users could benefit from it as > >> well. > >> > > >> > Regards, > >> > > >> > Andreas > >> > > >> > > > > > > --- > > > > Istituto di Cibernetica "E. Caianiello" > > Comprensorio A. Olivetti Ed. 70 > > Via Campi Flegrei, 34 > > > > I-80078 - Pozzuoli (Italy) > > > > Tel:+39.081.867.5154 > > Fax:+39.081.867.5109 > > Mobile: +39.335.539.8250 > > > > - > > This mail sent through IMP: http://horde.org/imp/ > > > > ___ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > -- > AsymptopiaSoftware|[EMAIL PROTECTED] >http://www.asymptopia.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] Shader issue
Hello forum, I would like to load and apply different shaders(written in GLSL) to the same model with the differet GUI events(may be keypress event). I shall have also have the option of different light source type as well(directional,point ,area) and their numbers. The Geometry node will be same but the material will be changed i guess. Any suggestion? By the way does the site remain down during the weekends? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] StateSet - newbie
Hello Joakim, It works fine now with little amendment mentioned in bold text Are they conceptually ok - the 2 lines in bold text? ** ref_ptr capsuleGeode = new Geode; ref_ptr capsuleShape = new Capsule(Vec3f(3,0,0),1,2); ref_ptr capsuleDrawable = new ShapeDrawable(capsuleShape. get()); capsuleGeode->addDrawable(capsuleDrawable.get()); ref_ptr capsuleState = capsuleGeode->getOrCreateStateSet(); //create the shader parameters ref_ptr capsuleProgramObject = new Program; * ref_ptr capsuleVertexObject = new Shader(*(Shader::** readShaderFile(Shader::VERTEX,**"shaderSRC/gooch.vert"))); ref_ptr capsuleFragmentObject = new Shader(*(Shader::** readShaderFile(Shader::**FRAGMENT,"shaderSRC/gooch.**vert"))); * capsuleProgramObject->addShader(capsuleVertexObject.get()); capsuleProgramObject->addShader(capsuleFragmentObject.get()); //create a new stateset //with the default setting capsuleState->setAttribute(capsuleProgramObject.get()); //Passing the uniform variable representing the texture to the shader capsuleState->addUniform(new osg::Uniform("LightPosition",osg::Vec3(0,0,10))); capsuleState->addUniform(new osg::Uniform("SurfaceColor",osg::Vec3(0.75,0.75,0.75))); capsuleState->addUniform(new osg::Uniform("WarmColor",osg::Vec3(1,0,0))); capsuleState->addUniform(new osg::Uniform("CoolColor",osg::Vec3(0,0,0.6))); capsuleState->addUniform(new osg::Uniform("DiffuseWarm",0.45f)); capsuleState->addUniform(new osg::Uniform("DiffuseCool", 0.45f)); root->addChild(capsuleGeode.get()); I replaced them with the following one *** ref_ptr root = new Group(); ref_ptr capsuleGeode = new Geode; ref_ptr capsuleShape = new Capsule(Vec3f(3,0,0),1,2); ref_ptr capsuleDrawable = new ShapeDrawable(capsuleShape.get()); capsuleGeode->addDrawable(capsuleDrawable.get()); ref_ptr capsuleState = capsuleGeode->getOrCreateStateSet(); //create the shader parameters ref_ptr capsuleProgramObject = new Program; * ref_ptr capsuleVertexShader = new Shader(Shader::VERTEX); capsuleVertexShader->loadShaderSourceFromFile("shaderSRC/gooch.vert"); ref_ptr capsuleFragmentShader = new Shader(Shader::FRAGMENT); capsuleFragmentShader->loadShaderSourceFromFile("shaderSRC/gooch.frag"); * capsuleProgramObject->addShader(capsuleVertexShader.get()); capsuleProgramObject->addShader(capsuleFragmentShader.get()); //create a new stateset //with the default setting capsuleState->setAttribute(capsuleProgramObject.get()); //Passing the uniform variable representing the texture to the shader capsuleState->addUniform(new osg::Uniform("LightPosition",osg::Vec3(0,0,10))); capsuleState->addUniform(new osg::Uniform("SurfaceColor",osg::Vec3(0.75,0.75,0.75))); capsuleState->addUniform(new osg::Uniform("WarmColor",osg::Vec3(1,0,0))); capsuleState->addUniform(new osg::Uniform("CoolColor",osg::Vec3(0,0,0.6))); capsuleState->addUniform(new osg::Uniform("DiffuseWarm",0.45f)); capsuleState->addUniform(new osg::Uniform("DiffuseCool", 0.45f)); root->addChild(capsuleGeode.get()); *** Sajjad On Wed, Oct 15, 2008 at 11:48 PM, ami guru <[EMAIL PROTECTED]> wrote: > Thanks Joakim, > > I believe that sharing the stateset will be required here > > I am trying to attach a simple shader but sharing the stateset is not > giving me the result > that i am supposed to have > > > ** > ref_ptr capsuleGeode = new Geode; > ref_ptr capsuleShape = new Capsule(Vec3f(3,0,0),1,2); > ref_ptr capsuleDrawable = new > ShapeDrawable(capsuleShape.get()); > > capsuleGeode->addDrawable(capsuleDrawable.get()); > > ref_ptr capsuleState = capsuleGeode->getOrCreateStateSet(); > > > //create the shader parameters > ref_ptr capsuleProgramObject = new Program; > > ref_ptr capsuleVertexObject = new > Shader(*(Shader::readShaderFile(Shader::VERTEX,"shaderSRC/gooch.vert"))); > ref_ptr capsuleFragmentObject = new > Shader(*(Shader::readShaderFile(Shader::FRAGMENT,"shaderSRC/gooch.vert"))); > > capsuleProgramObject->addShader(capsuleVertexObject.get()); > capsuleProgramObject->addShader(capsuleFragmentObject.get()); > > > //create a new stateset > //with the default setting > capsuleState->setAttribute(capsuleProgramObject.get()); > > > //Passing the uniform variable representing the texture to the shader > capsuleState->addUniform(new > osg::Uniform("LightPosition",osg::Vec3(0,0,10))); > capsuleStat
Re: [osg-users] StateSet - newbie
Hi Joakim, Thats the error with the previous suggestion *' FRAGMENT glCompileShader "" FAILED FRAGMENT Shader "" infolog: Fragment shader failed to compile with the following errors: ERROR: 0:19: 'gl_Vertex' : undeclared identifier ERROR: 0:20: 'gl_Normal' : undeclared identifier ERROR: 0:20: 'normalize' : no matching overloaded function found ERROR: 0:20: '=' : cannot convert from 'const float' to 'undefined interpolation 3-component vector of float' ERROR: 0:22: 'assign' : l-value required "ReflectVec" (can't modify a varying) ERROR: 0:23: 'assign' : l-value required "ViewVec" (can't modify a varying) ERROR: 0:24: 'assign' : l-value required "NdotL" (can't modify a varying) ERROR: 0:25: 'gl_Position' : undeclared identifier ERROR: 0:25: 'ftransform' : no matching overloaded function found ERROR: 9 compilation errors. No code generated. glLinkProgram "" FAILED Program "" infolog: Fragment shader(s) were not successfully compiled before glLinkProgram() was called. Link failed. Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(, ''' But works fine if i have the following instead... ref_ptr nodess3 (myshapegeode3->getOrCreateStateSet()); Which is doing a copy , right? Sajjad On Wed, Oct 15, 2008 at 11:55 PM, Joakim Simonsson <[EMAIL PROTECTED]>wrote: > On Wed, 15 Oct 2008 23:48:40 +0200, ami guru <[EMAIL PROTECTED]> > wrote: > > > //create a new stateset >> //with the default setting >> capsuleState->setAttribute(capsuleProgramObject.get()); >> >> > Every thing look correct, but I am not sure about this line. Try this one > instead: > > capsuleState->setAttributeAndModes(shaderNightDriving.get()); > > > -- > Joakim Simonsson > ___ > 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] StateSet - newbie
Thanks Joakim, I believe that sharing the stateset will be required here I am trying to attach a simple shader but sharing the stateset is not giving me the result that i am supposed to have ** ref_ptr capsuleGeode = new Geode; ref_ptr capsuleShape = new Capsule(Vec3f(3,0,0),1,2); ref_ptr capsuleDrawable = new ShapeDrawable(capsuleShape.get()); capsuleGeode->addDrawable(capsuleDrawable.get()); ref_ptr capsuleState = capsuleGeode->getOrCreateStateSet(); //create the shader parameters ref_ptr capsuleProgramObject = new Program; ref_ptr capsuleVertexObject = new Shader(*(Shader::readShaderFile(Shader::VERTEX,"shaderSRC/gooch.vert"))); ref_ptr capsuleFragmentObject = new Shader(*(Shader::readShaderFile(Shader::FRAGMENT,"shaderSRC/gooch.vert"))); capsuleProgramObject->addShader(capsuleVertexObject.get()); capsuleProgramObject->addShader(capsuleFragmentObject.get()); //create a new stateset //with the default setting capsuleState->setAttribute(capsuleProgramObject.get()); //Passing the uniform variable representing the texture to the shader capsuleState->addUniform(new osg::Uniform("LightPosition",osg::Vec3(0,0,10))); capsuleState->addUniform(new osg::Uniform("SurfaceColor",osg::Vec3(0.75,0.75,0.75))); capsuleState->addUniform(new osg::Uniform("WarmColor",osg::Vec3(1,0,0))); capsuleState->addUniform(new osg::Uniform("CoolColor",osg::Vec3(0,0,0.6))); capsuleState->addUniform(new osg::Uniform("DiffuseWarm",0.45f)); capsuleState->addUniform(new osg::Uniform("DiffuseCool", 0.45f)); root->addChild(capsuleGeode.get()); Any hint? Sajjad On Wed, Oct 15, 2008 at 10:56 PM, Joakim Simonsson <[EMAIL PROTECTED]>wrote: > On Wed, 15 Oct 2008 22:43:14 +0200, ami guru <[EMAIL PROTECTED]> > wrote: > > Hello forum >> >> Is there any difference between these following: >> >> 1. osg::ref_ptr nodess3 = new >> StateSet((myshapegeode3->getOrCreateStateSet())); >> 2. osg::ref_ptr >> nodess3((myshapegeode3->getOrCreateStateSet())); >> > > Yes they differ. But do you want to do? Copy the stateset? > > If you want to share the stateset (for example, edit myshapegeode3's > stateset) do this: > > osg::ref_ptr nodess3 = myshapegeode3->getOrCreateStateSet(); > > If you want to copy it, do this: > > osg::ref_ptr nodess3 = > > myshapegeode3->getOrCreateStateSet()->clone(osg::CopyOp::DEEP_COPY_ALL)); > > > -- > Joakim Simonsson > ___ > 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] StateSet - newbie
Hello forum Is there any difference between these following: 1. osg::ref_ptr nodess3 = new StateSet((myshapegeode3->getOrCreateStateSet())); 2. osg::ref_ptr nodess3((myshapegeode3->getOrCreateStateSet())); The the second one works fine and the first one gives error: Game.cpp: In member function 'virtual osg::ref_ptr Game::createSceneGraph()': Game.cpp:89: error: no matching function for call to 'osg::StateSet::StateSet(osg::StateSet*)' /usr/local/include/osg/StateSet:54: note: candidates are: osg::StateSet::StateSet(const osg::StateSet&, const osg::CopyOp&) /usr/local/include/osg/StateSet:53: note: osg::StateSet::StateSet() make: *** [Game.o] Error 1 * In both cases it is taking a pointer to a State to instantiate a new StateSet Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OpenSceneGraph - down the skin
OpenSceneGraph has put quite a lot of abstraction over the rendering pipeline that have made the development process faster and efficient. But sometimes it is nice to realize and understand the tips and tricks behind it and there is no other way than go down to the source code and studying them. I am attaching a pdf file that gives a brief overview of the scene graph concept and i would like to know which files in the source implement these( opengl commands specified in the attached file) down the hood. Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Reference frame
Hello Hans, The queries are the result of the going through the link that you have sent. Regards Sajjad On Wed, Sep 10, 2008 at 9:24 AM, Elbers, H.P. <[EMAIL PROTECTED]>wrote: > Hello Sajjad, > > You can find details on this, and much more good information in > "OpenSceneGraph Quick Start Guide", chapter : 2.3.3 > > Go to > *http://www.skew-matrix.com/OSGQSG/index.html*<http://www.skew-matrix.com/OSGQSG/index.html>, > follow the 'lulu.com' link. The guide can be downloaded for free. Paul > Martz: thank you *VERY* much for this beautiful guide! > > Good luck, > > Hans. > > ------ > *From:* [EMAIL PROTECTED] [mailto: > [EMAIL PROTECTED] *On Behalf Of *ami guru > *Sent:* woensdag 10 september 2008 4:59 > *To:* OpenSceneGraph Users > *Subject:* [osg-users] Reference frame > > Hello Forum, > > > OSG Transform allows to specify its reference frame and by default the > reference frame is relative. and the other one is the absolute. > And the two are specified by different code identifier. > > We can view transformation in 2 ways. > > 1. relative to the fixed coordinate system. > 2. Local movable coordinate system. > > There is no practical difference and just a matter of viewpoint. > > What is the purpose of OSG to specify them separately as follows: > > osg::Transform::RELATIVE_RF. > > Any example would be of great help!!! > > > > Regards > Sajjad > > > ___ > 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] Reference frame
Hello Forum, OSG Transform allows to specify its reference frame and by default the reference frame is relative. and the other one is the absolute. And the two are specified by different code identifier. We can view transformation in 2 ways. 1. relative to the fixed coordinate system. 2. Local movable coordinate system. There is no practical difference and just a matter of viewpoint. What is the purpose of OSG to specify them separately as follows: osg::Transform::RELATIVE_RF. Any example would be of great help!!! Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Utility functions
Hello forum, Are there any utility functions for drawing spheres, planes , boxes ,cubes etc. within OSG's framework? Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] matrix concept - newbie
Hi I am going the the quick starter guide and also the Math Link in the website where Robert and Don explained some issues related to matrix. At some point it is specified that "the pre-multiplication style matrix operation are the opposite of what we usually find in OpenGL documentation". I would like find out how it is happening. As it says that OpenGL notation produces the same result because opengl's post-multiplication notation with column-major matrices is equivalent to osg's pre-multiplication style operators row-major matrices. I would like to understand how and where is that equivalent. It will be nice if you kindly locate me to them. Regards Sajjad On Mon, Aug 25, 2008 at 5:56 PM, Gerrick Bivins <[EMAIL PROTECTED] > wrote: > Sounds like he is referring to how OpenGL stores the matrices, as a 1d > array > of 16 elements, while OSG stores them as a 2d array of 4x4. > biv > > > On 8/25/08 10:43 AM, "Robert Osfield" <[EMAIL PROTECTED]> wrote: > > > Hi Sajjad, > > > > The OSG only has 4x4 Matrix classes, OpenGL itself also just has 4x4 > > matrices, save for some specific uniforms that have 4x3 matrices. > > There are no 2D or 1D matrices in either the OSG or OpenGL. > > > > Could you please explain what you are trying to achieve, then perhaps > > others will be able to point you in the right direction. > > > > Robert. > > > > On Mon, Aug 25, 2008 at 4:20 PM, ami guru <[EMAIL PROTECTED]> wrote: > >> Hello forum, > >> > >> Quite new to this rendering system. > >> > >> I would like to know which file does contain the mapping of the OSG > >> matrix(2D) to the OpenGL matrix(1D) in the Source? > >> > >> > >> Regards > >> Sajjad > >> > >> ___ > >> 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
[osg-users] matrix concept - newbie
Hello forum, Quite new to this rendering system. I would like to know which file does contain the mapping of the OSG matrix(2D) to the OpenGL matrix(1D) in the Source? Regards Sajjad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org