Re: [osg-users] to draw landscapes beginning from a matrix
Hi, You should have look to the osgshape example source code (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp) jcl This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
ok, it seams that i should retest it myself. but the problem is that i don't have much knowledge on OS/X. it doesn't attach the osgViewer into the context / window rect of the WindowRef is pointing to. / 2008/2/6, Stephan Huber [EMAIL PROTECTED]: Adrian Egli OpenSceneGraph (3D) schrieb: is there a carbon (safari plugin) demo / example for osg viewer integration into carbon like viewer mfc afaik no. What are the requirements? With the current implementation you can pass your own WindowRef and/or disable the registering of the EventCallbacks. See GraphicsWindowCarbon::WindowData. But this codepath is not well tested. cheers, Stephan ___ 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
Re: [osg-users] drawing a sphere
Hi, Just take a look at the osgplanets example, it shows how to use a sphere shape and texture it. On Feb 6, 2008 10:53 AM, wanyama harold [EMAIL PROTECTED] wrote: Hi guys, could someone help me with code for drawing a sphere. something in the shape of a planet. thx. __ Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Serge Lages http://www.tharsis-software.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to modify the array of vertex from a Geometry object
Dear all, I have to create a 3D surface, and then such surface will be modified during the application with several deformations. I've tried to create a Geometry object, then I set the VertexArray, and finally inside the render callback I update such vertex with the new ones. I got some errors during the rendering: Warning: detected OpenGL error value not valid after RenderBin::draw(,) Does anyone has an idea of such error? In addition, I'm sure the way I am accessing the vertex is not the right one, anybody knows the best way? here is the code: //Create the 3D geometry - osg::Vec3Array(m*n)); osg::Vec2Array t= *(new osg::Vec2Array(m*n)); osg::Vec4Array col = *(new osg::Vec4Array(1)); col[0][0] = col[0][1] = col[0][2] = col[0][3] = 1.0f; int index = 0; for( i = 0; i m; i++ ) { for(j = 0; j n; j++) { v[index][0] = i; v[index][1] = 0; v[index][2] = j; t[index][0] = (float)i/(m-1); t[index][1] = (float)j/(n-1); index++; } } myGeom = new osg::Geometry; myGeom-setVertexArray( v ); myGeom-setTexCoordArray( 0, t ); myGeom-setColorArray( col ); myGeom-setColorBinding( osg::Geometry::BIND_OVERALL ); for( i = 0; i m-1; i++ ) { osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP); elements-reserve(m*2); for( j = 0; j n; j++ ) { elements-push_back((i+0)*n+j); elements-push_back((i+1)*n+j); } myGeom-addPrimitiveSet(elements); } osg::Texture2D *tex = new osg::Texture2D; tex-setImage(osgDB::readImageFile(Images/breast.png)); osg::StateSet *dstate = new osg::StateSet; dstate-setMode( GL_LIGHTING, osg::StateAttribute::OFF ); dstate-setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON ); dstate-setTextureAttribute(0, new osg::TexEnv ); myGeom-setStateSet( dstate ); osg::Geode *geode = new osg::Geode; geode-addDrawable( myGeom ); --- //Accessing the elements --- osg::Vec3Array *test = dynamic_cast(myGeom-getVertexArray()); for(int i = 0; i numVertex; i++) { NxMat34 pose = listShapes.at(i)-shape-getGlobalPose(); osg::Vec3f trans = osg::Vec3(pose.t.x,pose.t.y,pose.t.z); test-at(i) = trans; } myGeom-dirtyDisplayList(); myGeom-dirtyBound(); thank you very much for your help!!! Crisalix. _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] making a movie of an OSG simulation
El Wednesday 06 February 2008 14:00:26 hemanth korrapati escribió: hi I wanted to make a movie of whatever is displayed on the screen when running an osg program. how do i do it ? It is described here using a post frame callback: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2007-August/000884.html or you can either use an external program. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] making a movie of an OSG simulation
Possible ways may include but not limited to Use Video capture to card the output Write directly to an AVI/QuickTime or other format every frame Make a screen grab every frame then compile these still frame into a movie -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of hemanth korrapati Sent: Wednesday, February 06, 2008 8:00 AM To: OpenSceneGraph Users Subject: [osg-users] making a movie of an OSG simulation hi I wanted to make a movie of whatever is displayed on the screen when running an osg program. how do i do it ? Thank You ___ 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] making a movie of an OSG simulation
IIRC a little tool called fraps is doing the job. cheers psy hi I wanted to make a movie of whatever is displayed on the screen when running an osg program. how do i do it ? Thank You ___ 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] ShadowMap and TEXTURE_COMPARE_MODE
Hi everyone, I've been struggling with the implementation of osgShadow::ShadowMap in osg 2.2.0. It seems to me the shadow texture compare mode is not set, which results in strange results. My project requieres per pixel illumination, which is why I have to calculate all projections in the vertex shader. If take a closer look at: http://img238.imagevenue.com/img.php?image=07135_wrongShadow_122_12lo.jpg You will notice that the bars in the 3rd and 4th row are shadowed by the first row which should be occluded. Any hints? cheers psy ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
I got the LineSegment::intersect() method to work when I converted the vectors you get from finding the difference between the start and the sphere center, and the difference between the start and the end, to Vec3d. You want the dot product to be in doubles. In my version, I get the difference in terms of Vec3, and then convert them to Vec3d. The rest of the method is in doubles until setting r1 and r2. Another approach would be to change the internal representation of _e and _s to Vec3d, or maybe just keep _e - _s as a Vec3d so you don't have to subtract that one each time. So is anyone counting on this being floats for performance? Would anyone else welcome this calculation in doubles? I don't mind adding some code in our own source if other people don't want this in doubles, but I'd have to make my own IntersectVisitor as well as my own LineSegment, when all I really want to replace is the LineSegment. Having an almost-but-not-quite copy of a class and having to watch the original for updates doesn't sound like any fun. If I could get IntersectVisitor to use a class derived from LineSegment, with just the changes I want, that might not be bad. I think I'll submit a version of LineSegment, and you (Robert and the mailing list) can tell me what you think. andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andy Skinner Sent: Tuesday, February 05, 2008 8:57 AM To: OpenSceneGraph Users Subject: [osg-users] intersect() methods in LineSegment (probably others) I'm not sure what changed (in OSG or our code), but one of our unittests is failing on Windows as I try to upgrade our software to OSG 2.3.3. The picking I'm doing isn't hitting anything. It appears that the use of floats in the LineSegment::intersect(BoundingSphere) method may be hurting us. I've seen mentions on this in the list archives. Is the calculation done in this method done in float on purpose? If some of the intermediate value in this calculation were done in double, would it slow things down too much? We're squaring some large numbers and subtracting them from each other, and it isn't holding up for us. I'm going to experiment with doing some of this in double, but since it seems known that there are precision problems in this code, I wonder if it has remained in float for a reason. I could try to make an example for this, but because there seems to be an awareness of the issue, I'll raise it now. Thoughts? thanks andy ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap and TEXTURE_COMPARE_MODE
Hello Sebastian, I've been struggling with the implementation of osgShadow::ShadowMap in osg 2.2.0. It seems to me the shadow texture compare mode is not set, which results in strange results. My project requieres per pixel illumination, which is why I have to calculate all projections in the vertex shader. I can't say specifically as I haven't seen these particular artifacts, but then again I haven't used osgShadow as you are. It's very possible there are tweaks to be made. osgShadow in general needs some work, though the basics are there. If you work on this and there is anything you can contribute, it would be very appreciated. I guess it also depends on the shader you're using, since you're probably replacing the osgShadow::ShadowMap shader to do your per-pixel lighting, right? J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] generation of file .exe
Hi! how can I produce a file .exe, that can also be performed on a computer on which osg is not installed? is this possible? Aurora Restivo ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
Hello Andy, So is anyone counting on this being floats for performance? Would anyone else welcome this calculation in doubles? If you submit a patch, I can test it out in my Masters project which uses LineSegmentIntersector pretty heavily (not-quite-realtime raytracing :-) ) so that will tell us if there is really a performance difference. Off hand I can't really say, so I'd prefer to do some benchmarking. I don't mind adding some code in our own source if other people don't want this in doubles, but I'd have to make my own IntersectVisitor as well as my own LineSegment, when all I really want to replace is the LineSegment. Having an almost-but-not-quite copy of a class and having to watch the original for updates doesn't sound like any fun. I totally understand... It'll be a matter of the performance vs correctness tradeoff I guess, so as I said I can provide some answer to the performance side of that question and see what Robert thinks when he comes back. So please, submit your changes and we'll see. Thanks, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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
Re: [osg-users] generation of file .exe
Hello Aurora, how can I produce a file .exe, that can also be performed on a computer on which osg is not installed? is this possible? Yes it is possible, it's just a matter of including the right DLLs with your executable. The Dependency Walker tool (http://www.dependencywalker.com/) can be of some help to tell you which DLLs you executable depends on. Please search the archives for more information (http://dir.gmane.org/gmane.comp.graphics.openscenegraph.user), as this has been discussed before. Hope this helps, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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
Re: [osg-users] ShadowMap and TEXTURE_COMPARE_MODE
Hello Jean-Sébastien, I reckon that my assumption regarding the texture compare mode were wrong. But indeed the whole problem seems to be with my shaders. I'm willing to provide the per-pixel modifications. I guess I'm doing something very wrong in my vertex shader. Upon completion and testing these shaders could be integrated into the osgShadow::ShadowMap implementation (if I get this working ;-)) Thanks so far, I've added my shadercode for non-textured Elements below (the shadowmap is bound to TextureUnit 1) snip varying vec4 diffuse,ambient; varying vec3 normal,lightDir,halfVector; void main() { normal = normalize(gl_NormalMatrix * gl_Normal); lightDir = normalize(vec3(gl_LightSource[0].position)); halfVector = normalize(gl_LightSource[0].halfVector.xyz); diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex; gl_TexCoord[1].s = dot( ecPosition, gl_EyePlaneS[1] ); gl_TexCoord[1].t = dot( ecPosition, gl_EyePlaneT[1] ); gl_TexCoord[1].p = dot( ecPosition, gl_EyePlaneR[1] ); gl_TexCoord[1].q = dot( ecPosition, gl_EyePlaneQ[1] ); gl_Position = ftransform(); } FragmentShader varying vec4 diffuse,ambient; varying vec3 normal,lightDir,halfVector; uniform sampler2DShadow shadow_texture; void main() { vec3 n,halfV; float NdotL,NdotHV; vec4 color = ambient; n = normalize(normal); NdotL = max(dot(n,lightDir),0.0); if (NdotL 0.0) { color += diffuse * NdotL; halfV = normalize(halfVector); NdotHV = max(dot(n,halfV),0.0); color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV, gl_FrontMaterial.shininess); } gl_FragColor = color * (0.5 + shadow2DProj( shadow_texture, gl_TexCoord[1] ) * 1.0); } Jean-Sébastien Guay schrieb: Hello Sebastian, I've been struggling with the implementation of osgShadow::ShadowMap in osg 2.2.0. It seems to me the shadow texture compare mode is not set, which results in strange results. My project requieres per pixel illumination, which is why I have to calculate all projections in the vertex shader. I can't say specifically as I haven't seen these particular artifacts, but then again I haven't used osgShadow as you are. It's very possible there are tweaks to be made. osgShadow in general needs some work, though the basics are there. If you work on this and there is anything you can contribute, it would be very appreciated. I guess it also depends on the shader you're using, since you're probably replacing the osgShadow::ShadowMap shader to do your per-pixel lighting, right? J-S ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
Hi Andy, I feel open to change to double if we are working with double precision as internal representation. Or if we have double precsion in bounding sphere. For all care about performance, i don't be sure this change will become much slower as it is for the moment. But of course double is not as fast as floating point operations are. Few weeks ago i sent to the submission one change i did in the intersection test, it make the tri-checks a little faster, but it's not yet in the current SVN. May we could take it first, and check the correctness, then we can do the double fix. But if you like to change the intersection test, you should take care about the number of triangles check: at the moment the check is done in O(n). there is a need of kd-tree support in line intersection (real time ray tracing data structure for ray intersection test). i know that i still mentioned to propose some line of code, but unfortunatelly i never get the needed time slot for doing that. if you were interest in it, please let me know. but this change will be one of the most important with respect to performance w.r.t. line intersection tests. (screenshots on openscenegraph webpages) /adegli 2008/2/6, Andy Skinner [EMAIL PROTECTED]: I got the LineSegment::intersect() method to work when I converted the vectors you get from finding the difference between the start and the sphere center, and the difference between the start and the end, to Vec3d. You want the dot product to be in doubles. In my version, I get the difference in terms of Vec3, and then convert them to Vec3d. The rest of the method is in doubles until setting r1 and r2. Another approach would be to change the internal representation of _e and _s to Vec3d, or maybe just keep _e - _s as a Vec3d so you don't have to subtract that one each time. So is anyone counting on this being floats for performance? Would anyone else welcome this calculation in doubles? I don't mind adding some code in our own source if other people don't want this in doubles, but I'd have to make my own IntersectVisitor as well as my own LineSegment, when all I really want to replace is the LineSegment. Having an almost-but-not-quite copy of a class and having to watch the original for updates doesn't sound like any fun. If I could get IntersectVisitor to use a class derived from LineSegment, with just the changes I want, that might not be bad. I think I'll submit a version of LineSegment, and you (Robert and the mailing list) can tell me what you think. andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andy Skinner Sent: Tuesday, February 05, 2008 8:57 AM To: OpenSceneGraph Users Subject: [osg-users] intersect() methods in LineSegment (probably others) I'm not sure what changed (in OSG or our code), but one of our unittests is failing on Windows as I try to upgrade our software to OSG 2.3.3. The picking I'm doing isn't hitting anything. It appears that the use of floats in the LineSegment::intersect(BoundingSphere) method may be hurting us. I've seen mentions on this in the list archives. Is the calculation done in this method done in float on purpose? If some of the intermediate value in this calculation were done in double, would it slow things down too much? We're squaring some large numbers and subtracting them from each other, and it isn't holding up for us. I'm going to experiment with doing some of this in double, but since it seems known that there are precision problems in this code, I wonder if it has remained in float for a reason. I could try to make an example for this, but because there seems to be an awareness of the issue, I'll raise it now. Thoughts? thanks andy ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ 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
Re: [osg-users] intersect() methods in LineSegment (probably others)
In your work, could you give me an idea of how often you intersect with a particular line segment object? I'm trying to decide if it is worth it to keep a Vec3d in the class (marking whether it is valid), or keeping double versions of _s and _e. thanks, andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Wednesday, February 06, 2008 9:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] intersect() methods in LineSegment (probably others) Hello Andy, So is anyone counting on this being floats for performance? Would anyone else welcome this calculation in doubles? If you submit a patch, I can test it out in my Masters project which uses LineSegmentIntersector pretty heavily (not-quite-realtime raytracing :-) ) so that will tell us if there is really a performance difference. Off hand I can't really say, so I'd prefer to do some benchmarking. I don't mind adding some code in our own source if other people don't want this in doubles, but I'd have to make my own IntersectVisitor as well as my own LineSegment, when all I really want to replace is the LineSegment. Having an almost-but-not-quite copy of a class and having to watch the original for updates doesn't sound like any fun. I totally understand... It'll be a matter of the performance vs correctness tradeoff I guess, so as I said I can provide some answer to the performance side of that question and see what Robert thinks when he comes back. So please, submit your changes and we'll see. Thanks, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] Efficient mesh data structures
Hi all, i am working with openMesh, is a nice datastructure and it works quite well. you can doing quit a loot think with the mesh, if you will adding this to the openscenegraph world, may we should start a mesh libaray or node kit for manipulating the mesh. also support of common osg mesh can be an option, may i open osg file / 3ds ... then by a mesh service i can translate the mesh into an openmesh and finnaly our node is an openmesh node as well as it's an OSG node. the openscenegraph can render it. you see there is of course a need for such datastructre. what are you planing for the next step towards a node kit? /adegli 2008/2/6, Morné Pistorius [EMAIL PROTECTED]: Hmm, haven't tried building it on anything other than Windows yet, but I recon it should be easy enough to convert it to CMake. It looks like a pretty good datastructure, but I didn't want dive in and start bashing away at the keyboard if there is a better solution out there. I had hoped that someone might have used it before. Morne On Feb 5, 2008 8:45 PM, Nicholas Yue [EMAIL PROTECTED] wrote: On 05/02/2008, Morné Pistorius [EMAIL PROTECTED] wrote: Hi all, I am looking for an efficient general mesh data structure and I thought I would bounce this one off the list. I came across OpenMesh (http://www.openmesh.org), which looks like it might be useful and could conceivably be integrated into an osgNodeKit. Has anyone here ever used it or could you recommend something else? As always, feedback is greatly appreciated! OpenMesh uses something call acgmake to build it. I have not had success in building it on Ubuntu. I am also looking for an efficient general mesh data structure (hopefully templatize) Regards -- Nicholas Yue BSc (Hons) MACM Graphics - RenderMan, RIB, Visualization, OpenGL Custom Dev - C++ porting, OSX, Linux, Windows http://www.proceduralinsight.com/about.html ___ 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 -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
Hi Andy, If we are using drive manipulator, then we are testing many time with many objects against a line. /adegli 2008/2/6, Andy Skinner [EMAIL PROTECTED]: In your work, could you give me an idea of how often you intersect with a particular line segment object? I'm trying to decide if it is worth it to keep a Vec3d in the class (marking whether it is valid), or keeping double versions of _s and _e. thanks, andy -Original Message- From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Wednesday, February 06, 2008 9:52 AM To: OpenSceneGraph Users Subject: Re: [osg-users] intersect() methods in LineSegment (probably others) Hello Andy, So is anyone counting on this being floats for performance? Would anyone else welcome this calculation in doubles? If you submit a patch, I can test it out in my Masters project which uses LineSegmentIntersector pretty heavily (not-quite-realtime raytracing :-) ) so that will tell us if there is really a performance difference. Off hand I can't really say, so I'd prefer to do some benchmarking. I don't mind adding some code in our own source if other people don't want this in doubles, but I'd have to make my own IntersectVisitor as well as my own LineSegment, when all I really want to replace is the LineSegment. Having an almost-but-not-quite copy of a class and having to watch the original for updates doesn't sound like any fun. I totally understand... It'll be a matter of the performance vs correctness tradeoff I guess, so as I said I can provide some answer to the performance side of that question and see what Robert thinks when he comes back. So please, submit your changes and we'll see. Thanks, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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 -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
Hi Andy, In your work, could you give me an idea of how often you intersect with a particular line segment object? I'm trying to decide if it is worth it to keep a Vec3d in the class (marking whether it is valid), or keeping double versions of _s and _e. In general terms, my program will do n^2 intersections from each vertex in directions around a sphere, where n=20 to 100 (so 400 to 10,000 intersections per vertex). And right now, I'm working with scenes which have roughly 5,000 to 100,000 vertices. So say for the simplest scene at n=20, that would be 2 million intersection tests. And in terms of time, I'll take what I can get, but with Adrian Egli's kdtree I'm currently getting about 20 seconds (IIRC) for that, so that's about 100,000 intersections per second. With the LineSegmentIntersector, I was getting about 10,000 to 20,000 intersections per second. But I don't keep the line segment objects since none of my tests are have the same start _and_ end values... I guess I could precompute them and store them and then just use them each time, but since my goal is to do this for dynamic scenes, it would be one more thing to recalculate if something changes... J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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
Re: [osg-users] ShadowMap and TEXTURE_COMPARE_MODE
Hello Sebastian, I reckon that my assumption regarding the texture compare mode were wrong. But indeed the whole problem seems to be with my shaders. I'm willing to provide the per-pixel modifications. I guess I'm doing something very wrong in my vertex shader. Upon completion and testing these shaders could be integrated into the osgShadow::ShadowMap implementation (if I get this working ;-)) Before writing your shader, did you look at the shader in src/osgShadow/ShadowMap.cpp? It does things a bit differently than classic shadow map implementations (in particular it does not need a vertex shader), so I'd also suspect something is wrong in your vertex shader. Also, I think you need to use the same uniform sampler names in your fragment shader that ShadowMap sets, otherwise you're not using the same sampler, right? // // fragment shader // static const char fragmentShaderSource_withBaseTexture[] = uniform sampler2D osgShadow_baseTexture; \n uniform sampler2DShadow osgShadow_shadowTexture; \n uniform vec2 osgShadow_ambientBias; \n \n void main(void) \n { \n vec4 color = gl_Color * texture2D( osgShadow_baseTexture, gl_TexCoord[0].xy ); \n gl_FragColor = color * (osgShadow_ambientBias.x + shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1] ) * osgShadow_ambientBias.y); \n }\n; Unfortunately I cannot dive into this right now, but I think you have some leads... Keep us updated on how it goes. Hope this helps, J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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
Re: [osg-users] intersect() methods in LineSegment (probably others)
:-) only the first version of my kd.tree. latest i still extermly slow with about 700K-800K intersection test per second. there are latest kd-Tree ray check with more than ++ 6M rays per second. www.ompf.org :-) so if we will have such a datastructure, we can do lot special effects, like global illumination, high quality shadows, reflection , ... :-) 2008/2/6, Jean-Sébastien Guay [EMAIL PROTECTED]: Hi Andy, In your work, could you give me an idea of how often you intersect with a particular line segment object? I'm trying to decide if it is worth it to keep a Vec3d in the class (marking whether it is valid), or keeping double versions of _s and _e. In general terms, my program will do n^2 intersections from each vertex in directions around a sphere, where n=20 to 100 (so 400 to 10,000 intersections per vertex). And right now, I'm working with scenes which have roughly 5,000 to 100,000 vertices. So say for the simplest scene at n=20, that would be 2 million intersection tests. And in terms of time, I'll take what I can get, but with Adrian Egli's kdtree I'm currently getting about 20 seconds (IIRC) for that, so that's about 100,000 intersections per second. With the LineSegmentIntersector, I was getting about 10,000 to 20,000 intersections per second. But I don't keep the line segment objects since none of my tests are have the same start _and_ end values... I guess I could precompute them and store them and then just use them each time, but since my goal is to do this for dynamic scenes, it would be one more thing to recalculate if something changes... J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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 -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
Hello Adrian, :-) only the first version of my kd.tree. latest i still extermly slow with about 700K-800K intersection test per second. there are latest kd-Tree ray check with more than ++ 6M rays per second. www.ompf.org http://www.ompf.org :-) Don't take it personally, I didn't mean it's slow at 100k intersections per second! Remember each application will be different, so you cannot compare 100k in my program to 700-800k in yours. My program probably does more processing between intersection tests than yours, since it traces in a sphere at each vertex and then stores that as vertex attributes in the Spherical Harmonics basis... Your program is just raytracing from the viewpoint and displaying that, which is simpler... And I recently integrated the last version of your kdtree in my application, and it works well... If you have a newer one, you can send it to me if you want... :-) J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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
Re: [osg-users] making a movie of an OSG simulation
Yukon does the same as fraps on Linux... Pete Sebastian Messerschmidt wrote: IIRC a little tool called fraps is doing the job. cheers psy hi I wanted to make a movie of whatever is displayed on the screen when running an osg program. how do i do it ? Thank You ___ 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] ShadowMap and TEXTURE_COMPARE_MODE
Hi Sebastian, I derived my shader from the shader in the sources. Ok, that's what I was wondering about. I really need the vertex shader in order to calculate lighting on per pixel base. Of course, I didn't mean to remove the vertex shader, I just meant that if you're doing things that are not as they are done in the fixed function vertex processing stage, that could cause problems. If you don't have a vertex shader then the fixed function pipeline does the vertex processing, so if you want equivalent results you have to do the same things as the fixed function pipeline in your vertex shader. So there are a lot of things that could go wrong there... Sampler names should not matter, as the texture objects are rebound to my names (which should take all texgens etc into account). As long as you bind them at the root node (the shadowed scene) so that the uniforms are applied to all the nodes of your graph, that should be ok. It's still a possible point of failure, so why not just use the same names and save yourself the trouble? Sadly I suspect that the only thing that might be wrong is the comparison :-( If you suspect that, you could modify osgShadow::ShadowMap.cpp to try it out... Sorry I can't help you any more than that... J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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
Re: [osg-users] generation of file .exe
Your question has unstated context and assumptions. Without more specifics, there are many interpretations: - OSG does not have to be installed on a computer to work, in that you do not need to run an installer. There is a .zip of prebuilt OSG 2.2.0 at http://mew.cx/osg/ that can be unpacked anywhere and paths tweaked to work without admin rights. - OSG can be built statically and so can be run as a single file, without dependence on other .dll files - produce a file .exe requires a development environment like VisualStudio to compile source code and link into a .exe file. hth -- mew -Original Message- From: [EMAIL PROTECTED] [mailto:osg-users- [EMAIL PROTECTED] On Behalf Of aurora restivo Sent: Wednesday, February 06, 2008 8:54 AM To: OpenSceneGraph Users Subject: [osg-users] generation of file .exe Hi! how can I produce a file .exe, that can also be performed on a computer on which osg is not installed? is this possible? Aurora Restivo ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
:-) 2008/2/6, Jean-Sébastien Guay [EMAIL PROTECTED]: Hello Adrian, :-) only the first version of my kd.tree. latest i still extermly slow with about 700K-800K intersection test per second. there are latest kd-Tree ray check with more than ++ 6M rays per second. www.ompf.org http://www.ompf.org :-) Don't take it personally, I didn't mean it's slow at 100k intersections per second! Remember each application will be different, so you cannot compare 100k in my program to 700-800k in yours. My program probably does more processing between intersection tests than yours, since it traces in a sphere at each vertex and then stores that as vertex attributes in the Spherical Harmonics basis... Your program is just raytracing from the viewpoint and displaying that, which is simpler... And I recently integrated the last version of your kdtree in my application, and it works well... If you have a newer one, you can send it to me if you want... :-) J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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 -- Adrian Egli ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap and TEXTURE_COMPARE_MODE
Hello again, I derived my shader from the shader in the sources. I really need the vertex shader in order to calculate lighting on per pixel base. Sampler names should not matter, as the texture objects are rebound to my names (which should take all texgens etc into account). Sadly I suspect that the only thing that might be wrong is the comparison :-( I'll try my luck with some trial'n'error, Jean-Sébastien Guay schrieb: Hello Sebastian, I reckon that my assumption regarding the texture compare mode were wrong. But indeed the whole problem seems to be with my shaders. I'm willing to provide the per-pixel modifications. I guess I'm doing something very wrong in my vertex shader. Upon completion and testing these shaders could be integrated into the osgShadow::ShadowMap implementation (if I get this working ;-)) Before writing your shader, did you look at the shader in src/osgShadow/ShadowMap.cpp? It does things a bit differently than classic shadow map implementations (in particular it does not need a vertex shader), so I'd also suspect something is wrong in your vertex shader. Also, I think you need to use the same uniform sampler names in your fragment shader that ShadowMap sets, otherwise you're not using the same sampler, right? // // fragment shader // static const char fragmentShaderSource_withBaseTexture[] = uniform sampler2D osgShadow_baseTexture; \n uniform sampler2DShadow osgShadow_shadowTexture; \n uniform vec2 osgShadow_ambientBias; \n \n void main(void) \n { \n vec4 color = gl_Color * texture2D( osgShadow_baseTexture, gl_TexCoord[0].xy ); \n gl_FragColor = color * (osgShadow_ambientBias.x + shadow2DProj( osgShadow_shadowTexture, gl_TexCoord[1] ) * osgShadow_ambientBias.y); \n }\n; Unfortunately I cannot dive into this right now, but I think you have some leads... Keep us updated on how it goes. Hope this helps, J-S ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ShadowMap and TEXTURE_COMPARE_MODE
Hi Jean-Sébastien Hi Sebastian, I derived my shader from the shader in the sources. Ok, that's what I was wondering about. I really need the vertex shader in order to calculate lighting on per pixel base. Of course, I didn't mean to remove the vertex shader, I just meant that if you're doing things that are not as they are done in the fixed function vertex processing stage, that could cause problems. If you don't have a vertex shader then the fixed function pipeline does the vertex processing, so if you want equivalent results you have to do the same things as the fixed function pipeline in your vertex shader. So there are a lot of things that could go wrong there... Indeed ... I once spent half a day figuring out that the texture matrix wasn't applied ;-) Sampler names should not matter, as the texture objects are rebound to my names (which should take all texgens etc into account). As long as you bind them at the root node (the shadowed scene) so that the uniforms are applied to all the nodes of your graph, that should be ok. It's still a possible point of failure, so why not just use the same names and save yourself the trouble? Me culpa! ... it was the uniform name. I accidentally added them somewhere else with the PROTECTED-flag. So thank you for pointing to the problem! If I want to contribute, how may I submit suggestions/ patches? I really appreciate your fast and exact response ... saved me some gray hair ;-) cheers psy ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] X11 keyboard bug (+ fix)
Thanks to all who replied. I've now written a cleaner fix. The focus on modifiers was silly. After we lose all releases on a window hide event, not only modifier releases, we also have to fake-release all of them. What made the most sense to me was to maintain a keyStateMap which keeps track of the pressed/released state. On UnmapNotify all pressed keys are released. (I didn't mess with the current-event-state's modifier mask, as this is updated with the next event, anyway.) Patch attached. (I'll submit that if there are no serious objections.) m. Index: src/osgViewer/GraphicsWindowX11.cpp === --- src/osgViewer/GraphicsWindowX11.cpp (revision 7855) +++ src/osgViewer/GraphicsWindowX11.cpp (working copy) @@ -918,8 +918,20 @@ break; case UnmapNotify : +{ osg::notify(osg::INFO)UnmapNotify event recievedstd::endl; +osgGA::EventQueue *eq = getEventQueue(); +std::mapint,bool::iterator it, end = _keyStateMap.end(); +for (it = _keyStateMap.begin(); it != end; ++it) +{ +if (it-second) +{ +eq-keyRelease(it-first, eventTime); +it-second = false; +} +} break; +} case ReparentNotify: osg::notify(osg::INFO)ReparentNotify event recievedstd::endl; @@ -1093,6 +1105,7 @@ //getEventQueue()-getCurrentEventState()-setModKeyMask(modifierMask); getEventQueue()-keyPress(keySymbol, eventTime); +_keyStateMap[keySymbol] = true; break; } @@ -1124,6 +1137,7 @@ //getEventQueue()-getCurrentEventState()-setModKeyMask(modifierMask); getEventQueue()-keyRelease(keySymbol, eventTime); +_keyStateMap[keySymbol] = false; break; } Index: include/osgViewer/api/X11/GraphicsWindowX11 === --- include/osgViewer/api/X11/GraphicsWindowX11 (revision 7855) +++ include/osgViewer/api/X11/GraphicsWindowX11 (working copy) @@ -179,6 +179,7 @@ double _timeOfLastCheckEvents; std::mapMouseCursor,Cursor _mouseCursorMap; +std::mapint,bool _keyStateMap; }; } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
Adrian Egli OpenSceneGraph (3D) schrieb: ok, it seams that i should retest it myself. but the problem is that i don't have much knowledge on OS/X. it doesn't attach the osgViewer into the context / window rect of the WindowRef is pointing to. I did some minor tests while implementing GraphicsWindowCarbon, and attaching a graphicsContext to an existing window did work, but perhaps it got broken. Do you have a small example which shows the error? cheers, Stephan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] performance fbo
Hi all, I modified the osgprerender example to add a certain number of cameras, doing exactly the same thing as the one thats rendering to a texture, but made them render to a texture that is not used. So in the scene, there is the main viewer, the camera that's doing rtt, and a lot of other cameras doing rtt for nothing. What I've experienced is that by using the fbo implementation, the fps is really lower than the one I get by using any of the other implementation ... You may ask why I'm doing this, but I want to do a lot of rtt saving each render to an image, so I thought that just by modifying the osgprerender example, it would do the trick ... but :( Is there some kind of overhead related to using a lot of fbos compared to another method ?? Thanks all ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CompositeViewer remove View with Eventhandler crash
Compositeview: Two views. Big View and Little View. Big View is loaded with the image of a Cessna going down in flames with the example 'Scribe' event handler. Little View is the beginnings of a user interface. So based on a pick - another view is created, populated and an eventhandler is attached. Very cool. Now - based on a pick - I want to tear down said view and eventhandler. So I try some variant of: osgViewer::View* DoomedView = viewer-getView(ViewIndex); // break down the camera as much as possible. DoomedView-getCamera()-setAllowEventFocus(false); unsigned int DoomedChildren = DoomedView-getCamera()-getNumChildren(); DoomedView-getCamera()-removeChildren(0,DoomedChildren); viewer-removeView(DoomedView); in an event handler of the Little View. So I follow the process and eventually get to: CompositeViewer::eventTraversal() for(ViewEventsMap::iterator veitr = viewEventsMap.begin(); veitr != viewEventsMap.end(); ++veitr) { View* view = veitr-first; -- --At this point in the execution 'view' is pretty thrashed - probably referencing the -- view that no longer there??? There are no event handlers associated with -- this view. I point this out to build the drama. :) -- _eventVisitor-setActionAdapter(view); for(osgGA::EventQueue::Events::iterator itr = veitr-second.begin(); itr != veitr-second.end(); ++itr) { osgGA::GUIEventAdapter* event = itr-get(); for(View::EventHandlers::iterator hitr = view-getEventHandlers().begin(); hitr != view-getEventHandlers().end(); ++hitr) -- -- At this point I try to wave it off: Stop! Stop!. There are no event handlers! -- Don't look for a begining and an end to nothing. Please! -- All in vain . . . -- Everyone in the audience can see it coming. Everyone in the cast and crew. -- The only one ignorant of his/her fate is the hero of the story. -- std::list iterator begin() { // return iterator for beginning of mutable sequence return (iterator(_Nextnode(_Myhead), this)); } -- -- Access violation reading address XYZ. There is no _Nextnode of _Myhead. -- I told the computer to stop but would it listen? Oh no. -- In my despair I wonder if it would've listened to my warnings about the white rabbit. -- Probably not - even with the supporting evidence of all the bones. -- Now a clever programmer like myself could simply add a check for this and skip over the offending check in the CompositeViewer. I could also pour sand into the gears of a finely crafted clock. I'm not in my 20's anymore, and so I figured I present my case and let those wiser then myself offer guidance. That I learned in my 30's. :) -Steve Schneider - Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Looking for CARBON integration example, like osgviewerMFC
Hi Stephan, i will test it tomorrow, today i did some short test, it's hard to say whats going wrong. may tomorrow i will be able to say more. /adegli 2008/2/6, Stephan Maximilian Huber [EMAIL PROTECTED]: Adrian Egli OpenSceneGraph (3D) schrieb: ok, it seams that i should retest it myself. but the problem is that i don't have much knowledge on OS/X. it doesn't attach the osgViewer into the context / window rect of the WindowRef is pointing to. I did some minor tests while implementing GraphicsWindowCarbon, and attaching a graphicsContext to an existing window did work, but perhaps it got broken. Do you have a small example which shows the error? cheers, Stephan ___ 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
Re: [osg-users] performance fbo
How many fbos is a lot? Hundreds of BindBuffer calls per frame can not be a good thing, perhaps that explains the performance hit. -Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, February 06, 2008 10:42 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] performance fbo Hi all, I modified the osgprerender example to add a certain number of cameras, doing exactly the same thing as the one thats rendering to a texture, but made them render to a texture that is not used. So in the scene, there is the main viewer, the camera that's doing rtt, and a lot of other cameras doing rtt for nothing. What I've experienced is that by using the fbo implementation, the fps is really lower than the one I get by using any of the other implementation ... You may ask why I'm doing this, but I want to do a lot of rtt saving each render to an image, so I thought that just by modifying the osgprerender example, it would do the trick ... but :( Is there some kind of overhead related to using a lot of fbos compared to another method ?? Thanks all ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] making a movie of an OSG simulation
Hi, I have done it several times with gtk-recordmydesktop on Ubuntu. You will have to tune parameters a bit to capture OpenGL windows, just read the documentation, it is mentioned on it explicitly. The downside is that this will lose frames. If you want all the frames and high quality, follow the Alberto's link and code your post-frame callback. OSG has enough tools to write this with a few lines of code. El mié, 06-02-2008 a las 18:30 +0530, hemanth korrapati escribió: hi I wanted to make a movie of whatever is displayed on the screen when running an osg program. how do i do it ? Thank You ___ 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] making a movie of an OSG simulation
On Wed, 2008-02-06 at 16:16 +, Pete Carss wrote: Yukon does the same as fraps on Linux... Bugle, too. However, I used to help the Yukon guys, and I'm glad they're still up and running. I'd highly recommend both of these on Linux. I used Bugle to make the osgWidget videos, btw... Pete Sebastian Messerschmidt wrote: IIRC a little tool called fraps is doing the job. cheers psy hi I wanted to make a movie of whatever is displayed on the screen when running an osg program. how do i do it ? Thank You ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to modify the array of vertex from a Geometry object
Hi, Some hints: 1. Be sure that test-size() is equal to numVertex 2. I don't know what the at method is, I couldn't find it either on the TemplateArray class or the std::vector class. Try with the vector [] operator, ie: (*test)[i] = trans 3. If you are updating the vertex data once per frame, don't use display lists, it is the worst thing that you can ever do! It is cheaper even to use direct mode. Use vertex buffer objects and configure the VBO (getOrCreateVertexBufferObject) in streaming mode (GL_STREAM_DRAW). Hope this helps. Regards. Rubén El mié, 06-02-2008 a las 14:08 +0100, lucas Grijander escribió: Dear all, I have to create a 3D surface, and then such surface will be modified during the application with several deformations. I've tried to create a Geometry object, then I set the VertexArray, and finally inside the render callback I update such vertex with the new ones. I got some errors during the rendering: Warning: detected OpenGL error value not valid after RenderBin::draw(,) Does anyone has an idea of such error? In addition, I'm sure the way I am accessing the vertex is not the right one, anybody knows the best way? here is the code: //Create the 3D geometry - osg::Vec3Array(m*n)); osg::Vec2Array t= *(new osg::Vec2Array(m*n)); osg::Vec4Array col = *(new osg::Vec4Array(1)); col[0][0] = col[0][1] = col[0][2] = col[0][3] = 1.0f; int index = 0; for( i = 0; i m; i++ ) { for(j = 0; j n; j++) { v[index][0] = i; v[index][1] = 0; v[index][2] = j; t[index][0] = (float)i/(m-1); t[index][1] = (float)j/(n-1); index++; } } myGeom = new osg::Geometry; myGeom-setVertexArray( v ); myGeom-setTexCoordArray( 0, t ); myGeom-setColorArray( col ); myGeom-setColorBinding( osg::Geometry::BIND_OVERALL ); for( i = 0; i m-1; i++ ) { osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP); elements-reserve(m*2); for( j = 0; j n; j++ ) { elements-push_back((i+0)*n+j); elements-push_back((i+1)*n+j); } myGeom-addPrimitiveSet(elements); } osg::Texture2D *tex = new osg::Texture2D; tex-setImage(osgDB::readImageFile(Images/breast.png)); osg::StateSet *dstate = new osg::StateSet; dstate-setMode( GL_LIGHTING, osg::StateAttribute::OFF ); dstate-setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON ); dstate-setTextureAttribute(0, new osg::TexEnv ); myGeom-setStateSet( dstate ); osg::Geode *geode = new osg::Geode; geode-addDrawable( myGeom ); --- //Accessing the elements --- osg::Vec3Array *test = dynamic_cast(myGeom-getVertexArray()); for(int i = 0; i numVertex; i++) { NxMat34 pose = listShapes.at(i)-shape-getGlobalPose(); osg::Vec3f trans = osg::Vec3(pose.t.x,pose.t.y,pose.t.z); test-at(i) = trans; } myGeom-dirtyDisplayList(); myGeom-dirtyBound(); thank you very much for your help!!! Crisalix. _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ___ 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] ShadowMap and TEXTURE_COMPARE_MODE
Hello Sebastian, Indeed ... I once spent half a day figuring out that the texture matrix wasn't applied ;-) Hehe, that happens to all of us! Me culpa! ... it was the uniform name. I accidentally added them somewhere else with the PROTECTED-flag. That has also happened to me more often than I'd like to admit... I once spent 3 days debugging why shadows were being done by the fixed pipeline, only to find out that the top node of my graph was getting an empty osg::Program with a PROTECTED flag, but that was so deep down in the framework code that I hadn't found it until I decided to do a complete dump of the graph... So thank you for pointing to the problem! If I want to contribute, how may I submit suggestions/ patches? http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org Note that Robert (project lead, and also the one who merges changes) is on vacation right now, so you might not get a response right now. Also see http://www.openscenegraph.org/projects/osg/wiki/MailingLists/SubmissionsProtocol And also, if your submission is a per-fragment lighting shader for ShadowMap, you might want to either add parameters to control whether per-vertex or per-fragment lighting is applied, or ask Robert about adding the shader to OpenSceneGraph-Data instead... I think for a while now most people will still want per vertex lighting by default. But if the submission is for fixes or other things, go ahead and submit it! I really appreciate your fast and exact response ... saved me some gray hair ;-) My pleasure! J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] VS2008+Collada=Crasch on exit
Hi all. I working in a mixed development environment regarding Windows versions, XP and Vista. I have been using VS2005 for a while, where I have pre-build binaries (osg, collada, etc) build under VS2005 on a XP machine. (The other way around does not work, that is, build in vista and use in XP due to manifestation etc..., also, my XP is a 32bit, and my Vista is a 64Bit, but Im only building in 32bit.) This works fine in VS2005/XP AND in VS2005/Vista. Now when I started to use VS2008 I get into a few problems. Mainly around the dae plugin. When I build the dependencies in VS2008/XP and later use that on my Vista machine, I get a crasch during exit when I try to render a .dae file. In the call stack, it seems that the problem is related to unloading of the collada plugin dll.) I have experienced this before, and then it was related to the global variables that the Collada reader uses. This was fixed by using the dynamically linked version of collada (which required a small patch to the CMakeLists.txt file in the dae plugin in osg). Using exactly the same code/cmakefiles, it now crasches at exit. The only difference is that I switched from VS2005 to VS2008 on all platforms, all code rebuilt. Now, my question is really, how others have experienced the transition from VS2005 to VS2008? and how (if they) manage prebuild binaries between XP and Vista? -- Anders Backman Email:[EMAIL PROTECTED] HPC2N/VRlab Phone:+46 (0)90-786 9936 Umea university Cellular: +46 (0)70-392 64 67 S-901 87 UMEA SWEDEN Fax: +46 90-786 6126 http://www.cs.umu.se/~andersb ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersect() methods in LineSegment (probably others)
I've submitted a change to the submission list. Please take a look and tell me if and how much it affects timing. thanks andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Sébastien Guay Sent: Wednesday, February 06, 2008 11:11 AM To: OpenSceneGraph Users Subject: Re: [osg-users] intersect() methods in LineSegment (probably others) Hello Adrian, :-) only the first version of my kd.tree. latest i still extermly slow with about 700K-800K intersection test per second. there are latest kd-Tree ray check with more than ++ 6M rays per second. www.ompf.org http://www.ompf.org :-) Don't take it personally, I didn't mean it's slow at 100k intersections per second! Remember each application will be different, so you cannot compare 100k in my program to 700-800k in yours. My program probably does more processing between intersection tests than yours, since it traces in a sphere at each vertex and then stores that as vertex attributes in the Spherical Harmonics basis... Your program is just raytracing from the viewpoint and displaying that, which is simpler... And I recently integrated the last version of your kdtree in my application, and it works well... If you have a newer one, you can send it to me if you want... :-) J-S -- __ Jean-Sebastien Guay[EMAIL PROTECTED] 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] performance fbo
Well, let's say that i'm adding like 50 cameras so basically 50 fbos ... But as I currently don't really understand what is the need for fbo, if you're about to copy the texture to an image anyway, can anyone explain it to me ??? I'm also really interested in understanding what is exactly osg doing when it is rendering to an image ... Creating an fbo (with what format for the texture ??), rendering to it, and then copying it to my image ?? thanks On Feb 6, 2:59 pm, Paul Martz [EMAIL PROTECTED] wrote: How many fbos is a lot? Hundreds of BindBuffer calls per frame can not be a good thing, perhaps that explains the performance hit. -Paul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, February 06, 2008 10:42 AM To: [EMAIL PROTECTED] Subject: [osg-users] performance fbo Hi all, I modified the osgprerender example to add a certain number of cameras, doing exactly the same thing as the one thats rendering to a texture, but made them render to a texture that is not used. So in the scene, there is the main viewer, the camera that's doing rtt, and a lot of other cameras doing rtt for nothing. What I've experienced is that by using the fbo implementation, the fps is really lower than the one I get by using any of the other implementation ... You may ask why I'm doing this, but I want to do a lot of rtt saving each render to an image, so I thought that just by modifying the osgprerender example, it would do the trick ... but :( Is there some kind of overhead related to using a lot of fbos compared to another method ?? Thanks all ___ osg-users mailing list [EMAIL PROTECTED] http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.org ___ osg-users mailing list [EMAIL PROTECTED]://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph... ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] generation of file .exe
Hello - OSG can be built statically and so can be run as a single file, without dependence on other .dll files i didnt realise this could be done, any info on how to do it in vs 2008 c++ ?? for example can you still do it if your proggram development is done being linked to the precompiled dll's ? and can you do this and remove the need to install the c++ runtime library's on the traget machine under VS 2008 c++, or do you still have to do that ? thanks for any info Peted ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transparent sphere
Hi All, How can I draw a Transparent sphere? I need to draw a sphere inside a Transparent one. Can anyone tell me how to set the material and color of the Transparent one. Thanks, Ahmed Nawar winmail.dat___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org