Re: [osg-users] unable to create opengl rendering context
Hi Shuxing, Problems with getting a graphics context will need investigating further. I only have Linux boxes here to test against so can't directly help. FYI, Under the linux exactly the same high level code path is used, and the underlying mechanisms in osgViewer for getting the graphics context are the same - its only the windowing specific implementation that differers. As a test could you try running on another OS, such as Linux to see how you get on. Robert. On Jan 2, 2008 2:36 AM, Shuxing Xiao [EMAIL PROTECTED] wrote: Hi, all: First of all, Happy New Year and Good Luck in 2008. Then there's my problem: I was immigrating from osg 2.0 to osg 2.3 with the new QOSGWidget which is derived directly from Qwidget but QGLWidget, and my programming environment is Windows 2003 server, visual studio 2005, during the initialization of the programming, it crashed. Windows Error #2000: [Screen #0] GraphicsWindowWin32::setWindow() - Unable to create OpenGL rendering context. Reason: The pixel format is invalid. I tracked down, and I found that the creation of graphics context failed, and the stack is like following: if (s_WindowingSystemInterface.valid()) return s_WindowingSystemInterface-createGraphicsContext(traits); in osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); and I checked that my s_WindowingSystemInterface is surely Win32WindowingSystem , but the GraphicsWindowWin32::setWindow( HWND handle ) and the osg::GraphicsContext* createGraphicsContext( osg::GraphicsContext::Traits* traits ) is never called(the breakpoints didn't caught them). I don't know why this happens, hope someone can give me some hint. I want gain some performance by immigrating to the new QOSGWidget, but this problem stuck me for really a long time. Shuxing Xiao 2008-1-1 ___ 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] (no subject)
Hello all, I am trying to load Images in my application and it compiles ok but when linking it appears the following errors: Creating library ../bin/ExerciseImpl.lib and object ../bin/ExerciseImpl.exp 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual void __thiscall osg::Texture::compileGLObjects(class osg::State )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) protected: virtual void __thiscall osg::Texture2D::computeInternalFormat(void)const ([EMAIL PROTECTED]@osg@@MBEXXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) protected: virtual void __thiscall osg::Texture2D::allocateMipmap(class osg::State )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual int __thiscall osg::Texture2D::getTextureDepth(void)const ([EMAIL PROTECTED]@osg@@UBEHXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual int __thiscall osg::Texture2D::getTextureHeight(void)const ([EMAIL PROTECTED]@osg@@UBEHXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual void __thiscall osg::Object::computeDataVariance(void) ([EMAIL PROTECTED]@osg@@UAEXXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual int __thiscall osg::Texture2D::getTextureWidth(void)const ([EMAIL PROTECTED]@osg@@UBEHXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual unsigned int __thiscall osg::Texture2D::getNumImages(void)const ([EMAIL PROTECTED]@osg@@UBEIXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Image const * __thiscall osg::Texture2D::getImage(unsigned int)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Image * __thiscall osg::Texture2D::getImage(unsigned int) ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual void __thiscall osg::Texture2D::setImage(unsigned int,class osg::Image *) ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual unsigned int __thiscall osg::Texture2D::getTextureTarget(void)const ([EMAIL PROTECTED]@osg@@UBEIXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual enum osg::StateAttribute::Type __thiscall osg::Texture2D::getType(void)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual char const * __thiscall osg::Texture2D::className(void)const ([EMAIL PROTECTED]@osg@@UBEPBDXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual char const * __thiscall osg::Texture2D::libraryName(void)const ([EMAIL PROTECTED]@osg@@UBEPBDXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual bool __thiscall osg::Texture2D::isSameKindAs(class osg::Object const *)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Object * __thiscall osg::Texture2D::clone(class osg::CopyOp const )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) class osg::Image * __cdecl osgDB::readImageFile(class std::basic_stringchar,struct std::char_traitschar,class std::allocatorchar const ,class osgDB::ReaderWriter::Options const *) ([EMAIL PROTECTED]@@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]@1@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Object * __thiscall osg::Texture2D::cloneType(void)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@XZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual bool __thiscall osg::StateAttribute::checkValidityOfAssociatedModes(class osg::State )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: class osgDB::ReaderWriter::Options * __thiscall osgDB::Registry::getOptions(void) ([EMAIL PROTECTED]@osgDB@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual bool __thiscall osg::Texture::getModeUsage(struct osg::StateAttribute::ModeUsage )const
[osg-users] CPU friendly trackball manipulator
Hello, I have a static scene that my program visualizes using a trackball manipulator. I would like to update the rendering only when the camera moves, that is the user moves it with the mouse or the camera is spinning around. I am using a Qt wrapper so I know how to stop the refresh by simply stopping the QTimer in there, and I also know how to update upon user interaction since Qt gives very nice messages, what I don't know is: how can I know if the trackball manipulator is making my camera spinning around or not? Maybe osgGA::TrackballManipulator::getRotation() encodes in some way the rotation velocity? or it's just the current rotation of the camera? Thanks, Michele ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texturing a Terrain On A Sphere..!
Hi Robert; I have tif formatted images some part of the world! And at the beginning, I build them with VPB and so I created a sample terrain(XXX.osga) with VirtulaTerrainBuillder. And now I only want to know how can I texture this part of world terrain to the Sphere surface which position is orijinal for this part of terrain's coordinate. For example; I produce a terrain where belong Arizona! And I texture this part of terrain on its real coordinate like on the earth! Actually not texture this to all sphere surface! Is there any sample about this topic? Not : Sorry for my poor English writing:) Thanks Robert; Ümit UZUN Date: Mon, 31 Dec 2007 17:39:03 + From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! Hi ümit, You really need to be more specific about what you are trying to do, and what type of data you are trying to use. Are you trying to do the database building yourself? Using VirtualPlanetBuilder?? Robert. On Dec 28, 2007 7:44 PM, ümit uzun [EMAIL PROTECTED] wrote: Hi mew; Sorry for giving wrong link! the real link is http://www.palomino3d.org/pal/openscenegraph/ and I make a terrain Converting GIS Satellite Images for OSG with VTP (Virtual Terrain Project) using osgdem command! I have a *.osga formatted terrain! I look at the osgtoy but it can not help me texturing the terrain on sphere! Ümit UZUN Date: Fri, 28 Dec 2007 11:10:26 -0600 From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! -Original Message- From: [EMAIL PROTECTED] [mailto:osg-users- [EMAIL PROTECTED] On Behalf Of ümit uzun Sent: Friday, December 28, 2007 8:09 AM To: OSG OSG Subject: [osg-users] Texturing a Terrain On A Sphere..! Hi All; I have a terrain which has a Cordinate System like in http://www.palomino3d.org/opnescenegraph And I want to texture map this terrain on the sphere (like earth) ! How can I do this work on my earth figure! Could anybody show me how to this please..! Or rotate me to right example like this! That link doesn't work, so unclear of your goal, but here's one way to put a texture a sphere http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/src/osgPlugins/globe/ -- mew ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _ Yeni nesil Windows Live Servisleri'ne şimdi ulaşın! http://get.live.com ___ 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 _ Yeni nesil Windows Live Servisleri’ne şimdi ulaşın! http://get.live.com___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] PSSM fix, suggestion and questions
Hi Adrian, In a follow-up to my PSSM experience, I have adapted the osgshadow.cpp example so that the effect can be seen with simple shapes as well. I suspect that it is a math issue since the light direction and view direction are +/- orthogonal. But I don't know how to fix this (yet). Also, I think it's not the shadow texture generation itself since texture boundaries are not shown. Please find my patches to the ParallelSplitShadowMap files and the stripped osgshadow example (there is no need for command line options or so, and I hardcoded it for nvidia) attached to this e-mail. Hopefully you know the solution to this issue. btw this issue is present in 2.2.0 and svn. bye Raymond Raymond de Vries wrote: Hi, I am using PSSM and are trying to find proper values. I am using osg 2.2.0 on Windows XP (the PSSM svn version does not show any relevant changes), on an nvidia card. First of all, I have fixed a small issue which prevented the use of dirty(), see the attached ParallelSplitShadowMap.cpp.diff. Furthermore, I would to suggest some small changes so that flags can be toggled, instead of only be set. See ParallelSplitShadowMap.diff Also, I see an error. I am not sure what is causing this so I would like to ask your advice. It seems to me that the split frustums are not always calculated properly. As you can see in the attached images it seems to me that the split frustums are not always adjacent to eachother, when the view is rotated in a certain way. Some values about the size of the world: calculateFrustumCorners() zShadow0 0.161428 calculateLightNearFarFormFrustum(), zShadow0 near 2 far 47.147 calculateFrustumCorners() zShadow1 0.510139 calculateLightNearFarFormFrustum(), zShadow1 near 2 far 91.0805 calculateFrustumCorners() zShadow2 1 calculateLightNearFarFormFrustum(), zShadow2 near 2.1 far 152.797 I am new to PSSM so I am might still miss some things... Thanks a lot already! Raymond btw changing the number of splits changes things but does not solve them btw both linear and non linear mode expose this behaviour ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org PSSM_bug_report-20080101.rar Description: Binary data inline: PSSM_error.jpg___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Selective lighting in OSG
Selective lighting in OSG Hello everyone, what is the best way to define a light that affects not the entire scenegraph, but only a part of it? For example I have a scene with many objects. Each one of them is lit by one light that is different from one object to another. So the number of lights can be greater than GL_MAX_LIGHTS, but since each object is lit only by one light, using opengl we could render the entire scene using only one hardware light (lets say GL_LIGHT0), by resetting its parameters per object. In the general case we can have more than one light per object and the lights can be turned on and off per frame. So, what is the best way to do this in OSG? I've tried passing the stateset of the sub-tree I want to light on a lighsource node using: lightsource-setStateSetModes(stateset,osg::StateAttribute::ON); but it doesn't work as expected. Also I've tried changing the stateset of the sub-tree I want to light directly, without using any lighsource nodes: stateset-setAttributeAndModes(light, osg::StateAttribute::ON); stateset-setMode( GL_LIGHT0 + num, osg::StateAttribute::ON ); to enable a light and stateset-setAttributeAndModes(light, osg::StateAttribute::OFF); to remove it. The last method seems to work when the number of lights is constant per frame, but it brakes when I try to dynamically turn on and off lights per frame. (perhaps because I have to manually enable/disable the corresponding opengl lights?) So, what is the best way to do this in OSG? Thanks in advance Pavlos Mavridis ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] (no subject)
Hi Pedro, Have you added the core osg libraries to you link line? Are the osg libraries built OK and on your paths? Robert. On Jan 2, 2008 2:06 PM, Pedro José Muñoz Martínez [EMAIL PROTECTED] wrote: Hello all, I am trying to load Images in my application and it compiles ok but when linking it appears the following errors: Creating library ../bin/ExerciseImpl.lib and object ../bin/ExerciseImpl.exp 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual void __thiscall osg::Texture::compileGLObjects(class osg::State )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) protected: virtual void __thiscall osg::Texture2D::computeInternalFormat(void)const ([EMAIL PROTECTED]@osg@@MBEXXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) protected: virtual void __thiscall osg::Texture2D::allocateMipmap(class osg::State )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual int __thiscall osg::Texture2D::getTextureDepth(void)const ([EMAIL PROTECTED]@osg@@UBEHXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual int __thiscall osg::Texture2D::getTextureHeight(void)const ([EMAIL PROTECTED]@osg@@UBEHXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual void __thiscall osg::Object::computeDataVariance(void) ([EMAIL PROTECTED]@osg@@UAEXXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual int __thiscall osg::Texture2D::getTextureWidth(void)const ([EMAIL PROTECTED]@osg@@UBEHXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual unsigned int __thiscall osg::Texture2D::getNumImages(void)const ([EMAIL PROTECTED]@osg@@UBEIXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Image const * __thiscall osg::Texture2D::getImage(unsigned int)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Image * __thiscall osg::Texture2D::getImage(unsigned int) ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual void __thiscall osg::Texture2D::setImage(unsigned int,class osg::Image *) ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual unsigned int __thiscall osg::Texture2D::getTextureTarget(void)const ([EMAIL PROTECTED]@osg@@UBEIXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual enum osg::StateAttribute::Type __thiscall osg::Texture2D::getType(void)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual char const * __thiscall osg::Texture2D::className(void)const ([EMAIL PROTECTED]@osg@@UBEPBDXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual char const * __thiscall osg::Texture2D::libraryName(void)const ([EMAIL PROTECTED]@osg@@UBEPBDXZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual bool __thiscall osg::Texture2D::isSameKindAs(class osg::Object const *)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Object * __thiscall osg::Texture2D::clone(class osg::CopyOp const )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) class osg::Image * __cdecl osgDB::readImageFile(class std::basic_stringchar,struct std::char_traitschar,class std::allocatorchar const ,class osgDB::ReaderWriter::Options const *) ([EMAIL PROTECTED]@@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@[EMAIL PROTECTED]@@[EMAIL PROTECTED]@2@@std@@[EMAIL PROTECTED]@1@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual class osg::Object * __thiscall osg::Texture2D::cloneType(void)const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@XZ) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: virtual bool __thiscall osg::StateAttribute::checkValidityOfAssociatedModes(class osg::State )const ([EMAIL PROTECTED]@osg@@[EMAIL PROTECTED]@@Z) 1prueba.obj : error LNK2001: unresolved external symbol __declspec(dllimport) public: class osgDB::ReaderWriter::Options * __thiscall osgDB::Registry::getOptions(void)
Re: [osg-users] CPU friendly trackball manipulator
Hi Michele, Whether you need to redraw the scene that is static can be reduced to just checking the view and projection matrices of the master camera/slave cameras that the view has active. The easiest way would be break frame into its constituent parts and then just call Viewer::renderingTraversals() when required. I wouldn't recommend just fixating on the TrackballManipulator as this is something you can easily want to change later on, checking the view and projection matrices is the generic way to do things. Robert. On Jan 2, 2008 2:58 PM, Michele Bosi [EMAIL PROTECTED] wrote: Hello, I have a static scene that my program visualizes using a trackball manipulator. I would like to update the rendering only when the camera moves, that is the user moves it with the mouse or the camera is spinning around. I am using a Qt wrapper so I know how to stop the refresh by simply stopping the QTimer in there, and I also know how to update upon user interaction since Qt gives very nice messages, what I don't know is: how can I know if the trackball manipulator is making my camera spinning around or not? Maybe osgGA::TrackballManipulator::getRotation() encodes in some way the rotation velocity? or it's just the current rotation of the camera? Thanks, Michele ___ 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] Selective lighting in OSG
Hi Pavlos, I'm afraid handling more than max number of OpenGL lights is awkward in the OSG, it is possible but you'll need to learn quite a bit about the internals of how the rendering back end is setup and traversed. This topic has been discussed in the past on osg-users so have a bash at going through the email archives. Robert. On Jan 2, 2008 4:13 PM, Pavlos Mavridis [EMAIL PROTECTED] wrote: Selective lighting in OSG Hello everyone, what is the best way to define a light that affects not the entire scenegraph, but only a part of it? For example I have a scene with many objects. Each one of them is lit by one light that is different from one object to another. So the number of lights can be greater than GL_MAX_LIGHTS, but since each object is lit only by one light, using opengl we could render the entire scene using only one hardware light (lets say GL_LIGHT0), by resetting its parameters per object. In the general case we can have more than one light per object and the lights can be turned on and off per frame. So, what is the best way to do this in OSG? I've tried passing the stateset of the sub-tree I want to light on a lighsource node using: lightsource-setStateSetModes(stateset,osg::StateAttribute::ON); but it doesn't work as expected. Also I've tried changing the stateset of the sub-tree I want to light directly, without using any lighsource nodes: stateset-setAttributeAndModes(light, osg::StateAttribute::ON); stateset-setMode( GL_LIGHT0 + num, osg::StateAttribute::ON ); to enable a light and stateset-setAttributeAndModes(light, osg::StateAttribute::OFF); to remove it. The last method seems to work when the number of lights is constant per frame, but it brakes when I try to dynamically turn on and off lights per frame. (perhaps because I have to manually enable/disable the corresponding opengl lights?) So, what is the best way to do this in OSG? Thanks in advance Pavlos Mavridis ___ 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] Texturing a Terrain On A Sphere..!
Hi Robert; I have done my terrain your way which in your introductions. Now I have so cute terrain :) And I open this *.osga VPB terrain in my application with this code; osg::ref_ptr node = osgDB::readNodeFile(XXX.osga); and then I create a Globe with; osg::Group* root = new osg::Group(); osg::Shape* sphere = new osg::Sphere(osg::Vec3f(0.0, 0.0, 0.0),1.0); osg::ShapeDrawable* sphereGeometry = new osg::ShapeDrawable(sphere); osg::Geode* sphereGeode = new osg::Geode(); sphereGeode-addDrawable(sphereGeometry); root-addChild(sphereGeode); Everything is gonna well..! Know I texture the terrain on sphere! İf I texture the image I will use this codes; osg::Texture2D* Texture = new osg::Texture2D; // protect from being optimized away as static state: Texture-setDataVariance(osg::Object::DYNAMIC); // load an image by reading a file: osg::Image* image = osgDB::readImageFile(XXX_Images); if (!image) { cout couldn't find texture, quitting. endl; return -1; } // Assign the texture to the image we read from file: Texture-setImage(image); // Create a new StateSet with default settings: osg::StateSet* stateOne = new osg::StateSet(); // Assign texture unit 0 of our new StateSet to the texture //we just created and enable the texture. stateOne-setTextureAttributeAndModes (0,Texture,osg::StateAttribute::ON); // Associate this state set with the Geode that contains //the pyramid: sphereGeode-setStateSet(stateOne); But in upper code I must to texture this terrain(*.osga)! How can I do that texturing? What is terrain texturing class in OSG(like osg::Image)? Thanks very much..! Ümit UZUN Date: Wed, 2 Jan 2008 16:38:25 + From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! HI Umit, VPB supports placement of DEM's and Imagery in the correct location on the earth, all you need to do is supply your source data with the appropriate coordinates systems specified, the easiest way to do this is use to use GeoTiffs. Then its simply a case of : osgdem -t mysourceimage.tif --geocentric -o earth.ive -a earth.osga Then you just load the data into your viewer and your done - all the textures will appear in the correct position on the globe. Robert. On Jan 2, 2008 3:29 PM, ümit uzun wrote: Hi Robert; I have tif formatted images some part of the world! And at the beginning, I build them with VPB and so I created a sample terrain(XXX.osga) with VirtulaTerrainBuillder. And now I only want to know how can I texture this part of world terrain to the Sphere surface which position is orijinal for this part of terrain's coordinate. For example; I produce a terrain where belong Arizona! And I texture this part of terrain on its real coordinate like on the earth! Actually not texture this to all sphere surface! Is there any sample about this topic? Not : Sorry for my poor English writing:) Thanks Robert; Ümit UZUN Date: Mon, 31 Dec 2007 17:39:03 + From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! Hi ümit, You really need to be more specific about what you are trying to do, gt; and what type of data you are trying to use. Are you trying to do the database building yourself? Using VirtualPlanetBuilder?? Robert. On Dec 28, 2007 7:44 PM, ümit uzun wrote: Hi mew; Sorry for giving wrong link! the real link is http://www.palomino3d.org/pal/openscenegraph/ and I make a terrain Converting GIS Satellite Images for OSG with VTP (Virtual Terrain Project) using osgdem command! I have a *.osga formatted terrain! I look at the osgtoy but it can not help me texturing the terrain on sphere! Ümit UZUN Date: Fri, 28 Dec 2007 11:10:26 -0600 From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! ; -Original Message- From: [EMAIL PROTECTED] [mailto:osg-users- [EMAIL PROTECTED] On Behalf Of ümit uzun Sent: Friday, December 28, 2007 8:09 AM To: OSG OSG Subject: [osg-users] Texturing a Terrain On A Sphere..! Hi All; I have a terrain which has a Cordinate System like in http://www.palomino3d.org/opnescenegraph And I want to texture map this terrain on the sphere (like earth) ! How can I do this work on my earth figure! Could anybody show me how to this please..! Or rotate me to right example like this! That link doesn't work, s o unclear of your goal, but here's one way to put a texture a sphere http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgtoy/trunk/src/osgPlugins/globe/ -- mew ___ osg-users mailing list osg-users@lists.openscenegraph.org
Re: [osg-users] Texturing a Terrain On A Sphere..!
Hi Umit, I'm afraid I don't follow what you are after/what problem you have perhaps others users know what you are after. Robert. On Jan 2, 2008 6:34 PM, ümit uzun [EMAIL PROTECTED] wrote: Hi Robert; I have done my terrain your way which in your introductions. Now I have so cute terrain :) And I open this *.osga VPB terrain in my application with this code; osg::ref_ptr node = osgDB::readNodeFile(XXX.osga); and then I create a Globe with; osg::Group* root = new osg::Group(); osg::Shape* sphere = new osg::Sphere(osg::Vec3f(0.0, 0.0, 0.0),1.0); osg::ShapeDrawable* sphereGeometry = new osg::ShapeDrawable(sphere); osg::Geode* sphereGeode = new osg::Geode(); sphereGeode-addDrawable(sphereGeometry); root-addChild(sphereGeode); Everything is gonna well..! Know I texture the terrain on sphere! İf I texture the image I will use this codes; osg::Texture2D* Texture = new osg::Texture2D; // protect from being optimized away as static state: Texture-setDataVariance(osg::Object::DYNAMIC); // load an image by reading a file: osg::Image* image = osgDB::readImageFile(XXX_Images); if (!image) { cout couldn't find texture, quitting. endl; return -1; } // Assign the texture to the image we read from file: Texture-setImage(image); // Create a new StateSet with default settings: osg::StateSet* stateOne = new osg::StateSet(); // Assign texture unit 0 of our new StateSet to the texture //we just created and enable the texture. stateOne-setTextureAttributeAndModes (0,Texture,osg::StateAttribute::ON); // Associate this state set with the Geode that contains //the pyramid: sphereGeode-setStateSet(stateOne); But in upper code I must to texture this terrain(*.osga)! How can I do that texturing? What is terrain texturing class in OSG(like osg::Image)? Thanks very much..! Ümit UZUN Date: Wed, 2 Jan 2008 16:38:25 + From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! HI Umit, VPB supports placement of DEM's and Imagery in the correct location on the earth, all you need to do is supply your source data with the appropriate coordinates systems specified, the easiest way to do this is use to use GeoTiffs. Then its simply a case of : osgdem -t mysourceimage.tif --geocentric -o earth.ive -a earth.osga Then you just load the data into your viewer and your done - all the textures will appear in the correct position on the globe. Robert. On Jan 2, 2008 3:29 PM, ümit uzun wrote: Hi Robert; I have tif formatted images some part of the world! And at the beginning, I build them with VPB and so I created a sample terrain(XXX.osga) with VirtulaTerrainBuillder. And now I only want to know how can I texture this part of world terrain to the Sphere surface which position is orijinal for this part of terrain's coordinate. For example; I produce a terrain where belong Arizona! And I texture this part of terrain on its real coordinate like on the earth! Actually not texture this to all sphere surface! Is there any sample about this topic? Not : Sorry for my poor English writing:) Thanks Robert; Ümit UZUN Date: Mon, 31 Dec 2007 17:39:03 + From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! Hi ümit, You really need to be more specific about what you are trying to do, gt; and what type of data you are trying to use. Are you trying to do the database building yourself? Using VirtualPlanetBuilder?? Robert. On Dec 28, 2007 7:44 PM, ümit uzun wrote: Hi mew; Sorry for giving wrong link! the real link is http://www.palomino3d.org/pal/openscenegraph/ and I make a terrain Converting GIS Satellite Images for OSG with VTP (Virtual Terrain Project) using osgdem command! I have a *.osga formatted terrain! I look at the osgtoy but it can not help me texturing the terrain on sphere! Ümit UZUN Date: Fri, 28 Dec 2007 11:10:26 -0600 From: [EMAIL PROTECTED] To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texturing a Terrain On A Sphere..! ; -Original Message- From: [EMAIL PROTECTED] [mailto:osg-users- [EMAIL PROTECTED] On Behalf Of ümit uzun Sent: Friday, December 28, 2007 8:09 AM To: OSG OSG Subject: [osg-users] Texturing a Terrain On A Sphere..! Hi All; I have a terrain which has a Cordinate System like in http://www.palomino3d.org/opnescenegraph And I want to texture map this terrain on the sphere (like earth) ! How can I do this work on my earth figure! Could anybody show me how to this please..! Or rotate me to right example like this! That link
Re: [osg-users] Selective lighting in OSG
As Robert said, using the fixed function pipe involves knowledge of the backend. I believe multiple RenderStages would allow multiple PositionalState, which means you could support more than the fixed function limit for lights. This gets complex. It'd probably be easier to use shaders to do what you want, as they aren't limited by the number of fixed function lights. Paul Martz Skew Matrix Software On Jan 2, 2008, at 5:06 PM, Terry Welsh [EMAIL PROTECTED] wrote: Hi Pavlos, I'm interested in this topic too. I haven't found the discussions in the archives, but I probably just haven't picked the right search keywords. My problem is very similar to yours I think. I want to have a lot of lights in my scene that falloff completely after a reasonable distance and only apply 3 of them to each piece of geometry, probably choosing them based on proximity and/or brightness. I was thinking of only activating lights 0, 1, and 2 and applying a cull callback to all my geodes that would set different light positions and colors for each geode that doesn't get culled. The positions and colors would be chosen from a much larger pool of lights that I store in my own data structures outside of OpenGL and OSG. I haven't figured out if I would do this by setting parameters for OpenGL lights 0, 1, and 2, or by setting custom shader Uniforms. Or there might be a much better approach I haven't thought of. Anyway, I'd like to discuss this more or hear from anyone who has done this - Terry Message: 3 Date: Wed, 2 Jan 2008 16:42:37 + From: Robert Osfield [EMAIL PROTECTED] Subject: Re: [osg-users] Selective lighting in OSG To: OpenSceneGraph Users osg-users@lists.openscenegraph.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 Hi Pavlos, I'm afraid handling more than max number of OpenGL lights is awkward in the OSG, it is possible but you'll need to learn quite a bit about the internals of how the rendering back end is setup and traversed. This topic has been discussed in the past on osg-users so have a bash at going through the email archives. Robert. On Jan 2, 2008 4:13 PM, Pavlos Mavridis [EMAIL PROTECTED] wrote: Selective lighting in OSG Hello everyone, what is the best way to define a light that affects not the entire scenegraph, but only a part of it? For example I have a scene with many objects. Each one of them is lit by one light that is different from one object to another. So the number of lights can be greater than GL_MAX_LIGHTS, but since each object is lit only by one light, using opengl we could render the entire scene using only one hardware light (lets say GL_LIGHT0), by resetting its parameters per object. In the general case we can have more than one light per object and the lights can be turned on and off per frame. So, what is the best way to do this in OSG? I've tried passing the stateset of the sub-tree I want to light on a lighsource node using: lightsource-setStateSetModes(stateset,osg::StateAttribute::ON); but it doesn't work as expected. Also I've tried changing the stateset of the sub-tree I want to light directly, without using any lighsource nodes: stateset-setAttributeAndModes(light, osg::StateAttribute::ON); stateset-setMode( GL_LIGHT0 + num, osg::StateAttribute::ON ); to enable a light and stateset-setAttributeAndModes(light, osg::StateAttribute::OFF); to remove it. The last method seems to work when the number of lights is constant per frame, but it brakes when I try to dynamically turn on and off lights per frame. (perhaps because I have to manually enable/disable the corresponding opengl lights?) So, what is the best way to do this in OSG? Thanks in advance Pavlos Mavridis ___ 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] Advice on Intersection Features
Hello, I've been using OSG for a number of years now and have read this list many times, but this is my first posting, so if I make a fool of myself, forgive me. I'm trying to decide the best way to implement camera bumping/sliding in an OSG project for a client. Basically, they will be adding simple, one sided collision primitives to a scene to an existing scene. The primitives are currently limited to planes, spheres, boxes, and cylinders, but at some point in the future, I expect that more complex scenes will necessitate arbitrary collision meshes, so I don't want to completely discount that option. I've put together some simple code that uses a line segment and the IntersectVisitor class, however, based on their needs, I'd like to be able to offer them better collision support than that. I'd like the camera to behave as a sphere or cylinder (cylinder is preferable) when doing collision checks. Also, in order to do camera sliding, I would need the normal vector at the point of intersection. Here's the options I've seen: 1) DriveManipulator.cpp style line checks. -What I'm using now. 2) PolytopeIntersector -How does this option compare performance wise to option #1? -Can't really do actual camera as sphere or cylinder collision, correct? But could simplify it to box collision. 3) Custom Intersector -Is it wise to consider a custom intersector for this? Or would covering all the corner cases (collision against eye relative billboards) be a huge challenge? I'd just like some advice from others who may have done this already before I decide. I've seen discussions of this in the past on this mailing list, but I didn't find any discussion of this scenario specifically since the addition of the new Intersector classes about a year ago. Thanks, Z.S. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Error: 'Debug Assertion Failure!'
Hi, everyone. When testing my application, an error message appeared saying: 'Debug Assertion Failure' and 'vector subscription out of range'. This error occured when: 1) I wrote the following code: case(osgGA::GUIEventAdapter::KEYDOWN): { if(!ponto.empty()) // ponto is defined as: std::vectorPonto* ponto; in which Ponto is a class created by me. { for(ponto_itr = ponto.begin(); ponto_itr != ponto.end(); ponto_itr++) { if((*ponto_itr)-verifySelection()) // verifies if the shape associated with an instance of the class Ponto was picked { switch(ea.getKey()) { case(ea.KEY_Delete): { osg::Group* root = (*ponto_itr)-getParent(0); root-removeChild(root-getChildIndex((*ponto_itr)), 1); } } } } } 2) AND when I do the following: 1 - select one point; 2 - delete it; 3 - press delete again, having or NOT selected another 'ponto' (instance of class Ponto) on the screen. NOTE: when a drawable from 'ponto' is selected (picked), the 'ponto' is allocated in the vector. Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org