Re: [osg-users] [osgPlugins] Michael Platings
Mourad Boufarguine writes: Hi Josue, Just a quick note. When using osg::ref_ptr, you should test for escena.valid() to know whether the file was loaded or not. if (!escena.valid()){ coutNo estoy leyendoendl; exit(0);} I think (!escena) is fine: bool operator!() const { return _ptr==0; } -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Missing textures with osgexport
Thanks for the examples. Now the textures are working fine, but I still can't solve the problem with the double-sided plane (I get the same result with your sample file as well), and the box with the flipped normals. It must be supported by OSG, since one of the exaples (osglight) uses a box as a test room, and the outer sides of the box are not visible, just like the way it supposed to look. But in that example, the room is not an external model, but generated, so I can't examine the model file. Of course it is supported by OSG, another matter is if the exporter takes that into account. For the double-sided thing, I think you could get that just by adding a FRONT, BACK or FRONT_AND_BACK into the material definition components in the .osg file. However, even if you want a geometry that can be seen from the inside and the outside, I recommend you to use thick objects, that is, to use a thin cube for a wall instead of a plane, for example. Sometime ago I read about performance penalties when dealing with double sided materials. I don't know if they still stand. So when I flip the normals in Blender, is there a way to export it that way? I tried to do that as well but I couldn't succeed. You should write a visitor that inverts the normals for those selected geometries. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting Uniform Value in drawImplementation
Hi Carl, It sounds like you are most of the way there, osg::State maintains the list of current state that has been applied so you just need to get the current uniform set from the osg::State object. The stumbling block is that is presently any accessors for the internal data structers and these data structurs are all defined in the protected scope of osg::State - this is dileberate as the internal implementations details of a complex class like osg::State is best kept protected so that any changes in internal API/data strucutres won't effect the build of 3rd party applicatons. What you could do is add public accessesors to get the get current uniform state, these methods could worry about the internal implementation details so the internal structures won't need to be moved into the public scope. Robert. On Wed, Mar 9, 2011 at 7:09 PM, Cary, Karl A. karl.a.c...@saic.com wrote: I am trying to debug an application where apparently a common uniform value passed to 2 shaders is ending up differently. In order to both confirm my suspicions and figure out where to go next, I thought I would check to see what value the uniform is set to during the actual drawImplementation of each object. I know you can use getUniformLocation on the state you can extract from the RenderInfo, but I haven’t figured out how to actually get at the value itself. From what I can see in the osg::State object is that there is a UniformStack, but I haven’t been able to find any info about what is actually in it. If anyone has any ideas, it would be much appreciated. Thank you. Karl ___ 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] Can I check for Polygon-Polygon intersection/distance in OSG
Hi Sanat, There are no functions in the OSG for computing intersections of polygons models with other polygonal models. Robert. On Thu, Mar 10, 2011 at 12:04 AM, Sanat Talmaki sanat.sch...@gmail.com wrote: Hi, I had a quick question if I can check for intersection/overlap between Polygons of two different 3D models. In addition, is it also possible to find the closest distance between a pair of 3D models as the shortest path between a polygon on obj1 and a polgon on obj2. I am aware that there exist 3rd party graphics libraries that can be used for this. But I wanted to know if I can do this in OSG itself considering I have Polygon lists of my 3D models. Any information on this would be greatly appreciated. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37483#37483 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I check for Polygon-Polygon intersection/distance in OSG ?
Thanks Robert. Regards, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37492#37492 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Opengl ES 2.0 testing
Hello i'm looking for a little bit of Code that has been tested to be working and draws on OpenGL ES 2.0 a simple vertex/fragment shader loading and a little bit of geometry or a triangle. I'm testing the Android port working and i'm a little bit paranoid to write one if I write one and doesn't work i won't know if it's by using some instruction that don't work on GLES 2 or if it is some kind of trouble in the GLES2/Android building. I'm not ussed to test osg with GLES 2 in emulators that's why i'm asking for help in this matter. Thanks and apologies for the nuisanse. J.Izquierdo ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osg-submissions] Android Development Plans
Hi all, I gave osg android port a try on Windows using cygwin, and it worked like a charm (only a tiny problem with osgViewer, when cross compiling for android using cygwin, the windows path in osgViewer/CMakeLists.txt is used rather than the android one, fix attached). For the moment I only compiled all the osg libs and plugins that don't rely on a 3rdParty lib. I will let you know when I succeed to build an app for my nexus S :) (the test apk Jorge sent, works for me) Thanks for your efforts. Mourad On Tue, Mar 8, 2011 at 5:37 PM, Robert Osfield robert.osfi...@gmail.comwrote: Hi Rafa, Jorge and all ;-) On Mon, Mar 7, 2011 at 11:53 AM, Rafa Gaitan rafa.gai...@gmail.com wrote: Finally Jorge and me have finished a first approach to build OSG under Android using the android NDK. Attached you will find all required code and cmake modifications (They are based on a previous submissions I sent last week). Many thanks for your efforts. I have now merged and checked in changes to OpenSceneGraph svn/trunk. I haven't tested the Android build at all yet, only the normal Linux build side. Would it be possible for you to put up a documentation page on the wiki to show how to set up to build the OSG on Android? Thanks, Robert. ___ osg-submissions mailing list osg-submissi...@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org # FIXME: For OS X, need flag for Framework or dylib IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGVIEWER_LIBRARY) ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) ENDIF() SET(LIB_NAME osgViewer) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) SET(TARGET_H ${HEADER_PATH}/CompositeViewer ${HEADER_PATH}/Export ${HEADER_PATH}/GraphicsWindow ${HEADER_PATH}/Renderer ${HEADER_PATH}/Scene ${HEADER_PATH}/Version ${HEADER_PATH}/View ${HEADER_PATH}/Viewer ${HEADER_PATH}/ViewerBase ${HEADER_PATH}/ViewerEventHandlers ) SET(LIB_COMMON_FILES CompositeViewer.cpp HelpHandler.cpp Renderer.cpp Scene.cpp ScreenCaptureHandler.cpp StatsHandler.cpp Version.cpp View.cpp Viewer.cpp ViewerBase.cpp ViewerEventHandlers.cpp ${OPENSCENEGRAPH_VERSIONINFO_RC} ) SET(LIB_EXTRA_LIBS) IF(WIN32 AND NOT ANDROID) # # Enable workaround for OpenGL driver issues when used in multithreaded/multiscreen with NVidia drivers on Windows XP # For example: osgviewer dumptruck.osg was showing total garbage (screen looked like shattered, splashed hedgehog) # There were also serious issues with render to texture cameras. # Workaround repeats makeCurrentContext call as it was found that this causes the problems to dissapear. # OPTION(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND Set to ON if you have NVidia board and drivers earlier than 177.92 ver OFF) MARK_AS_ADVANCED(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) IF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) ADD_DEFINITIONS(-DOSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) ENDIF() SET(TARGET_H ${TARGET_H} ${HEADER_PATH}/api/Win32/GraphicsHandleWin32 ${HEADER_PATH}/api/Win32/GraphicsWindowWin32 ${HEADER_PATH}/api/Win32/PixelBufferWin32 ) SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} GraphicsWindowWin32.cpp PixelBufferWin32.cpp ) ELSE() IF(APPLE) IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR) SET(OSG_WINDOWING_SYSTEM IOS CACHE STRING Windowing system type for graphics window creation, options only IOS.) ELSE() SET(OSG_WINDOWING_SYSTEM Carbon CACHE STRING Windowing system type for graphics window creation, options Carbon, Cocoa or X11.) ENDIF() ELSE() IF(ANDROID) SET(OSG_WINDOWING_SYSTEM None CACHE STRING None Windowing system type for graphics window creation.) ELSE() SET(OSG_WINDOWING_SYSTEM X11 CACHE STRING Windowing system type for graphics window creation. options only X11) ENDIF() ENDIF() IF(${OSG_WINDOWING_SYSTEM} STREQUAL Cocoa) ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION) IF(OSG_COMPILE_FRAMEWORKS) SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa ) SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
Re: [osg-users] Opengl ES 2.0 testing
Hi Jorge, Hello i'm looking for a little bit of Code that has been tested to be working and draws on OpenGL ES 2.0 a simple vertex/fragment shader loading and a little bit of geometry or a triangle. I'm testing the Android port working and i'm a little bit paranoid to write one if I write one and doesn't work i won't know if it's by using some instruction that don't work on GLES 2 or if it is some kind of trouble in the GLES2/Android building. I'm not ussed to test osg with GLES 2 in emulators that's why i'm asking for help in this matter. OK, two things: 1. The Android emulator doesn't support GLES 2.0 from what I've seen, unless it's been fixed recently. Apps using GLES 2.0 will just crash on initialization. You have to test on the device itself (which sucks, makes turnaround time longer, but what can we do...) 2. From what I've seen, OSG will automatically change your osg::Geometry to use vertex attributes (instead of the old vertex, normal, color, texcoord arrays), will automatically create uniforms that replicate the old built-in uniforms (gl_ModelViewMatrix becomes osg_ModelViewMatrix and is set to the right value, etc.) and will automatically modify your shaders to use those uniforms (so it will replace gl_ModelViewMatrix with osg_ModelViewMatrix in your shader code). So (at least I think, I've never been able to test it) you should be able to make a scene graph with an osg::Geometry that displays a triangle, and a simple vertex+fragment shader pair that just transforms the vertex position by the gl_ModelViewProjectionMatrix in the vertex shader and then sets its color to red in the fragment shader, and it should work out of the box. Note also that you can make a build of OSG that emulates what you would need to do on GLES 2.0, but which runs on a desktop with standard OpenGL. See this page: http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES The section called: Cmake settings for Emulating OpenGL ES 2.0 when you only have standard OpenGL available: I had debugged through the code paths when configuring an OSG build like this, and that's how I found out what I said above (in 2). Thanks and apologies for the nuisanse. It's no nuisance at all. Good luck, let us know how it goes! :-) 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] osgText setColor problem
Hi, I've got a simple function which creates a text object and attaches it to a Geode: osg::ref_ptrosg::Geode drawLabels() { osg::ref_ptrosg::Geode geode = new osg::Geode; osg::ref_ptrosgText::Font font = osgText::readFontFile(fonts/forte.ttf); osg::ref_ptrosgText::Text text1 = new osgText::Text; text1-setFont(font.get()); text1-setColor(osg::Vec4(1.0f,0.0f,0.0,1.0f)); text1-setCharacterSize(200.0f); text1-setPosition(osg::Vec3(0.0f,0.0f,0.0f)); text1-setAxisAlignment(osgText::Text::SCREEN); text1-setText(SomeText); geode-addDrawable(text1.get()); return geode.release(); } Everything works correctly (correct font, size, etc...) except that whatever I put in the setColor function call, the text is always black. I tried setting GL_LIGHTING to off for the geode but it had no effect. Any Ideas? Cheers, Matthew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37505#37505 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osg-submissions] Android Development Plans
Thanks Mourad, fix now merged and submitted to svn/trunk. On Thu, Mar 10, 2011 at 2:30 PM, Mourad Boufarguine mourad.boufargu...@gmail.com wrote: Hi all, I gave osg android port a try on Windows using cygwin, and it worked like a charm (only a tiny problem with osgViewer, when cross compiling for android using cygwin, the windows path in osgViewer/CMakeLists.txt is used rather than the android one, fix attached). For the moment I only compiled all the osg libs and plugins that don't rely on a 3rdParty lib. I will let you know when I succeed to build an app for my nexus S :) (the test apk Jorge sent, works for me) Thanks for your efforts. Mourad On Tue, Mar 8, 2011 at 5:37 PM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Rafa, Jorge and all ;-) On Mon, Mar 7, 2011 at 11:53 AM, Rafa Gaitan rafa.gai...@gmail.com wrote: Finally Jorge and me have finished a first approach to build OSG under Android using the android NDK. Attached you will find all required code and cmake modifications (They are based on a previous submissions I sent last week). Many thanks for your efforts. I have now merged and checked in changes to OpenSceneGraph svn/trunk. I haven't tested the Android build at all yet, only the normal Linux build side. Would it be possible for you to put up a documentation page on the wiki to show how to set up to build the OSG on Android? Thanks, Robert. ___ osg-submissions mailing list osg-submissi...@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-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] osgText setColor problem
Hi Mathew, I now idea what might amiss. What happens when you run the osgtext example? Robert. On Thu, Mar 10, 2011 at 2:46 PM, Matthew Parry matthew...@live.co.uk wrote: Hi, I've got a simple function which creates a text object and attaches it to a Geode: osg::ref_ptrosg::Geode drawLabels() { osg::ref_ptrosg::Geode geode = new osg::Geode; osg::ref_ptrosgText::Font font = osgText::readFontFile(fonts/forte.ttf); osg::ref_ptrosgText::Text text1 = new osgText::Text; text1-setFont(font.get()); text1-setColor(osg::Vec4(1.0f,0.0f,0.0,1.0f)); text1-setCharacterSize(200.0f); text1-setPosition(osg::Vec3(0.0f,0.0f,0.0f)); text1-setAxisAlignment(osgText::Text::SCREEN); text1-setText(SomeText); geode-addDrawable(text1.get()); return geode.release(); } Everything works correctly (correct font, size, etc...) except that whatever I put in the setColor function call, the text is always black. I tried setting GL_LIGHTING to off for the geode but it had no effect. Any Ideas? Cheers, Matthew -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37505#37505 ___ 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] osgText setColor problem
Hi Robert, I just tried running the example and the color works correctly. I'm now even more confused! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37509#37509 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Hi Matthew, On Thu, Mar 10, 2011 at 3:23 PM, Matthew Parry matthew...@live.co.uk wrote: I just tried running the example and the color works correctly. I'm now even more confused! Might you have a StateSet higher up in the scene graph that decorates the Text drawable and override it's state, such as adding multi-texturing or provideding an osg::Material that switches off the GL_COLOR_MATERIAL feature that allows glColor to override the colour. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Ok, I tried attaching it to the root node and the color now works, previously it was attached to a ShadowedScene node which was itself attached to the root. So obviously something in that ShadowedScene node is causing the problem, I still don't know what it is as I don't do set anything in the stateset that should affect the text color to my knowledge but at least it works now! Thanks for the help. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37511#37511 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgText setColor problem
Hi Matthew, On Thu, Mar 10, 2011 at 3:56 PM, Matthew Parry matthew...@live.co.uk wrote: Ok, I tried attaching it to the root node and the color now works, previously it was attached to a ShadowedScene node which was itself attached to the root. So obviously something in that ShadowedScene node is causing the problem, I still don't know what it is as I don't do set anything in the stateset that should affect the text color to my knowledge but at least it works now! Thanks for the help. The shaders used for shadowing will probably be the culprit, or perhaps you text is just in shadow ;-) Do you want your text to be effected by shadows? If not putting them outseide of teh ShadowedScene subgraph would be the thing to do. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Window Position of Widget
I have a widget button--which is essentially a label--inside a widget box which is placed somewhere within a viewer, say at 100x150. This button should open up, right below it, a dropdown menu, which is another box. The issue I'm having is that if I use getOrigin() or getPosition() for the button, I get a value of 0,0 which is where it is placed relative to the origin of the window it is in. This causes an issue because the window that drops down below it needs the actual position of the button relative to the entire screen. Is there some way I can get this absolute position of the button origin? Or is there some other way I can get around this issue so I can get the dropdown window to actually be below my button? Thanks -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37532#37532 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Generating terrain mesh using 3D points
Hi, Has anyone tried generating a terrain mesh using 3D points? Any advice of how to get started? I have some terrain data consisting of 3D points and need to develop functions to query the terrain height during runtime. Thank you! Cheers, Linda -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37533#37533 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Generating terrain mesh using 3D points
On 3/10/2011 7:21 PM, Linda Lee wrote: Has anyone tried generating a terrain mesh using 3D points? Any advice of how to get started? I have some terrain data consisting of 3D points and need to develop functions to query the terrain height during runtime. You'll need to use a gridding tool to transform this into a regularly sampled surface. GDAL offers tools to do this. You can then query this grid directly, without using OSG, or if you need to visualize the terrain too, use VPB to build an OSG terrain database and use osgSim's Height Above Terrain tools to query it at various locations. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. There is no Truth. There is only Perception. To Perceive is to Exist. - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org