Re: [osg-users] Render to FBO and multiSamples
Hi, maybe check code in osgfpdepth example. jp On 26/01/2012 12:13, Aurelien Albert wrote: Hi, I've done all the tests, and they are all ok. May the problem comes from the depth buffer attachment ? When I use : Code: p_camera-attach(osg::Camera::COLOR_BUFFER, p_renderTextureColor, 0, 0, false, 4, 4); p_camera-attach(osg::Camera::DEPTH_BUFFER, p_renderTextureDepth, 0, 0, false, 4, 4); or : p_camera-attach(osg::Camera::COLOR_BUFFER, p_renderTextureColor, 0, 0, false, 4, 4); p_camera-attach(osg::Camera::DEPTH_BUFFER, p_renderTextureDepth); There is black screen, but if I don't attach depth buffer, I got something rendered and no Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..) errors in the console. Here is how I create my textures : Code: // Main color texture p_renderTextureColor = new osg::Texture2D(); p_renderTextureColor-setTextureSize(p_osgViewport-width(), p_osgViewport-height()); p_renderTextureColor-setInternalFormat(GL_RGBA32F_ARB); p_renderTextureColor-setSourceFormat(GL_RGBA); p_renderTextureColor-setSourceType(GL_FLOAT); p_renderTextureColor-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR); p_renderTextureColor-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); p_renderTextureColor-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); p_renderTextureColor-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); p_renderTextureColor-setDataVariance(osg::Object::DYNAMIC); p_renderTextureColor-setUseHardwareMipMapGeneration(false); p_renderTextureColor-setResizeNonPowerOfTwoHint(false); // Main depth texture p_renderTextureDepth = new osg::Texture2D(); p_renderTextureDepth-setTextureSize(p_osgViewport-width(), p_osgViewport-height()); p_renderTextureDepth-setSourceFormat(GL_DEPTH_COMPONENT); p_renderTextureDepth-setSourceType(GL_FLOAT); p_renderTextureDepth-setInternalFormat(GL_DEPTH_COMPONENT32F); p_renderTextureDepth-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR); p_renderTextureDepth-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); p_renderTextureDepth-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); p_renderTextureDepth-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); p_renderTextureDepth-setDataVariance(osg::Object::DYNAMIC); p_renderTextureDepth-setUseHardwareMipMapGeneration(false); p_renderTextureDepth-setResizeNonPowerOfTwoHint(false); Thank you! Cheers, Aurelien[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45036#45036 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Request for input
Hi, On 26/01/2012 20:02, Tim Moore wrote: Btw, the Linux tool oprofile is mentioned later in the thread, but I find the newer tool perf to be more useful. niiice, new tools :) I've used gprof2dot with oprofile before to get a nice graphic view of execution. I see it supports perf too now, yay. http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#linux_perf jp Tim ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Request for input
Hi, On 26/01/2012 01:20, Jason Daly wrote: On 01/25/2012 04:59 PM, Jason Daly wrote: Hi, all, This is a general request to the community for some advice and expertise. This is a bit lengthy, but if you can spare a few minutes to look over this and send along your thoughts, we would really appreciate it. very interesting and thorough investigation. I can't really add anything and unfortunately don't have representative hardware to test on. It would be interesting to see if different bus configs (motherboards/chipsets) make any difference. I also would not rule out the NVidia driver doing silly things. I remember once looking at some of the glue code for the binary blob and seeing TLB flushes that caused a Xenomai kernel to fail ito timing in interesting ways. Have you tried OProfile to get some idea of time spent in the driver? I should also mention that the source code and data sets used in this work can be made available if anyone would like to try these tests on their own hardware. I suggest sending your test apps with your report to NVidia. rgds jp --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Vertex index from primitive index
Hi, I think there is some code in the osgmovie and InteractiveImageHandler that gets vertices and texture coordinates from intersected geometry. jp On 22/01/2012 13:49, Aurelien Albert wrote: Hi, I'm using PolytopeIntersector to handle some picking functionnality. The resturned intersection list contains primitives index, but I need to retrieve corresponding vertices. Is ther any OSG function to get vertices informations (drawable, index...) from a primitive index ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44961#44961 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: wrong ouput from frag shader
Hi, great. OSG can maybe be more intelligent about these mappings, e.g. automatically creating a float texture, but I don't have time to look at it further. jp On 19/01/2012 11:30, wang shuiying wrote: Hi, J.P. Thank you very much, it works under your suggestion! Best regards Shuiying On 01/19/2012 07:39 AM, J.P. Delport wrote: Hi, On 18/01/2012 20:24, wang shuiying wrote: Hi, J.P. the camera isn't rendering to a texture. Yes it is. It is just made for you automatically. FBO renders to a texture and the image is read from this texture when you attach it to the camera. I suggest attaching a texture (to the same buffer component as the image), with the exact formats you require to the camera as well. E.g. _OutputTexture = new osg::TextureRectangle; _OutputTexture-setTextureSize(_TextureWidth, _TextureHeight); _OutputTexture-setInternalFormat(GL_RGBA32F_ARB); _OutputTexture-setSourceFormat(GL_RGBA); _OutputTexture-setSourceType(GL_FLOAT); camera-attach(osg::CameraNode::COLOR_BUFFER, _OutputTexture.get()); camera-attach(osg::CameraNode::COLOR_BUFFER, image); rgds jp In my programme, camera is set to be prerender, render target is FRAME_BUFFER_OBJECT, I attach the camera to an image, in order to get the bufferdata via image. the image data type is allocated as GL_FLOAT. Related setup details are listed below. // renderTarget osg::Camera::RenderTargetImplementation renderTargetImplementation; renderTargetImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; // shader program osg::Program * program = new osg::Program(); program-addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, fragmentShaderPath)); program-addShader(osg::Shader::readShaderFile(osg::Shader::VERTEX, vertexShaderPath)); // image osg::Image * image = new osg::Image(); image-allocateImage((int)XRes, (int)YRes, 1, GL_RGBA, GL_FLOAT); //camera osg::ref_ptrosg::CameraNode camera(new osg::CameraNode()); camera-setProjectionMatrixAsFrustum(-tan(YawView * math::D2R * 0.5), tan(YawView * math::D2R * 0.5), -tan(PitchView * math::D2R * 0.5), tan(PitchView * math::D2R * 0.5),zNear, zFar); camera-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); camera-setViewport(0, 0, XRes, YRes); camera-setClearColor(osg::Vec4(1000.0f, 1000.0f, 1000.0f, 1000.0f)); camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera-setViewMatrix(osg::Matrix::lookAt(osg::Vec3d(0, 0, 1.0f), osg::Vec3d(-10.0f, 0.0f, 0), osg::Vec3d(0, 0, 1))); camera-setRenderOrder(osg::CameraNode::PRE_RENDER); camera-setRenderTargetImplementation(renderTargetImplementation); camera-attach(osg::CameraNode::COLOR_BUFFER, image); //read out data osg::Vec4f * rgbaData = (osg::Vec4f *) (image-data()); for (int h = 0; h yRes; h++) { for (int w = 0; w xRes; w++) { osg::Vec4f cur = rgbaData[xRes * h + w]; coutcur[0]=cur[0],cur[1]=cur[1],cur[2]=cur[2],cur[3]=cur[3]endl; } } Thank you for any advice! Shuiying Message: 3 Date: Wed, 18 Jan 2012 09:11:15 +0200 From: J.P. Delportjpdelp...@csir.co.za To: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Subject: Re: [osg-users] Help: wrong ouput from frag shader. Message-ID:4f167093.8090...@csir.co.za Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, what format is the texture you are rendering to? If it is UNSIGNED CHAR then your data would be discretised. e.g. 45/255 = 0.176471 jp On 17/01/2012 21:11, wang shuiying wrote: Hello, when I write gl_FragColor = vec4(0.174977,0,0,1) in Frag shader, then I get through a related image: float Vec4: (0.176471,0,0,1) so why 0.174977 changed into 0.176471? I think there should be no process there after per fragment operations that can change this element in the rendering pipeline. Blend, alphatest and so on are all disenabled. Thank you in advance! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: wrong ouput from frag shader
Hi, On 18/01/2012 20:24, wang shuiying wrote: Hi, J.P. the camera isn't rendering to a texture. Yes it is. It is just made for you automatically. FBO renders to a texture and the image is read from this texture when you attach it to the camera. I suggest attaching a texture (to the same buffer component as the image), with the exact formats you require to the camera as well. E.g. _OutputTexture = new osg::TextureRectangle; _OutputTexture-setTextureSize(_TextureWidth, _TextureHeight); _OutputTexture-setInternalFormat(GL_RGBA32F_ARB); _OutputTexture-setSourceFormat(GL_RGBA); _OutputTexture-setSourceType(GL_FLOAT); camera-attach(osg::CameraNode::COLOR_BUFFER, _OutputTexture.get()); camera-attach(osg::CameraNode::COLOR_BUFFER, image); rgds jp In my programme, camera is set to be prerender, render target is FRAME_BUFFER_OBJECT, I attach the camera to an image, in order to get the bufferdata via image. the image data type is allocated as GL_FLOAT. Related setup details are listed below. // renderTarget osg::Camera::RenderTargetImplementation renderTargetImplementation; renderTargetImplementation = osg::CameraNode::FRAME_BUFFER_OBJECT; // shader program osg::Program * program = new osg::Program(); program-addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, fragmentShaderPath)); program-addShader(osg::Shader::readShaderFile(osg::Shader::VERTEX, vertexShaderPath)); // image osg::Image * image = new osg::Image(); image-allocateImage((int)XRes, (int)YRes, 1, GL_RGBA, GL_FLOAT); //camera osg::ref_ptrosg::CameraNode camera(new osg::CameraNode()); camera-setProjectionMatrixAsFrustum(-tan(YawView * math::D2R * 0.5), tan(YawView * math::D2R * 0.5), -tan(PitchView * math::D2R * 0.5), tan(PitchView * math::D2R * 0.5),zNear, zFar); camera-setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); camera-setViewport(0, 0, XRes, YRes); camera-setClearColor(osg::Vec4(1000.0f, 1000.0f, 1000.0f, 1000.0f)); camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera-setViewMatrix(osg::Matrix::lookAt(osg::Vec3d(0, 0, 1.0f), osg::Vec3d(-10.0f, 0.0f, 0), osg::Vec3d(0, 0, 1))); camera-setRenderOrder(osg::CameraNode::PRE_RENDER); camera-setRenderTargetImplementation(renderTargetImplementation); camera-attach(osg::CameraNode::COLOR_BUFFER, image); //read out data osg::Vec4f * rgbaData = (osg::Vec4f *) (image-data()); for (int h = 0; h yRes; h++) { for (int w = 0; w xRes; w++) { osg::Vec4f cur = rgbaData[xRes * h + w]; coutcur[0]=cur[0],cur[1]=cur[1],cur[2]=cur[2],cur[3]=cur[3]endl; } } Thank you for any advice! Shuiying Message: 3 Date: Wed, 18 Jan 2012 09:11:15 +0200 From: J.P. Delportjpdelp...@csir.co.za To: OpenSceneGraph Usersosg-users@lists.openscenegraph.org Subject: Re: [osg-users] Help: wrong ouput from frag shader. Message-ID:4f167093.8090...@csir.co.za Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hi, what format is the texture you are rendering to? If it is UNSIGNED CHAR then your data would be discretised. e.g. 45/255 = 0.176471 jp On 17/01/2012 21:11, wang shuiying wrote: Hello, when I write gl_FragColor = vec4(0.174977,0,0,1) in Frag shader, then I get through a related image: float Vec4: (0.176471,0,0,1) so why 0.174977 changed into 0.176471? I think there should be no process there after per fragment operations that can change this element in the rendering pipeline. Blend, alphatest and so on are all disenabled. Thank you in advance! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: wrong ouput from frag shader.
Hi, what format is the texture you are rendering to? If it is UNSIGNED CHAR then your data would be discretised. e.g. 45/255 = 0.176471 jp On 17/01/2012 21:11, wang shuiying wrote: Hello, when I write gl_FragColor = vec4(0.174977,0,0,1) in Frag shader, then I get through a related image: float Vec4: (0.176471,0,0,1) so why 0.174977 changed into 0.176471? I think there should be no process there after per fragment operations that can change this element in the rendering pipeline. Blend, alphatest and so on are all disenabled. Thank you in advance! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help:what is openGl shader version 140?
Hi, try without the version and just #extension GL_ARB_texture_rectangle : enable jp On 17/01/2012 20:15, wang shuiying wrote: Hello, my shader compile stage throws out such warnings: 0(8) : warning C7532: global type sampler2DRect requires #version 140 or later 0(8) : warning C: ... or #extension GL_ARB_texture_rectangle : enable and Then I add #version 140 #extension GL_ARB_texture_rectangle : enable at the very head of the shader file, but the warnings remain. So how can I check whether my programm is able to use #version 140 #extension GL_ARB_texture_rectangle : enable ? Thank you very much in advance. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamic surface coloring
Hi, try image-dirty() after you've changed it. It's normally not needed to texture-setImage(image); again. jp On 15/01/2012 11:12, Kevin Williams wrote: As an experiment I have got a single triangle, and applied a list of colours as a texture across it. (I modifed the osgtexture1d example.) [The idea is now to create thin triangles representing each azimuth cell, and update the texture colours on each triangle as measurements become available.] I've been trying to modify the colour list on the fly by changing entries in the image defining the texture, but this change is not rendered. Just for the experiment I included this code in the animate callback: osg::Vec4* dataPtr = (osg::Vec4*)image-data(); dataPtr[0] = osg::Vec4(float(rand())/RAND_MAX,float(rand())/RAND_MAX, float(rand())/RAND_MAX,1); texture-setImage(image); What is the correct way to change textures while running? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44841#44841 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problem with corrupted textures when sharing instances of models loaded from IVE format.
Hi, On 13/01/2012 18:37, Chris Denham wrote: Ah ha, Another interesting experiment doing the round trip from osg to ive and back. e.g. osgconv -O noTexturesInIVEFile cow.osg cow.ive osgconv cow.ive cow2.osg cow2.osg has the same problem and cow.ive, and on comparison on cow.osg and cow2.osg I noticed the image definition has grown an unRefImageDataAfterApply TRUE I get the same texture problem when I load cow2.osg, and it behaves normally again when I set the 'unRefImageDataAfterApply' flag to false. So my guess is that the image data may getting released before the other viewer instance has finished with it? Yes, I think so. See here for changing the unref setting after load: http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/52034 http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/71893 rgds jp Chris Denham -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44816#44816 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamic surface coloring
Hi, On 12/01/2012 19:40, Kevin Williams wrote: Thanks Robert. I'm not sure what you mean with your second suggestion. I don't understand how a vertex has a texture associated with it, and not a triangle? Texture coordinates are always assigned to vertices. A triangle's colour depens on the texture coordinates of its 3 vertices - and then of course the pixels in the texture between these coordinates. In my simple view of trying to color facets of the surface, my understanding is that a texture would have to be applied to a specific facet? This would also mean there is no color interpolation from vertex to vertex? Then make the texture coordinates of all 3 vertices the same. You might have to duplicate vertices then to make sure faces next to each other have separate colours. Interpolated colours might well be good enough if your faces are small. rgds jp Considering shared vertex reduction only, I can't see that the solution from my function can be improved, but I am not sure if, for example, many triangle strips is more efficient for rendering? (Compared to a list of single triangles.) I don't think so, though. Strips are surely just a way of storage reduction. Kind regards Kevin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44787#44787 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgQtBrowser/Widgets white rectangle
Hi all, I've updated to latest OSG svn and have Qt 4.7.4 on Debian 64-bit with NVidia graphics. For both osgQtBrowser and osgQtWidgets I get a white rectangle where the Qt widgets are supposed to be. osgViewerQt works fine. Anyone else seeing this? thanks jp -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: can the fourth element of gl_FragColor be changed by shader?
Hi, On 03/01/2012 15:55, wang shuiying wrote: Hello, In my programme, the fourth element of gl_FragColor is changed by fragment shader to be a random number between 0 and 1. But when I access this element by the corresponding image, the element is always 1. What image are you talking about here? Are you saving an image? How are you accessing the data? What target are you rendering to? An FBO? Normal frame buffer? We are using the fourth channel in FBO as pure data stores, so this should work. jp I got to know that in the rendering pipeline after fragment operation, there should be alpha test and blend and so on. When I turn off all those functions, the fourth element of gl_FragColor, which corresponds to the value of alpha, should not be affected by those tests, right? But it remains to be 1. Is there anybody who can give me some advice on that? I want to make use of the fourth element to record the material index of the objects attached to the camera in question. Thank you in advance! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: can the fourth element of gl_FragColor be changed by shader?
Hi, On 03/01/2012 23:39, wang shuiying wrote: Hello, (1)to J.P. the related source code is as following: // camera and image setup osg::Camera::RenderTargetImplementation renderTargetImplementation; renderTargetImplementation = osg::CameraNode::FRAME_BUFFER; ^ If you want FBO, you probably want FRAME_BUFFER_OBJECT here. osg::Program * program = new osg::Program(); program-addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, fragmentShaderPath)); program-addShader(osg::Shader::readShaderFile(osg::Shader::VERTEX, vertexShaderPath)); osg::Image * image = new osg::Image(); image-allocateImage((int)XRes, (int)YRes, 1, GL_RGBA, GL_FLOAT); osg::ref_ptrosg::CameraNode camera(new osg::CameraNode()); camera-setClearColor(osg::Vec4(1000.0f, 1000.0f, 1000.0f, 1000.0f)); camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera-setRenderOrder(osg::CameraNode::PRE_RENDER); camera-setRenderTargetImplementation(renderTargetImplementation); camera-attach(osg::CameraNode::COLOR_BUFFER, image); OpenGL would happily convert from one render target pixel format on the GPU to another one on the CPU when transferring data. So you must make sure that the formats are what you expect. The easiest way is to attach both a texture and an osg::Image to the camera and explicitly set the internal texture format and data type. See the osgprerender example. You can also inspect the code in RenderStage::runCameraSetUp to see exactly how OSG determines the format of the render target. Also, if you want values outside of [0.0, 1.0] you must attach to osg::CameraNode::COLOR_BUFFER0 and use gl_FragData in your shaders. camera-getOrCreateStateSet()-setAttribute(program, osg::StateAttribute::ON); // access data (only for instance) osg::Vec4f * fragments = (osg::Vec4f *)(image-data()); osg::Vec4f color= distances[10]; float color_a= distances[3]; As can be seen from the source code, I attach an image to the camera, and access data from the image, I am rendering to an FBO. I don't think you are rendering to an FBO with the above code. So would you please give me some advice further? Thank you very much! *(2) to Paul* Refer to (1) of this message, does osg::CameraNode::COLOR_BUFFER imply a RGB or RGBA buffer ? or it doesn't even matter? It does not imply anything. rgds jp Thank you very much ! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] video: editing osgParticle system with dtEntity property editor
Hi, On 16/12/2011 21:45, Martin Scheffler wrote: Hi, here's a video showing the capabilities of the dtEntity property editor: http://www.youtube.com/watch?v=0X0EH3YQmPI Looks really good. Qt and OSG looks like the way forward. The property editor can be used to modify game objects on the fly, add functionality, create hierarchical property structures. The particle component has a number of properties: Mass, AlphaRange, TextureFile and so on. There is an xml file (BaseAssets\Delegates\Particle.xml) that defines the way the property editor handles the editing of these properties: The line [code]colorinput propertyname=ColorRangeMax /[/code] defines that the property named ColorRangeMax should be edited with a color selection dialog. The array properties are configured in this file, too: The xml file defines a prototype property that is to be inserted into the array when the + button is pressed. There is also a group property, which can be used to group properties together, which is useful if you want to combine a number of proeprties into a single array entry. The switch input lets the user choose an entry from a combo box and shows corresponding sub properties. These primitives can be combined to create complex menus. The video shows how the property editor can be used to manage the complex setup of the osg particle system. While not all available functionality of the particle system library is currently editable, there should be no reason why it should not be possible to add these. We are at the planning stages of creating such a dynamic property editor for one of our projects (non-OSG), your design will be a real help. BTW, what are you using for grabbing the video on Windows? rgds jp If you want to check out dtEntity, the homepage is [url]http://dtentity.googlecode.com/[/url]. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44406#44406 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ATI cards and textures issues
Hi, On 09/12/2011 10:19, lucie lemonnier wrote: Hi, Thanks for your reply! I work with an ATI FirePro v8800 on Windows 7. we had endless problems with a FirePro M8900 on one of the newer Dell laptops. Try the changes to OSG I mentioned in the thread link I sent. Good luck, jp Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44303#44303 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Trouble creating an osg::Image for use as a 2D texture
Hi, On 08/12/2011 02:15, michael.a.bo...@l-3com.com wrote: Hello, I am trying to encode some position information in a Texture2D for consumption by a vertex shader. I found a pretty good example in the OSG examples directory of something similar, osgtexture1d and I have successfully implemented the method used there. For your reference, the relevant lines are below. == osgtexture1d.cpp == osg::Image* image = new osg::Image; int noPixels = 1024; image-allocateImage(noPixels,1,1,GL_RGBA,GL_FLOAT); image-setInternalTextureFormat(GL_RGBA); osg::Vec4* dataPtr = (osg::Vec4*)image-data(); (A for loop populating the dataPtr follows, it uses the following syntax) *dataPtr++ = color; == end == I implemented my code as follows and it works. unsigned int tex_size = 2048; positionImage-allocateImage( 2, tex_size, 1, GL_RGBA, GL_FLOAT ); positionImage-setInternalTextureFormat(GL_RGBA32F_ARB); osg::Vec4 *dataPtr = (osg::Vec4*)positionImage-data(); memset(dataPtr, 0, sizeof(osg::Vec4)*2*tex_size); (a for loop follows, it uses the following syntax, it moves in increments of two, basically angles get stored in the second column, positions in the first) dataPtr[ii] = positions[ii / 2]; // this is a vec4 dataPtr[ii + 1] = osg::Vec4( sin(angle), cos(angle), 0., 1.); The problem arises when I want to instance more geometry than a single 1d map can reasonably hold, e.g. 10k. I decided to try and use a 1024 x 512 map to hold the data, with the capacity being 512*512 entities. The implementation looks like this: = begin = const int tex_width = 1024; // [0] = position, angle [1] = sin, cos, 0.0, 1.0 const int tex_height = 512; positionImage-allocateImage( tex_width, tex_height, 1, GL_RGBA, GL_FLOAT ); positionImage-setInternalTextureFormat(GL_RGBA); unsigned char* dataPtr = (unsigned char*)positionImage-data(); //memset(dataPtr, 0, sizeof(osg::Vec4)*tex_width*tex_height); int row_c = 0, col_c = 0; for(unsigned int ii=0; iinumInstances; ++ii) { dataPtr[row_c * tex_width + col_c + 0].set( 1., 0., 0., 1. ); dataPtr[row_c * tex_width + col_c col_c += 2; col_c +=2; // increment column by 2 if(col_c == tex_width) { col_c = 0; ++row_c; } } = end = If I save that image out to a .png file, what emerges looks like this: (Ascii art ahoy!) 1 . . . | (random pixels) |#..#.#.##..#.#.## (etc) 0-1 # is a blue pixel . is a clear pixel What appears to be happening is that the blue pixels line up with the components of the vec4 that I set to be nonzero. So I think that it is interpreting the floats as entire pixels. Clearly, I must be doing something wrong. Does anyone see anything obvious? I'm not sure png supports float pixels. Try tiff. rgds jp Thank you for your assistance. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ATI cards and textures issues
Hi, On 08/12/2011 16:19, lucie lemonnier wrote: Hi, I developed an application that loads textures dynamically. I tested my application with a NVidia card and my application works fine but when I test my application on ATI card, the textures doesn't change. Can you help me? Does anyone have had this problem? Many people have had many issues with poor ATI OpenGL support. You'll have to give some more info - OS, card, etc. Also see here: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2011-July/052968.html If on Windows, try turn off all windows 3D effects and such. rgds jp Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44292#44292 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Running a viewer in a thread other than main thread
Hi, On 06/12/2011 15:01, bart gallet wrote: Hi jp, thanks for your response Must rendering happen in parallel, or just the processing by each agent? That was the plan - I thought this way I can easily swap in/out other agents. OK I see. You can still encapsulate an agent and its little part of the OSG graph. You can consider FBOs and read back to CPU as well. What advantage does an FBO have over a pBuffer? Depends... It can stay on the GPU and you can do some processing there. Output is a texture that you can use in different ways. pBuffer should work with camera nodes in the graph too. Having many viewers means that you have a copy of all scene elements per agent. I cannot share the same scene graph with multiple viewers (i.e. give each viewer a pointer to the same graph)? They have to be separate copies? You can share the graph, but each viewer will create its own graphics context. You can't share OpenGL objects between them then. I'm not sure if you can share contexts between viewers. I know you can share them between views in a composite viewer, or between cameras in the scene. You can use a viewer with as many FBO cameras as you need, these can then share the scene elements. Ok, how do I control each camera? Can I put on the scenegraph under a transform node so that I can use a callback function to control each camera motion? Yes, you can just insert cameras into the main scene graph. For each camera you can control all settings, e.g. projection matrix etc. You attach the shared graph under the cameras. cheers jp If you use FBOs you can just select the texture for the agent you want and place it as a texture on a quad in the main camera. Like the idea Cheers, bart -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44226#44226 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org [/quote] -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] best format for paged database
Hi, you can also check out osgEarth. I like the fact that it can convert data (imagery and terrain) into a tms compatible format (jpg, png, tiff). How you display the data is up to you, you can add shaders to do fancy things per layer if you want. regards jp On 06/12/2011 17:44, Chris 'Xenon' Hanson wrote: On 12/6/2011 2:24 AM, PC John wrote: what is the best file format for paged scene database? The database may be both - small and big (gigabytes) and it may or may not contain geospatial data. Well, generally the only paged formats OSG supports (excepting specialized formats like TerraPage) are its own .OSG/.IVE/.OSGT/.OSGB. .OSG and .IVE are deprecated. .OSGT is text and is slower, which leaves .OSGB as the primary contender. The special requirement is that it should be possible to store non-standard data like reflective color (not present in OpenGL), for instance as a user data. Well, given that this can be stored in the scene graph, it can be stored in the .OSGB format as well. But it is up to you to design the scene graph structure to store, and utilize this data. I was considering to store collision geometry there as well, but this is not the strict requirement. You could store this geometry there too, masked so that it does not render but can be accessed during intersection testing. Thanks in advice, John -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Running a viewer in a thread other than main thread
Hi, On 06/12/2011 23:15, bart gallet wrote: thanks Chris I almost don't dare to ask, but I'll do it anyways, so then I will have come to a full circle :) I'd like to run a viewer for rendering to an FBO in a separate thread, so that it is in the background since it's not for displaying. Will I get into trouble doing this? I think you're at the stage where you must just try and see. Make sure the viewer is created (that creates the GL context) and frame() (that calls GL) is called from the same thread. We do this in one of our apps and it works fine, but we also force the viewer to SingleThreaded mode, so not sure if that's a requirement. rgds jp Thank you! Cheers, bart -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44250#44250 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multipass rendering with different clip planes
Hi, maybe check out the old depth partition example - basically draw a scene with a massive depth range. I think functionality is now somehow integrated into Viewer/View as well. cheers jp On 07/12/2011 03:03, Glenn Waldron wrote: Paul, I don't want to create clip planes in the glClipPlane sense; I was just referring to the automatic near/far calculations that CullVisitor does in order to clamp its projection matrix. Glenn Waldron / @glennwaldron On Tue, Dec 6, 2011 at 5:46 PM, Paul Martz pma...@skew-matrix.com mailto:pma...@skew-matrix.com wrote: Hey Glenn -- Can you just use more than one ClipPlane? GL_CLIP_PLANE0 would be enabled for one scene graph, GL_CLIP_PLANE1 would be enabled for the other. -Paul On 12/6/2011 3:29 PM, Glenn Waldron wrote: Hi folks, I want to render two subgraphs, one after the other, each with its own set of (auto-calculated) clip planes. So render graph A, reset the clip plane calculation, and render graph B in the next pass. I figure it's a 2-Camera setup of some kind but I can't get the setup right. What's the best way to do this? Glenn Waldron / @glennwaldron _ osg-users mailing list osg-users@lists.__openscenegraph.org mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.__org/listinfo.cgi/osg-users-__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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Running a viewer in a thread other than main thread
Hi, On 06/12/2011 04:47, bart gallet wrote: Hi Chris Thanks for your reply. Yeah, it definitely feels like an off-road excursion ;) Last time I used OSG was when you still had to use Performer. I am trying to simulate a bunch of autonomous systems/agents that use cameras to control their actions (they can see each other, the environment, etc.). Each agent runs on a separate thread, and needs to render the scene according to its own point of view. Must rendering happen in parallel, or just the processing by each agent? I have three different rendering requirements: 1) Each agent must render their camera according to their POV at each instant and simultaneously. This rendering must be performed off-screen because their images are meant for processing by each agent's control system and are thus not intended for human eyes. This has not yet been implemented - I was planning on using a viewer in each agent's thread that renders to a pBuffer. You can consider FBOs and read back to CPU as well. Having many viewers means that you have a copy of all scene elements per agent. You can use a viewer with as many FBO cameras as you need, these can then share the scene elements. You can sync the generation of the FBO textures using a concurrent queue per agent. 2) General overview view Display (for human eyes only): Here I want to render the scenery for general visualization where I can chose any vantage point. I have this working, as a viewer in my main thread. 3) Agent view Display (for human eyes only): Here I want to select an agent and see its camera feed. I was thinking of using one viewer here and then when selecting an agent to see its POV, I would slave the viewer's camera with the viewer in the agent's thread - it's here where things are going wrong. If you use FBOs you can just select the texture for the agent you want and place it as a texture on a quad in the main camera. As you correctly inferred, I am a bit lost because I assumed that for each agent's camera view I must instantiate a separate viewer and I was doing this in each agent's thread. If you have any good advice for me, I certainly would greatly appreciate it! One other thing you can try is force the viewer(s) to execute single threaded and see if it makes a difference. rgds jp Cheers, bart -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44226#44226 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] NVIDIA Driver Problem?
Hi, On 29/11/2011 11:34, Robert Osfield wrote: Hi Paul, On 15 November 2011 13:04, Paul Palumbopaul1...@yahoo.com wrote: The probably is evident when the X server is restarted between these calls to create the osgViewer::Viewer. I don't think it matters any if the restart is inside the program or not as long as it happens when no osgViewer::Viewer is active. The only GLX code in osgViewer is in GraphicsWindowX11.cpp and PixelBufferX11.cpp. Each of GraphicsWindowX11 and PixelBufferX11 keep their own local handles to X11 objects and should be cleaning these up when they are closed/destructed, I don't recall any global handles that will need cleaning up. can it have something to do with: static RegisterWindowingSystemInterfaceProxy createWindowingSystemInterfaceProxy; in GraphicsWindowX11? rgds jp Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: Data accuracy from Frame buffer is not very good
Hi, I'd suggest attaching a texture with a GL_RGBA32F_ARB internal format to the camera as well (in addition to the image). I'm not sure you are getting a float FBO. See the osgprerender example with the --hdr switch. jp On 29/11/2011 16:12, wang shuiying wrote: Hallo, I want to simulate laser scanner using osg camera. In Fragment shader the color information is converted into position information. And then the position information is accessed from this Fragment to be used to draw points in a view. But the points are not so accurate, as it is shown in the attached picture, which is composed of 11 cameras. The important codes are: osg::Program * program = new osg::Program(); program-addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, fragmentShaderPath)); program-addShader(osg::Shader::readShaderFile(osg::Shader::VERTEX, vertexShaderPath)); osg::Image * image = new osg::Image(); image-allocateImage(xRes, yRes, 1, GL_RGBA, GL_FLOAT); osg::ref_ptrosg::CameraNode camera(new osg::CameraNode()); camera-setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); camera-setViewport(0, 0, xRes, yRes); camera-setClearColor(osg::Vec4(1000.0f, 1000.0f, 1000.0f, 1000.0f)); camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera-setProjectionMatrixAsFrustum(-tan( viewYaw), tan(viewYaw), -tan(viewPitch), tan(viewPitch), zNear,zFar); camera-setViewMatrix(osg::Matrix::lookAt(osg::Vec3d(0, 0, 1.0f), osg::Vec3d(-10.0f, 0.0f, 0), osg::Vec3d(0, 0, 1))); camera-setRenderOrder(osg::CameraNode::PRE_RENDER); camera-setRenderTargetImplementation(renderTargetImplementation); camera-attach(osg::CameraNode::COLOR_BUFFER, image); camera-getOrCreateStateSet()-setAttribute(program, osg::StateAttribute::ON); In vertex Shader, I write: void main() { x=(gl_ModelViewMatrix * (gl_Vertex - vec4(0.0,0.0,0.0,0.0))).x; y=(gl_ModelViewMatrix * (gl_Vertex - vec4(0.0,0.0,0.0,0.0))).y; z=(gl_ModelViewMatrix * (gl_Vertex - vec4(0.0,0.0,0.0,0.0))).z; gl_Position = ftransform(); } in Fragment shader, I write: gl_FragColor = vec4(abs(z/100),abs(x/17),abs(y/4),0.2); And I when get the position information, I will multiply them with the corresponding factors. However, the points are not that accurate. I seems that the Fragment shader does not calculate the point one by one, but assign a certain value to a certain amount of points. Can anybody give some advice? Thanks in advance! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help: Data accuracy from Frame buffer is not very good
Hi, On 29/11/2011 23:46, wang shuiying wrote: Hello, J.P. Delport I followed your advice but it still doesn't work well. And I also changed the internal format of the Image as GL_RGBA32F_ARB, but the points remain the same. What is the name of the osgprerender example with the --hdr switch ? the example is called osgprerender, look at the code of it. It has a command line switch that enables HDR rendering to texture, but I'm not sure this is your problem anymore. What resolution are you expecting from the FBO and in what range are the vertex data you are using? Are you sure you are not converting to integers somewhere along the line? Are you using the osg::Image at all, or are you using the texture directly? rgds jp Thank you very much ! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] NVIDIA Driver Problem?
Hi, before I go restart X-servers all over the lab, can you give a bit more info... :) On 14/11/2011 20:13, Paul Palumbo wrote: Can somebody do a test for me? I'm using OSG 3.0.0 and this works with NVIDIA Driver (Linux) 260.19.21 but doesn't seem to work with newer versions of the driver (e.g. 275.31 beta) with no other changes being made. I've been in contact with NVIDIA with this problem and they seem to think that it is an OSG problem. I'm having trouble when I create an osgViewer, destroy it, restart the X server and then create the osgViewer. I've boiled my problem down to a small test case in the attached file which is a slightly modified version of osgviewer. I know this test case is somewhat convoluted but bare with me. Our application is required to restart the X server before starting to display an image. Normally, osgviewer would do the following: 1) osgViewer::Viewer viewer(arguments); 2) viewer.setSceneData( loadedModel.get() ); 3) viewer.realize(); 4) viewer.run(); 5) exit(0); I have modified it to do the following: Code: while (forever) { { // Define a scope of the osgViewer::Viewer osgViewer::Viewer viewer(arguments); viewer.setSceneData( loadedModel.get() ); viewer.realize(); viewer.run(); } // osgViewer::Viewer scope has ended and its destructor called. sleep(2); system(“/usr/sbin/gdm-restart”); sleep(20); } Do you have to do the restart from a C++ app? What happens if you manually restart gdm and then start another osg process? It might be some GL resource that is only released when the process exits. Or a windowing system static that OSG assumes is still valid, but is obviously not since the gl driver restarted. I know there was a discussion about static resources when e.g. using OSG as part of a larger library or as a plugin. How does one get OSG into its original state without restarting the process... I can go dig it up if you want. jp Compile and run this program. Since this program restarts the X server (with the gdm-restart command) and attempts to display an image, you will need use two machines (a remote machine and a target machine). Running this using one machine will cause the program to be killed when the X server is restarted. To run this program, do the following: a. On the console of the target machine, login normally. Open a terminal window and type “xhost +” b. From a remote computer login to your target machine and “setenv DISPLAY :0.0” to keep the display on the remote machine. c. From this remote computer window, run the attached version of osgviewer as “osgviewer cow.osg”. d. Hit the escape key on the target machine to dismiss the cow being displayed. e. At this point, the target machine X server will restart. IMMEDIATELY after the X server has restarted, login to the target machine again from its console. Open a terminal window and select “xhost +” again. It you don't do this last part, you will not have permissions to display an image on the target machine from the remote machine. The program will give you 20 second before it attempts to display an image on on the target machine. f. At this point, you should see a cow image on the display but with this new driver, we’ve been seeing a totally black image. When I run this program, instead of seeing the cow image the second time, I'm seeing a black screen. I didn't see this problem with earlier version of the NVIDIA driver (also using OSG 3.0.0). Is anybody else having this problem? Paul P. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43865#43865 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] using view dependent overlays
Hi, see this discussion: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/4260 I can also suggest you use/look at the code of the osgEarth overlay classes, I think it handles the view-dependent overlays a bit better. rgds jp On 11/11/2011 23:36, Blake Mason wrote: I was looking at the example osganimate and I attempted to use the --ortho option which sets the overlay technique to osgSim::OverlayNode::VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY. However, nothing is overlaid when this method is selected. My assumption is that this method should increase the resolution of the overlaid image as the viewer is zooming into the object receiving the overlay. Someone mentioned that J.P.Delport had a patch to fix this method, but I couldn't find any information on it. I also looked in the trunk and didn't see any updates related to this change. -Blake ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CoordinateSystemNode question about Local Coordinate Frame
Hi, I think maybe computeLocalCoordinateFrame just assumes you want a coordinate frame at 0 height. The separate functions convertXYZToLatLongHeight [1] for going from ECEF to LLA and computeLocalToWorldTransformFromLatLongHeight work fine AFAIK. You can also modify the transform so you have XYZ in the local coordinate frame line up with axes you expect. Here's the code we use to create a local North, East, Down transform at a given LLA. --8-- osg::Matrixd getLocalToWorldTransformFromLatLongHeight( const double lat_deg, const double lon_deg, const double alt_m) { osg::Matrixd localToWorld; gEllipsoidModel_-computeLocalToWorldTransformFromLatLongHeight( osg::DegreesToRadians(lat_deg), osg::DegreesToRadians(lon_deg), alt_m, localToWorld); // The coordinate system used by OSG is Z-up, Y-north, X-east // rotate to ours of X-north, Y-east, Z-down. osg::Matrixd makenorth; makenorth.makeRotate(-osg::PI/2.0,osg::Vec3d(0,0,1)); osg::Matrixd makeup; makeup.makeRotate(osg::PI,osg::Vec3d(1,0,0)); return makenorth * makeup * localToWorld; } --8-- jp [1] Note there are 3 coordinate systems involved, local XYZ, ECEF XYZ and LLA. The matrix from getLocalToWorldTransformFromLatLongHeight converts between ECEF and local XYZ. On 08/11/2011 22:20, Scott Wasinger wrote: Hi, I have a task that will require placing a model of launch vehicle in orbit around the earth and I've been delving into the OSG library code so I don't have to re-invent functionality that may already exist. Both the CoordinateSystemNode and the EllipsoidModel classes are well defined and look very promising. But I'm concerned about how some code that computes the local coordinate frame. in CoordinateSystemNode::computeLocalCoordinateFrame Line # 45-61 the variable 'height' doesn't seem to be utilized. Whatever value was returned after calling this Code: _ellipsoidModel-convertXYZToLatLongHeight(position.x(),position.y(),position.z(),latitude, longitude, height); seems not to factor in the height when trying to compute the local to world transform from Latitude, Longitude and Height. Code: _ellipsoidModel-computeLocalToWorldTransformFromLatLongHeight(latitude, longitude, 0.0f, localToWorld); Is this a possible bug or am I missing something important? Thank you!! Scott -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43779#43779 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Independent update/cull traversals for different parts of a scene
Hi, I don't claim this is the ultimate solution, but I've got this piece of hacky code to work around an autotransform limitation when multiple views are present. Maybe you can experiment with it a bit. I think I originally got it from one of the examples that did some manual terrain paging. cheers jp ---8--- // cull to make sure auto transformed objects have sane bounds osg::Camera* camera = view-getCamera(); osgViewer::Renderer* renderer = dynamic_castosgViewer::Renderer*(camera-getRenderer()); if (renderer) { osgUtil::SceneView* sceneView = renderer-getSceneView(0); sceneView-inheritCullSettings(*(sceneView-getCamera())); sceneView-cull(); } ---8--- On 10/11/2011 04:18, Christiansen, Brad wrote: Hi, I am trying to improve the consistency between the rendering of our terrain and the objects that interact with it. What I want to achieve each frame is the following (NB: all objects are under a single camera): 1) Do the update then cull traversal on the terrain. - Doing this first allows the rest of the scene to know exactly what terrain tiles will be used to render the frame. From this I can determine which areas of the terrain have been changed since the last frame so I can limit the intersections I need to do to keep objects on its surface. 2) Do some processing external to the OSG frame loop - At this stage our application will need to process various functions based on underlying terrain that are not directly integrated with OSG. 3) Do the update and cull traversals on the rest of the scene. - The big change in this passes is that during the update traversal the terrain tiles to be rendered is known. This ensure there is no 'frame lag' when placing objects a consistent distance on or above the surface of the terrain. 4) Render the combined result. At the moment I simply call frame on a Viewer instance. My first thought was to use node masks at the top of the terrain and 'the rest of the scene' and simply run the update and cull traversals twice each frame with a different mask. This seems easy to implement for the update traversals but I cannot see how I can easily implement this for the cull traversals as both the cull and rendering passes are implemented by the single ViewerBase::renderingTraversals. Overriding this function to add the functionality I want seems like a rather complex problem to tackle. Is there another, easier way, to get the results I want? Cheers, Brad - DISCLAIMER: This e-mail transmission and any documents, files and previous e-mail messages attached to it are private and confidential. They may contain proprietary or copyright material or information that is subject to legal professional privilege. They are for the use of the intended recipient only. Any unauthorised viewing, use, disclosure, copying, alteration, storage or distribution of, or reliance on, this message is strictly prohibited. No part may be reproduced, adapted or transmitted without the written permission of the owner. If you have received this transmission in error, or are not an authorised recipient, please immediately notify the sender by return email, delete this message and all copies from your e-mail system, and destroy any printed copies. Receipt by anyone other than the intended recipient should not be deemed a waiver of any privilege or protection. Thales Australia does not warrant or represent that this e-mail or any documents, files and previous e-mail messages attached are error or virus free. - ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg::Image pixel format conversion
Hi, is the image coming from the GPU? If so, you can let OpenGL convert it for you on the way to CPU if you don't mind too much about transfer speed. Also, double check the image writing code if a certain format does not support BGRA. jp On 01/11/2011 02:40, Blake Mason wrote: I have a osg::image with pixel format of GL_BGRA. I need to convert it to GL_RGB so that I can write out any generic type of image with osgDB (i.e., jpg, png, tiff, etc). Is there an easy way to convert the _data in the image to be in some other format? I could obviously do this myself with a simple loop, but I wanted to see if there was a simple OSG way. writeImageFile is still commented out in the osgscreencapture.cpp example, and I wonder if it's a similar problem. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] 3D models used in OSG ?
Hi Ryan, On 31/10/2011 23:48, Ryan Pavlik wrote: My workflow for simple applications is: Create/find models in Google SketchUp (the 3D warehouse is very useful). Export to OSG - https://github.com/rpavlik/sketchupToOSG - this works even with the free SketchUp by automating the export to COLLADA and conversion to OSG. wow, first time I've heard of this. Nice work. jp Ryan On Fri, Oct 28, 2011 at 2:37 PM, Maia Randria veneree.randrianari...@crulrg.ulaval.ca mailto:veneree.randrianari...@crulrg.ulaval.ca wrote: Hello, Thank you so much for all these helpful advices. I really appreciate that. I already bought the e-book of Rui and started to look into it. I read also the book of Paul Martz. Great books. My concern is about the time required for the development of a VR application with OSG +VR Juggler (we are going to have a CAVE for neuroscience research) compared to high-level-based engines like Virtools or Vizard of WorldViz. I dont' know if you know both of them ? I am evaluating these software in order to decide which one(s) could fit for our needs. Thanks again, Maia John Richardson wrote: Hello, The real question is how do you import models from commercial and open source packages into OSG and support for animations, Others can chime in technically on this... Yes, it does take artistic talent. However, your email is from Université Laval. So you have a perfect solution. Collaborate with the art department. However, I will give a synopsis of my process. I am not an artist. 0) The first step is buying the Wang Rui book on OSG. 1) Acquire Blender. 2) Acquire one or more commercial systems with large numbers of example models with an acceptable reuse license. Note: If your university has various numbers of 3-D modeling and animation systems take their various and sundry examples and export to VRML or COLLADA. Then examine their other export formats [File -- Export or whatever menu item does the trick]. The best of the proprietary formats are 3DS, LWO, OBJ. Now, when I say best or talk about VRML / X3D / COLLADA, I am talking about the file interoperability problem. These comments are just my philosophical workaround. So, now you have a lot of scene components. Either arrange them in your modeler of choice [originally before export with an artist] or import the exported examples and arrange them [you don't need an artist since I can do this]. I suggest that you give them useful names and if possible, give them useful names at the nodes that you may be interested in accessing via OSG for your simulations. There is no more advice I can give at this point on naming. The Web3D people tried with the H-Anim standard and other profiles to X3D [See the Poser character animation system if the university has one]. The problem domain is huge and nobody seem to be able to make train loads of money on the solution so there is no satisfactory solution. 3) Turn your yourself or your programmer collaborators loose on the OSG coding for import and scene manipulation. The coders should know the process for compiling/downloading. You already know how to access this list for advice. Also, note that there are lots of contributors to this list that can code if you have funding available [Guay, Hanson, Martz, Cigar, Osfield,insert name I left out here,...]. If your goal involves students, then I suggest that you approach the issue from a architectural perspective. There are a lot of architectural programs in the USD 50-150 range that export to VRML and probably 3DS and OBJ/LWO/DXF. These can be acquired at almost every Apple Store for the Mac and every Best Buy or Fry's or whatever giant Canadian electronics superstore is in your area for the PC [and possibly for the Mac] [Punch!;TurboCAD;...]. A nice city block or representation of Université Laval would be a starting point. Then just see if you can get a traffic or pedestrian simulation completed. This strategy is like using the iPhone's Siri [or Google Voice] as opposed to Dragon Naturally Speaking. The learning curve is a little bit easier. But DO NOT FORGET BLENDER [relatively steep learning curve]. The students need a portfolio. John F. Richardson -Original Message- From: [mailto:] On Behalf Of Maia Randria Sent: Thursday, October 27, 2011 12:26 PM To: Subject: 3D models used in OSG ? Hi, First, I am sorry if my questions seem naive, I am really a newbie in OSG/3D. My question is about the 3D models used by both of you in OSG: - do you create your own 3D models yourselves with OSG ? - or with other
Re: [osg-users] how to make gl_Color.a changeble through programmable fragment shader?
Hi, look at some of the code paths in osgprerender for where it uses float data and see if that works for you. jp On 27/10/2011 12:17, wang shuiying wrote: Hi, Robert Thank you for your reply. Sorry that I don't think I expressed my problem clearly. I want to simulate radar using osg camera. The important codes are: osg::Program * program = new osg::Program(); program-addShader(osg::Shader::readShaderFile(osg::Shader::FRAGMENT, fragmentShaderPath)); program-addShader(osg::Shader::readShaderFile(osg::Shader::VERTEX, vertexShaderPath)); osg::Image * image = new osg::Image(); image-allocateImage(xRes, yRes, 1, GL_RGBA, GL_FLOAT); osg::ref_ptrosg::CameraNode camera(new osg::CameraNode()); camera-setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); camera-setViewport(0, 0, xRes, yRes); camera-setClearColor(osg::Vec4(1000.0f, 1000.0f, 1000.0f, 1000.0f)); camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera-setProjectionMatrixAsFrustum(-tan( viewYaw), tan(viewYaw), -tan(viewPitch), tan(viewPitch), zNear,zFar); camera-setViewMatrix(osg::Matrix::lookAt(osg::Vec3d(0, 0, 1.0f), osg::Vec3d(-10.0f, 0.0f, 0), osg::Vec3d(0, 0, 1))); camera-setRenderOrder(osg::CameraNode::PRE_RENDER); camera-setRenderTargetImplementation(renderTargetImplementation); camera-attach(osg::CameraNode::COLOR_BUFFER, image); camera-getOrCreateStateSet()-setAttribute(program, osg::StateAttribute::ON); in Fragment shader, I write, e.g: gl_FragColor = vec4(0.1,0.2,0.3,0.5); when I get the four elements through image attached to the camera, the first three elements are just as expected to be 0.1,0.2,0.3 respectively, but the fourth element is 1. No matter what value I assign to the fourth element, it keeps to be 1. I cannot figure out why this happens. So does it still have something do do with graphics context when it comes to Pre-render camera? Thank you very much! Shuiying ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] transparency is hard! Drawing order of drawables inside a Geode?
Hi, On 27/10/2011 11:17, Christian Buchner wrote: Regardless which render bin order you're using, the order of the rendered triangles in a transparent object is still wrong, but there even isn't a right rendering order for triangles, because the ordering has to happen on fragment level. For simple convex objects like cylinders, spheres, boxes the trick with back face culling can be applied safely if they don't intersect :) cheers jp - unless OSG decides to change the render order to minimize state changes (which is what is happening in my case) I am a bit worried that advanced methods like depth peeling won't integrate that easily with my existing scene graph. I will check. Christian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Suggestion for Cuda + OSG, smooth particle hydrodynamic
Hi, On 23/10/2011 04:25, brian tse wrote: Hi, I am very new to CUDA and OSG, please accept my apologies if this is a stupid questions. I am trying to build SPH algorithm using Cuda to calculate the particle forces and update its position. I would like to ask is there a way in Cuda to pass the position array to OSG without doing a cudaMemcpyDeviceToHost operation on every loop? Is there some special function in OSG that directly integrated into CUDA? I'm quite sure there is no such function in plain OSG. You can have a look at osgPPU or osgCompute node kits that allows one to pass data between OSG/CUDA. I've only used the texture passing functions, but you should look for code that passes VBOs between CUDA/OSG. Consult the CUDA docs on the sections about OpenGL interop. I have a CPU loop for CUDA kernel, and I have another CPU loop for OSG. When the OSG need the graphics update, it send a flag to CUDA reqesting for new position array. Is this the right way to do it? You should be able to avoid copy to host. Let CUDA update the VBO that OSG then uses. The synchronisation might be an issue, that's why it might be better to use cuda inside the scene graph. cheers jp Thank you very much in advance. I really appreciate your effort. Cheers, Brian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43510#43510 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ 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 do masking out some part of my terrain? Is that possible?
Hi, I know osgEarth has a stencilling technique for drawing vector overlays. Maybe you can have a look at how they do it. Their site has reference to a research paper for the technique too. http://www.osgearth.org/wiki/TileSourcePluginModelFeatureStencil regards jp On 20/10/2011 09:21, Atilla Selem wrote: S2LR wrote: You may need to resort to a shader to get the desired effect... -Shayne Hi Shayne, What should i do in order to apply a shader to myTerrain.ive node? What i need? Where should i start? Could you please write the steps needed to get the desired effect?.. Thanks a lot.. Atilla. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43466#43466 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG question on asynchronous texture readback
Hi, the GPURegionOfInterestCallback does not do async read at the moment, but you can have a look at the osgscreencapture example. Specifically check the code path for the --double-pbo command line option. Also see this page, it has the best explanation of async pbo I've come across. http://www.songho.ca/opengl/gl_pbo.html Getting data from GPU to CPU is still a bottleneck for many apps, make sure you send back as little as possible. cheers jp On 19/10/2011 19:13, Poirier, Guillaume wrote: Hello J-P, I saw on the OSG forum archives your GPURegionOfInterestCallback code. Can it provide asynchronous GPU - CPU readback ? I don't know much about PBO and I currently does the readback by simply attaching an image to my RTT camera, however it slows down the application significantly. Can you show an example of how to use the GPURegionOfInterestCallback ? cheers, guillaume -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader
Hi Aurelien, I'm not sure how to get you manual method working. It might have to do with multiple contexts? How are you running the shader? In pre-render pass? If so, you'll have to make sure the cuda code also executes in the pre-render stage. All I can add is that I'm mixing GLSL passes and osgCuda passes (with some GLSL after cuda and some before) currently and it works. See here too: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/71276 cheers jp On 14/10/2011 18:37, Aurelien Albert wrote: Hi, I'm working on the port of a OpenGL / Cuda application to OSG / osgCuda. (OSG 3.0.1 with osgCuda from trunk) One of our class use Cuda to compute a buffer and then : - copy this buffer to a texture buffer (using cudaMemcpy) - bind this texture to a texture unit (using glBindTexture) - use this texture unit in a shader I'm trying to do the same using OSG / osgCuda. I don't use Computation classes for the moment, because we need a lot of time to port our Cuda code architecture to osgCuda. So, we do : - create an osgCuda::Texture2D as follow (our computed Cuda buffer contains float3 data) : Code: osg::ref_ptrosgCuda::Texture2D pCudaTexture = new osgCuda::Texture2D(); pCudaTexture-setDataVariance(osg::Object::DYNAMIC); pCudaTexture-setNumMipmapLevels(0); pCudaTexture-setUseHardwareMipMapGeneration(false); pCudaTexture-setFilter(osg::Texture::MIN_FILTER , osg::Texture::LINEAR); pCudaTexture-setFilter(osg::Texture::MAG_FILTER , osg::Texture::LINEAR); pCudaTexture-setResizeNonPowerOfTwoHint(false); pCudaTexture-setWrap(osg::Texture::WRAP_R, osg::Texture::REPEAT); pCudaTexture-setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT); pCudaTexture-setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT); pCudaTexture-setInternalFormat(GL_RGB32F_ARB); pCudaTexture-setSourceFormat(GL_RGB); pCudaTexture-setSourceType(GL_FLOAT); pCudaTexture-setTextureSize(m_width, m_height); pCudaTexture-setUsage(osgCompute::GL_TARGET_COMPUTE_TARGET); - use this texture as a StateAttribute : Code: pNode-getOrCreateStateSet()-setTextureAttribute(0, pCudaTexture, osg::StateAttribute::ON); Then before rendering each frame : - call our Cuda code, which fill a Cuda buffer = this part is working - copy this buffer to the osgCuda::Texture2D : (dSourceCuda is a pointer to our computed Cuda buffer) Code: osgCompute::Memory* pMemory = pCudaTexture-getMemory(); void* dDestCuda = pMemory-map(); CUDA_SAFE_CALL( cudaMemcpy(dDestCuda, dSourceCuda, size, cudaMemcpyDeviceToDevice) ); pMemory-unmap(); This part seems to work : if we write the content of dSourceCuda buffer and dDestCuda buffer to a file, the data are identical and computed correctly by our Cuda code. But the texture unit seems to always have 0.0 values : when we have a look to our textureUnit with GDebugger, it always contains only 0.0 values. Is there any way to use the content of our computed Cuda buffer into a texture unit ? Regards, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43419#43419 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader
Hi, On 17/10/2011 15:26, Aurelien Albert wrote: Hi, The Shader is executed as a normal osg shader program : by setting it on the node stateset. The Cuda code is executed before any rendering (before the pViewer-frame() call) By diggging in the osgCuda code source, it seems like cudaGraphicsMapResources and cudaGraphicsGLRegisterImage functions are never called... I know these are called in my app (at least for GL_TARGET_DEVICE_SOURCE), because I've traced through the code when it executed. AFAIK it normally happens in the map() call. You can check out this example I've made. It uses the output texture of the cuda pass to display on a rect. If you set a shader on the rect it should work too. http://code.google.com/p/flitr/source/browse/#svn%2Ftrunk%2Fexamples%2Fcuda_auto_contrast Maybe you can trace through this and see what is different between the example and your code. cheers jp -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43432#43432 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader
Hi, I think search in the osgCuda code for Memcpy2D. I think the cuda shadow buffer that osgCuda makes is copied to the texture in the unmap(). There is possibly some other things like updating the texture dirty count as well so that OSG knows the texture has been changed. I'm sorry I can't help more, I've not used osgCuda in the manual way that you are trying. jp On 17/10/2011 15:37, Aurelien Albert wrote: To be more specific, I just need one function : copyCudaBufferToOsgTexture I thought osgCuda provide it, and I hope this is the first step for me before a complete migration from hand-made Cuda to osgCuda code. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43434#43434 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT and new color_buffer binding per frame.
Hi Alexej Sergey, also note that if you only want to change a texture attachment and the formats and sizes stay the same, you can in the cull callback change it. Like so: void KeepHistoryPass::CameraCullCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::Camera* fboCam = dynamic_castosg::Camera*( node ); osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if (fboCam cv !hp_-FirstPass_) { osg::FrameBufferObject* fbo = cv-getCurrentRenderBin()-getStage()-getFrameBufferObject(); if (fbo) { fbo-setAttachment(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER), osg::FrameBufferAttachment(hp_-OutTextures_[hp_-OverwriteIndex_].get())); } } traverse(node, nv); } cheers jp On 11/10/2011 17:32, Alexej Fink wrote: Hi hybr, yes, it works now! I was already on finding out, how can I change RenderStage::_cameraRequiresSetUp per frame. You've shorten this a lot! Many thanks for your help!!! Cheers, Alexej -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43316#43316 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgCompute] Render order
Hi, I want to mix some FBO pre-render cameras and osgCuda. Basically I need to do the following in a single frame: - do some FBO rendering - some cuda ops - again some FBO rendering - some cuda ops - again some FBO rendering For each cuda ops part I have a Computation node. Ideally I'd like to let the order be determined just by the order I've attached the nodes to a common parent node (this works for pre-render FBO cameras), but Computation creates render bins and no matter in what order I attach things (I've tried Computation with and without children) the order of my operations is wrong. Because I'm doing FBO rendering I want the cuda ops to be done in the render traversal too, i.e. I cannot do it in update traversal. Is there a way I can let Computation happen in the render traversal, but without it changing bins? thanks jp -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VBO Bug ?
Hi, On 12/10/2011 15:55, Wojciech Lewandowski wrote: Could you guys check if this problem also happens in other systems ? I'm getting the good result. Debian Sid 64-bit Nvidia Quadro 2000M Driver 280.13 jp -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] Render order
Hi, reply to self... On 12/10/2011 16:45, J.P. Delport wrote: Hi, I want to mix some FBO pre-render cameras and osgCuda. Basically I need to do the following in a single frame: - do some FBO rendering - some cuda ops - again some FBO rendering - some cuda ops - again some FBO rendering For each cuda ops part I have a Computation node. Ideally I'd like to let the order be determined just by the order I've attached the nodes to a common parent node (this works for pre-render FBO cameras), but Computation creates render bins and no matter in what order I attach things (I've tried Computation with and without children) the order of my operations is wrong. Because I'm doing FBO rendering I want the cuda ops to be done in the render traversal too, i.e. I cannot do it in update traversal. Is there a way I can let Computation happen in the render traversal, but without it changing bins? I fixed it by placing the Computation node under a dummy FBO camera. Now all computation happens in pre-render stage and in right order. jp thanks jp -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VBO Bug ?
Hi, On 12/10/2011 18:45, Wojciech Lewandowski wrote: So if you are on Linux and have a minute please let me know how the test passed on your machine ;-) tested on two more for you, both Debian 32-bit. 1: dual nvidia GTS250s, driver 270.41.19, good result across 4 screens. 2: nvidia 9600GT, driver 280.13, good result on single screen. cheers jp -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] FBO RTT - CUDA Kernel - FBO RTT Setup
Hi, On 07/10/2011 17:32, Conan Doyle wrote: I went to the link for the cuda_auto_contrast example... looks like it is part of flitr(?)... do I have to build all of flitr to build this cuda example? you only have to build it if you want a running example. Alternatively you can just study the code to see how an FBO texture is passed into osgCuda. jp CD J.P. Delport wrote: Hi, On 05/10/2011 22:23, Conan Doyle wrote: Hi, My schedule lightened up a bit... I have an extra 24 hours to work on my osg/cuda problem, so I would like to incorporate CUDA into osg the correct way, which I think may be osgCUDA. Here's what I am currently doing Step 1 App renders scene to a FLOAT texture via a FBO/RTT camera Step 2 This texture is used as input to a shader on a second pass/RTT camera. The shader does some calibration stuff then renders it to a full screen quad. Step 3 Final render pass renders quad from step 2. Here's what I NEED to do... Step 1.5 Pass texture from Step 1 to a cuda kernel for processing before the calibration pass (Step 2) Questions: 1. Is this something I can use osgCUDA to do? 2. Would it be similar to the osgTexDemo? 3. Can I use an FBO, or do I have to switch to a PBO RTT? 1. Absolutely 2. Not sure, but I will forward you an example from the osgCuda devs too. I can also point you to one of our examples that does something similar. See the code here: http://code.google.com/p/flitr/source/browse/#svn%2Ftrunk%2Fexamples%2Fcuda_auto_contrast In the above example all you have to change is to place shader passes before or after the cuda pass. E.g. take the glsl_shader example and just change the texture types to osgCuda::TextureRectangle. 3. FBO is OK. CUDA 4.0 is not necessary but would be cool as I have to use it eventually, but to get past this proof of principal step I can use 3.2... or 2.3... CUDA 4.0 works fine and then you can play with Thrust too :) cheers jp CD Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43220#43220 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43257#43257 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] FBO RTT - CUDA Kernel - FBO RTT Setup
Hi Conan, be sure to update to the latest revision of flitr and osgCuda. There has been some fixes (very recent) for the proper handling of cudaMallocPitch allocated arrays. The example should be able to read any movie file that FFmpeg can consume. It would even consume single .jpg/.png image files too. The example will convert any input to grayscale. If you still get weird tearing, try making a 1024x1024 image and see what that does. HTH jp On 10/10/2011 16:19, Conan Doyle wrote: I finally got everything built and running... one more question... What type of video format does the cuda_auto_contrast example takes as input. I had an avi (not sure of any specfics) on my machine and the example read it and display it (as far as I could tell) but it was scrolling in a funky way other wierness... CD J.P. Delport wrote: Hi, On 07/10/2011 17:32, Conan Doyle wrote: I went to the link for the cuda_auto_contrast example... looks like it is part of flitr(?)... do I have to build all of flitr to build this cuda example? you only have to build it if you want a running example. Alternatively you can just study the code to see how an FBO texture is passed into osgCuda. jp CD J.P. Delport wrote: Hi, On 05/10/2011 22:23, Conan Doyle wrote: Hi, My schedule lightened up a bit... I have an extra 24 hours to work on my osg/cuda problem, so I would like to incorporate CUDA into osg the correct way, which I think may be osgCUDA. Here's what I am currently doing Step 1 App renders scene to a FLOAT texture via a FBO/RTT camera Step 2 This texture is used as input to a shader on a second pass/RTT camera. The shader does some calibration stuff then renders it to a full screen quad. Step 3 Final render pass renders quad from step 2. Here's what I NEED to do... Step 1.5 Pass texture from Step 1 to a cuda kernel for processing before the calibration pass (Step 2) Questions: 1. Is this something I can use osgCUDA to do? 2. Would it be similar to the osgTexDemo? 3. Can I use an FBO, or do I have to switch to a PBO RTT? 1. Absolutely 2. Not sure, but I will forward you an example from the osgCuda devs too. I can also point you to one of our examples that does something similar. See the code here: http://code.google.com/p/flitr/source/browse/#svn%2Ftrunk%2Fexamples%2Fcuda_auto_contrast In the above example all you have to change is to place shader passes before or after the cuda pass. E.g. take the glsl_shader example and just change the texture types to osgCuda::TextureRectangle. 3. FBO is OK. CUDA 4.0 is not necessary but would be cool as I have to use it eventually, but to get past this proof of principal step I can use 3.2... or 2.3... CUDA 4.0 works fine and then you can play with Thrust too :) cheers jp CD Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43220#43220 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43257#43257 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43298#43298 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za
Re: [osg-users] [osgCompute] cudaMemcpy2D inconsistency
Hi Jens, On 07/10/2011 13:02, Jens Orthmann wrote: Thank you very much J.P.. We simply have overseen it. We have changed the implementation of osgCuda::TextureMemory::setup() in the current SVN version according to your correct implementation. thanks jp Great work! Best regards, Jens -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43249#43249 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] retrieve texture id
Hi, On 07/10/2011 15:17, Conan Doyle wrote: The CUDA Examples built fine. I built OSG with 4.4.0 The core of osgCompute built but the examples didn't. make sure you checked out the data part of osgCompute as well. cheers jp I'll collect the error messages and post them later this AM CD J.P. Delport wrote: Hi, pls send the error message s you are getting. Also pls send output of gcc -v and g++ -v. Did you build the CUDA examples that came with 4.0? What did you build OSG with? jp On 06/10/2011 23:16, Conan Doyle wrote: Things are moving along nicely, until I tried to build osgCompute with CUDA 4.0 and gcc44. It appears that some thing is getting pulled from gcc 4.1.2 tree in the build process. I set an alias for gcc/g++ to point to gcc44 and g++44, as well as exported CC/CXX to point to these versions... Sounds like maybe I am missing something on selecting the desired version of gcc. I made all of the changes in the CMake files to point to the correct version of cuda, and check it thrice. Any suggetsion? CD J.P. Delport wrote: Hi, I've just recently compiled osgCuda with CUDA 4.0 on 64-bit with gcc/g++ 4.4 (which is a requirement for nvcc). I had to make only minor changes and most of these are already checked into the trunk of osgCuda. See thread here: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/71107 cheers jp On 05/10/2011 15:10, Conan Doyle wrote: 64 bit. I modified this post after your reply to say that I am using Cuda 4.0, which is a requirement. I have a feeling there may need to be some mods made to osgCuda to support 4.0. CD J.P. Delport wrote: Hi, I think it should work, 32/64 bit? What compiler do you have? If you supply some error messages maybe someone can help. cheers jp On 05/10/2011 14:58, Conan Doyle wrote: osgCuda was my first choice, but I will not compile on my machine. I am using OSG 3.0.1 and the SVN version of osgCuda, on RHEL 5.4. Is that a workable combination? CD J.P. Delport wrote: Hi, an alternative to doing this manually would be to look at osgCompute/osgCuda. Even if you don't use osgCuda you can learn from there how to do what you want. cheers jp On 05/10/2011 01:28, Conan Doyle wrote: Hi, [dumbquestion] I am integrating some cuda into my osg app and one call requires the texture name/id. How do I get that from my texture object? I look through the source code and only found and id method in TextureObject, but my attempts to retrieive this bit of data eludes me. [/dumbquestion] Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43179#43179 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43201#43201 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43205#43205 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated
Re: [osg-users] retrieve texture id
Hi, On 07/10/2011 15:29, Conan Doyle wrote: I do have that checked out... is it required for the build? I remember at some stage some examples needed things in the data checkout. Not sure for latest trunk version though. Also, I had some issues building this on Windows (Win7 64 bit, Visual Studio 2008). Is that supported? Not sure. jp CD J.P. Delport wrote: Hi, On 07/10/2011 15:17, Conan Doyle wrote: The CUDA Examples built fine. I built OSG with 4.4.0 The core of osgCompute built but the examples didn't. make sure you checked out the data part of osgCompute as well. cheers jp I'll collect the error messages and post them later this AM CD J.P. Delport wrote: Hi, pls send the error message s you are getting. Also pls send output of gcc -v and g++ -v. Did you build the CUDA examples that came with 4.0? What did you build OSG with? jp On 06/10/2011 23:16, Conan Doyle wrote: Things are moving along nicely, until I tried to build osgCompute with CUDA 4.0 and gcc44. It appears that some thing is getting pulled from gcc 4.1.2 tree in the build process. I set an alias for gcc/g++ to point to gcc44 and g++44, as well as exported CC/CXX to point to these versions... Sounds like maybe I am missing something on selecting the desired version of gcc. I made all of the changes in the CMake files to point to the correct version of cuda, and check it thrice. Any suggetsion? CD J.P. Delport wrote: Hi, I've just recently compiled osgCuda with CUDA 4.0 on 64-bit with gcc/g++ 4.4 (which is a requirement for nvcc). I had to make only minor changes and most of these are already checked into the trunk of osgCuda. See thread here: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/71107 cheers jp On 05/10/2011 15:10, Conan Doyle wrote: 64 bit. I modified this post after your reply to say that I am using Cuda 4.0, which is a requirement. I have a feeling there may need to be some mods made to osgCuda to support 4.0. CD J.P. Delport wrote: Hi, I think it should work, 32/64 bit? What compiler do you have? If you supply some error messages maybe someone can help. cheers jp On 05/10/2011 14:58, Conan Doyle wrote: osgCuda was my first choice, but I will not compile on my machine. I am using OSG 3.0.1 and the SVN version of osgCuda, on RHEL 5.4. Is that a workable combination? CD J.P. Delport wrote: Hi, an alternative to doing this manually would be to look at osgCompute/osgCuda. Even if you don't use osgCuda you can learn from there how to do what you want. cheers jp On 05/10/2011 01:28, Conan Doyle wrote: Hi, [dumbquestion] I am integrating some cuda into my osg app and one call requires the texture name/id. How do I get that from my texture object? I look through the source code and only found and id method in TextureObject, but my attempts to retrieive this bit of data eludes me. [/dumbquestion] Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43179#43179 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43201#43201 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43205#43205 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF
Re: [osg-users] retrieve texture id
Hi, I've just recently compiled osgCuda with CUDA 4.0 on 64-bit with gcc/g++ 4.4 (which is a requirement for nvcc). I had to make only minor changes and most of these are already checked into the trunk of osgCuda. See thread here: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/71107 cheers jp On 05/10/2011 15:10, Conan Doyle wrote: 64 bit. I modified this post after your reply to say that I am using Cuda 4.0, which is a requirement. I have a feeling there may need to be some mods made to osgCuda to support 4.0. CD J.P. Delport wrote: Hi, I think it should work, 32/64 bit? What compiler do you have? If you supply some error messages maybe someone can help. cheers jp On 05/10/2011 14:58, Conan Doyle wrote: osgCuda was my first choice, but I will not compile on my machine. I am using OSG 3.0.1 and the SVN version of osgCuda, on RHEL 5.4. Is that a workable combination? CD J.P. Delport wrote: Hi, an alternative to doing this manually would be to look at osgCompute/osgCuda. Even if you don't use osgCuda you can learn from there how to do what you want. cheers jp On 05/10/2011 01:28, Conan Doyle wrote: Hi, [dumbquestion] I am integrating some cuda into my osg app and one call requires the texture name/id. How do I get that from my texture object? I look through the source code and only found and id method in TextureObject, but my attempts to retrieive this bit of data eludes me. [/dumbquestion] Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43179#43179 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43201#43201 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43205#43205 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] FBO RTT - CUDA Kernel - FBO RTT Setup
Hi, On 05/10/2011 22:23, Conan Doyle wrote: Hi, My schedule lightened up a bit... I have an extra 24 hours to work on my osg/cuda problem, so I would like to incorporate CUDA into osg the correct way, which I think may be osgCUDA. Here's what I am currently doing Step 1 App renders scene to a FLOAT texture via a FBO/RTT camera Step 2 This texture is used as input to a shader on a second pass/RTT camera. The shader does some calibration stuff then renders it to a full screen quad. Step 3 Final render pass renders quad from step 2. Here's what I NEED to do... Step 1.5 Pass texture from Step 1 to a cuda kernel for processing before the calibration pass (Step 2) Questions: 1. Is this something I can use osgCUDA to do? 2. Would it be similar to the osgTexDemo? 3. Can I use an FBO, or do I have to switch to a PBO RTT? 1. Absolutely 2. Not sure, but I will forward you an example from the osgCuda devs too. I can also point you to one of our examples that does something similar. See the code here: http://code.google.com/p/flitr/source/browse/#svn%2Ftrunk%2Fexamples%2Fcuda_auto_contrast In the above example all you have to change is to place shader passes before or after the cuda pass. E.g. take the glsl_shader example and just change the texture types to osgCuda::TextureRectangle. 3. FBO is OK. CUDA 4.0 is not necessary but would be cool as I have to use it eventually, but to get past this proof of principal step I can use 3.2... or 2.3... CUDA 4.0 works fine and then you can play with Thrust too :) cheers jp CD Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43220#43220 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] FBO RTT - CUDA Kernel - FBO RTT Setup
Hi, On 06/10/2011 09:06, J.P. Delport wrote: Questions: 1. Is this something I can use osgCUDA to do? 2. Would it be similar to the osgTexDemo? 3. Can I use an FBO, or do I have to switch to a PBO RTT? 1. Absolutely 2. Not sure, but I will forward you an example from the osgCuda devs too. I can also point you to one of our examples that does something similar. just for future reference, the thread where the app is mentioned is here: http://forum.openscenegraph.org/viewtopic.php?p=36373#36373 jp -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] retrieve texture id
Hi, pls send the error messages you are getting. Also pls send output of gcc -v and g++ -v. Did you build the CUDA examples that came with 4.0? What did you build OSG with? jp On 06/10/2011 23:16, Conan Doyle wrote: Things are moving along nicely, until I tried to build osgCompute with CUDA 4.0 and gcc44. It appears that some thing is getting pulled from gcc 4.1.2 tree in the build process. I set an alias for gcc/g++ to point to gcc44 and g++44, as well as exported CC/CXX to point to these versions... Sounds like maybe I am missing something on selecting the desired version of gcc. I made all of the changes in the CMake files to point to the correct version of cuda, and check it thrice. Any suggetsion? CD J.P. Delport wrote: Hi, I've just recently compiled osgCuda with CUDA 4.0 on 64-bit with gcc/g++ 4.4 (which is a requirement for nvcc). I had to make only minor changes and most of these are already checked into the trunk of osgCuda. See thread here: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/71107 cheers jp On 05/10/2011 15:10, Conan Doyle wrote: 64 bit. I modified this post after your reply to say that I am using Cuda 4.0, which is a requirement. I have a feeling there may need to be some mods made to osgCuda to support 4.0. CD J.P. Delport wrote: Hi, I think it should work, 32/64 bit? What compiler do you have? If you supply some error messages maybe someone can help. cheers jp On 05/10/2011 14:58, Conan Doyle wrote: osgCuda was my first choice, but I will not compile on my machine. I am using OSG 3.0.1 and the SVN version of osgCuda, on RHEL 5.4. Is that a workable combination? CD J.P. Delport wrote: Hi, an alternative to doing this manually would be to look at osgCompute/osgCuda. Even if you don't use osgCuda you can learn from there how to do what you want. cheers jp On 05/10/2011 01:28, Conan Doyle wrote: Hi, [dumbquestion] I am integrating some cuda into my osg app and one call requires the texture name/id. How do I get that from my texture object? I look through the source code and only found and id method in TextureObject, but my attempts to retrieive this bit of data eludes me. [/dumbquestion] Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43179#43179 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43201#43201 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43205#43205 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43241#43241 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message
Re: [osg-users] Multipass render to texture order again
Hi, are you running SingleThreaded? Cameras (siblings) under the same node are normally rendered in the order they have been attached (you can force this with TRAVERSAL_ORDER bin too). jp On 05/10/2011 11:05, Sebastian Messerschmidt wrote: Hi, I know this has been discussed more then once before, but I still don't get the details. In my setup I'd like to use something like (this is supposed to be a table Input Cam Output Tex1 Cam1 Tex2 Tex2 Cam2 Tex3 Tex3 Cam3 Tex4 ... and so on TexN OutCam FrameBuffer I've setup the cameras to be PRE_RENDER with increasing render_order exept for the last which is POST_RENDER. All cameras have are in a separate Group which are all attached to the root. The root is given to the viewer and a TrackballManipulator is attached to the viewer. Now if I move the scene, I can clearly see, that e.g. Tex2 is from a previous frame when processed in Cam2. (I'm doing blending of different scene parts here, and you can clearly see that some parts are from the previous frame, as if the rendering is done in wrong order). How do I have to place the cameras in the scene graph? All under root like this: root --cam1 --cam2 ... or rather hierarchical? root --cam2 --cam1 Or do I have to add them to the viewer in a different way? cheers Sebastian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multipass render to texture order again
Hi, only other option I can think of is that some cameras don't get rendered because of culling. Try camera-setCullingActive(false); jp On 05/10/2011 11:47, Sebastian Messerschmidt wrote: Am 05.10.2011 11:39, schrieb Sebastian Messerschmidt: Hi JP I've tried single and multithreaded, but this doesn't seem to change anything. So first camera attached should be the first one to be rendered If I understood you correctly? Can you give me a pointer on how to force it with the renderbin approach? Okay found the last one: stateset-setRenderBinDetails(num, TraversalOrderBin) I've also checked if my cameras are attached in an appropriate order, but still no luck. cheers Sebastian Hi, are you running SingleThreaded? Cameras (siblings) under the same node are normally rendered in the order they have been attached (you can force this with TRAVERSAL_ORDER bin too). jp On 05/10/2011 11:05, Sebastian Messerschmidt wrote: Hi, I know this has been discussed more then once before, but I still don't get the details. In my setup I'd like to use something like (this is supposed to be a table Input Cam Output Tex1 Cam1 Tex2 Tex2 Cam2 Tex3 Tex3 Cam3 Tex4 ... and so on TexN OutCam FrameBuffer I've setup the cameras to be PRE_RENDER with increasing render_order exept for the last which is POST_RENDER. All cameras have are in a separate Group which are all attached to the root. The root is given to the viewer and a TrackballManipulator is attached to the viewer. Now if I move the scene, I can clearly see, that e.g. Tex2 is from a previous frame when processed in Cam2. (I'm doing blending of different scene parts here, and you can clearly see that some parts are from the previous frame, as if the rendering is done in wrong order). How do I have to place the cameras in the scene graph? All under root like this: root --cam1 --cam2 ... or rather hierarchical? root --cam2 --cam1 Or do I have to add them to the viewer in a different way? cheers Sebastian ___ 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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgCompute] trunk compile
Hi, On 05/10/2011 14:04, Mick Keller wrote: ...I just committed the changes to the trunk. Thank you. The FindCuda-script has not been updated yet. Best regards, Mick thanks. Tt appears that the latest CMake versions (at least 2.8.5 that I have on Debian Sid) includes a FindCUDA script as well, maybe you can check that out. regards jp -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] retrieve texture id
Hi, I think it should work, 32/64 bit? What compiler do you have? If you supply some error messages maybe someone can help. cheers jp On 05/10/2011 14:58, Conan Doyle wrote: osgCuda was my first choice, but I will not compile on my machine. I am using OSG 3.0.1 and the SVN version of osgCuda, on RHEL 5.4. Is that a workable combination? CD J.P. Delport wrote: Hi, an alternative to doing this manually would be to look at osgCompute/osgCuda. Even if you don't use osgCuda you can learn from there how to do what you want. cheers jp On 05/10/2011 01:28, Conan Doyle wrote: Hi, [dumbquestion] I am integrating some cuda into my osg app and one call requires the texture name/id. How do I get that from my texture object? I look through the source code and only found and id method in TextureObject, but my attempts to retrieive this bit of data eludes me. [/dumbquestion] Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43179#43179 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43201#43201 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] retrieve texture id
Hi, an alternative to doing this manually would be to look at osgCompute/osgCuda. Even if you don't use osgCuda you can learn from there how to do what you want. cheers jp On 05/10/2011 01:28, Conan Doyle wrote: Hi, [dumbquestion] I am integrating some cuda into my osg app and one call requires the texture name/id. How do I get that from my texture object? I look through the source code and only found and id method in TextureObject, but my attempts to retrieive this bit of data eludes me. [/dumbquestion] Thank you! Cheers, Conan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43179#43179 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgCompute] trunk compile
Hi, I just compiled osgCompute trunk with the latest OSG trunk and Cuda 4.0 on a 64-bit machine with gcc/g++ 4.4. I had to make some minor changes, I think the diff below should be OK to notice them. gl-GL for case sensitive Linux and cstring or string.h is needed for memcpy. Also, I had to manually set the path to the cudart library to point to lib64 (/usr/local/cuda/lib64/libcudart.so) on my machine instead of lib. I think this probably needs to be fixed in FindCUDA, but I can't look at it now. rgds jp ---8--- $ svn diff Index: src/osgCuda/Computation.cpp === --- src/osgCuda/Computation.cpp (revision 426) +++ src/osgCuda/Computation.cpp (working copy) @@ -1,4 +1,4 @@ -#include osg/gl +#include osg/GL #include cuda_runtime.h #include builtin_types.h #include cuda_gl_interop.h Index: examples/osgGeometryDemo/src/Warp.cpp === --- examples/osgGeometryDemo/src/Warp.cpp (revision 426) +++ examples/osgGeometryDemo/src/Warp.cpp (working copy) @@ -12,6 +12,7 @@ * * The full license is in LICENSE file included with this distribution. */ +#include cstring #include osg/Array #include osgCuda/Memory #include osgCuda/Geometry -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] GLSL shaders and projective texturing
I think Paul Martz did already. http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/9237/focus=9304 jp On 29/09/2011 13:46, Per Nordqvist wrote: I also struggled with this issue once and I believe osgspotlight suffers from exactly the same quadrant defect if you look closely. Would be really nice if somebody submitted a fix. /Per On 29 September 2011 01:59, Brad Colbert bcolb...@rscusa.com mailto:bcolb...@rscusa.com wrote: Glenn, __ __ Bingo! That was it. I wasn’t quite sure that would work with TexGen but there you go! __ __ Thanks! __ __ __ __ -B __ __ *From:*osg-users-boun...@lists.openscenegraph.org mailto:osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org mailto:osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *Glenn Waldron *Sent:* Wednesday, September 28, 2011 4:40 PM *To:* OpenSceneGraph Users *Subject:* Re: [osg-users] GLSL shaders and projective texturing __ __ Brad, I once had the same issue; calcuating my texgen matrix like this worked: __ __ texGenMat = modelViewMat * projectionMat * osg::Matrix::translate(1, 1, 1) * osg::Matrix::scale(0.5, 0.5, 0.5); __ __ Glenn Waldron / Pelican Mapping / @glennwaldron On Wed, Sep 28, 2011 at 7:34 PM, Brad Colbert bcolb...@rscusa.com mailto:bcolb...@rscusa.com wrote: Hi Chris, Thanks! I found that one too but it still doesn't help me figure out how to fix the coordinates so that my projected texture renders in the center of the projection frustum instead of the upper right quadrant. It's strange and I can't figure it out. -B -Original Message- From: osg-users-boun...@lists.openscenegraph.org mailto:osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Chris 'Xenon' Hanson Sent: Wednesday, September 28, 2011 3:31 PM To: OpenSceneGraph Users Subject: Re: [osg-users] GLSL shaders and projective texturing On 9/27/2011 7:21 PM, Brad Colbert wrote: I am closer! Looks like the other example I have is FFP not GLSL. Here's a working GLSL implementation (not OSG) that should be relatively easy to feed with OSG uniforms and such: http://www.ozone3d.net/tutorials/glsl_texturing_p08.php#part_8 -- 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 mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org __ __ ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto: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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Setting up FBO in drawable
Hi, I can't help you with your specific drawable question, but what would you like to achieve? In the osggameoflife example there is an example of ping-pong using multiple cameras and switches. You can also swap output textures if they are exactly the same using a callback. See here for inspiration: http://code.google.com/p/flitr/source/browse/trunk/examples/keep_history_pass/keep_history_pass.cpp cheers jp On 28/09/2011 10:45, Emmanuel Roche wrote: Hi everyone, I'm trying to setup an pure OpenGL FBO with render to texture target in an OSG drawable. But I just can't figure out how to do that properly (eg. how to isolate those pure openGL calls from the rest of the OSG scene). in my drawa implementation I just have: virtual void drawImplementation(osg::RenderInfo info) const { OSG_NOTICE Drawing PingPongDrawable...; osg::State* state = info.getState(); const unsigned int contextID = state-getContextID(); if(!_initialized !init(contextID,*state)) { OSG_WARN Failed FBO setup!; return; } state-checkGLErrors(end of PingPongDrawable drawing.); } So i'm really just calling an init function once to jus try to _create_ an FBO... I didn't even start using it..., the code of the init function is as follow: bool init(unsigned int contextID, osg::State state) const { const FBOExtensions* fbo_ext = FBOExtensions::instance(contextID,true); const osg::Texture2DArray::Extensions* t2darray_ext = osg::Texture2DArray::getExtensions(contextID,true); // Push attribs to avoid collisions with existing OSG scene ? glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT); state.checkGLErrors(Before PPD init.); // Prepare the target texture for the FBO: state.setActiveTextureUnit(1); state.checkGLErrors(Activating texture slot 1); int FFT_SIZE=256; GLuint fftaTex = 0; glGenTextures(1, fftaTex); glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, fftaTex); glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); t2darray_ext-glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGBA16F_ARB, FFT_SIZE, FFT_SIZE, 5, 0, GL_RGBA, GL_FLOAT, NULL); fbo_ext-glGenerateMipmap(GL_TEXTURE_2D_ARRAY_EXT); state.checkGLErrors(preparing target texture); // Initialize the FBO fbo_ext-glGenFramebuffers(1, _fftFbo); state.checkGLErrors(Generating FBO); fbo_ext-glBindFramebuffer(GL_FRAMEBUFFER_EXT, _fftFbo); state.checkGLErrors(Bind Framebuffer in init.); #ifdef ATTACH_TEXTURE fbo_ext-glFramebufferTexture(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, fftaTex, 0); state.checkGLErrors(FramebufferTexture setup); #endif GLuint fboId = state.getGraphicsContext() ? state.getGraphicsContext()-getDefaultFboId() : 0; fbo_ext-glBindFramebuffer(GL_FRAMEBUFFER_EXT, fboId); if(fbo_ext-glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) { OSG_WARN Error while setting up Pingpong FBO.; } state.checkGLErrors(end of Framebuffer settings); glBindTexture( GL_TEXTURE_2D_ARRAY_EXT, 0 ); glPopAttrib(); _initialized = true; return true; } Adding such a drawable in my scene, i don't have any problem as long as ATTACH_TEXTURE is *undefined*. But when I define this, I still don't have any error reported by the drawable itself (all the checkGLErrors I inserted). But then getcontinous list of Warning: detected OpenGL error 'invalid operation' at after RenderBin::draw(..) messages :-( = Any idea what I'm doing wrong here ? How can I enforce the isolation between those openGL calls and what's left from the OSG scene ? after all, since this init function is called only once, there should not be any continous warning report if it didn't have a side effect outside of this drawable encapsulation... Thanks for you help !! I really feel desperated now... :'( Manu. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org
Re: [osg-users] Setting up FBO in drawable
Hi, I see you mention fft in your code. Is this what you want to do? Do you have a working fft with multiple OSG cameras? Is it too slow for you? jp On 28/09/2011 11:30, Emmanuel Roche wrote: Thanks J.P, but actually I know the gameoflife example almost by heart already and this won't fit the bill: I need a real single pass ping pong rendering here if I want to achieve good performances. Cheers, Manu. 2011/9/28 J.P. Delport jpdelp...@csir.co.za mailto:jpdelp...@csir.co.za Hi, I can't help you with your specific drawable question, but what would you like to achieve? In the osggameoflife example there is an example of ping-pong using multiple cameras and switches. You can also swap output textures if they are exactly the same using a callback. See here for inspiration: http://code.google.com/p/__flitr/source/browse/trunk/__examples/keep_history_pass/__keep_history_pass.cpp http://code.google.com/p/flitr/source/browse/trunk/examples/keep_history_pass/keep_history_pass.cpp cheers jp On 28/09/2011 10:45, Emmanuel Roche wrote: Hi everyone, I'm trying to setup an pure OpenGL FBO with render to texture target in an OSG drawable. But I just can't figure out how to do that properly (eg. how to isolate those pure openGL calls from the rest of the OSG scene). in my drawa implementation I just have: virtual void drawImplementation(osg::__RenderInfo info) const { OSG_NOTICE Drawing PingPongDrawable...; osg::State* state = info.getState(); const unsigned int contextID = state-getContextID(); if(!_initialized !init(contextID,*state)) { OSG_WARN Failed FBO setup!; return; } state-checkGLErrors(end of PingPongDrawable drawing.); } So i'm really just calling an init function once to jus try to _create_ an FBO... I didn't even start using it..., the code of the init function is as follow: bool init(unsigned int contextID, osg::State state) const { const FBOExtensions* fbo_ext = FBOExtensions::instance(__contextID,true); const osg::Texture2DArray::__Extensions* t2darray_ext = osg::Texture2DArray::__getExtensions(contextID,true); // Push attribs to avoid collisions with existing OSG scene ? glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT | GL_TEXTURE_BIT | GL_ENABLE_BIT); state.checkGLErrors(Before PPD init.); // Prepare the target texture for the FBO: state.setActiveTextureUnit(1); state.checkGLErrors(__Activating texture slot 1); int FFT_SIZE=256; GLuint fftaTex = 0; glGenTextures(1, fftaTex); glBindTexture(GL_TEXTURE_2D___ARRAY_EXT, fftaTex); glTexParameteri(GL_TEXTURE_2D___ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D___ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D___ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D___ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D___ARRAY_EXT, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); t2darray_ext-glTexImage3D(GL___TEXTURE_2D_ARRAY_EXT, 0, GL_RGBA16F_ARB, FFT_SIZE, FFT_SIZE, 5, 0, GL_RGBA, GL_FLOAT, NULL); fbo_ext-glGenerateMipmap(GL___TEXTURE_2D_ARRAY_EXT); state.checkGLErrors(preparing target texture); // Initialize the FBO fbo_ext-glGenFramebuffers(1, _fftFbo); state.checkGLErrors(__Generating FBO); fbo_ext-glBindFramebuffer(GL___FRAMEBUFFER_EXT, _fftFbo); state.checkGLErrors(Bind Framebuffer in init.); #ifdef ATTACH_TEXTURE fbo_ext-glFramebufferTexture(__GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, fftaTex, 0); state.checkGLErrors(__FramebufferTexture setup); #endif GLuint fboId = state.getGraphicsContext() ? state.getGraphicsContext()-__getDefaultFboId() : 0; fbo_ext-glBindFramebuffer(GL___FRAMEBUFFER_EXT, fboId); if(fbo_ext-__glCheckFramebufferStatus(GL___FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) { OSG_WARN Error while setting up Pingpong FBO.; } state.checkGLErrors(end of Framebuffer settings); glBindTexture( GL_TEXTURE_2D_ARRAY_EXT, 0 ); glPopAttrib(); _initialized = true; return true; } Adding such a drawable in my scene, i don't have any problem as long as ATTACH_TEXTURE
Re: [osg-users] Question on decreasing latency for database pagers...
Hi, for forcing load from disk to CPU mem you can check what osgposter or osgSim HeightAboveTerrain does. This does not however force tiles to GPU memory. jp On 06/09/2011 13:25, Boon Wah wrote: Hi Robert, In VPB, I have set my tile-image-size to 2048 and tile-terrain-size to be 2048. The rationale is for me to have larger tiles so as to minimize the number of files. My development platform is Windows and it is pretty poor at handle large number of files. Is it possible to modify the pager such that it caches all my tiles prior to performing rendering? I understand it defeats the purpose of paging, but in this way the loading time of the tiles can be controlled. I hope somebody can guide me in doing this. Thanks for your help. Kind Regards, Boon Wah -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42443#42443 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Rendering ONLY to texture...
Hi, On 02/09/2011 01:19, Frank Sullivan wrote: Thanks guys, that is very helpful. I am having a bit of trouble with this, and I was wondering if you might be able to help. For some reason, my call to glReadPixels seems to be a no-op. That is, none of the memory that my data* points to is actually being overwritten by my call to glReadPixels. I ran the osgscreencapture example using --pbuffer-only and --no-pbo, and that seems to be working fine. The debugger reveals that, inside osg::Image::readPixels, the image data is indeed being written-to as a result of the call to glReadPixels. So, something definitely seems different about my program, although I can't seem to detect any appreciable differences in how I'm setting up my program vs. how osgscreencapture is set up. Here is where I set up my viewer: Code: _viewer = new osgViewer::Viewer; // Init the GraphicsContext Traits osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 0; traits-y = 0; traits-width = OSGDLL_FRAME_WIDTH; traits-height = OSGDLL_FRAME_HEIGHT; traits-red = 8; traits-green = 8; traits-blue = 8; traits-alpha = 8; traits-windowDecoration = false; traits-pbuffer = true; traits-doubleBuffer = false; traits-sharedContext = 0; // Create the GraphicsContext osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits); // Create Setup Camera osg::ref_ptrosg::Camera camera = _viewer-getCamera(); camera-setGraphicsContext(gc); camera-setClearColor(osg::Vec4(1.0f, 0.0f, 0.0f, 1.0f)); camera-setViewport(new osg::Viewport(0,0,OSGDLL_FRAME_WIDTH,OSGDLL_FRAME_HEIGHT)); // Add some scene data osg::ref_ptrosg::Node shed = osgDB::readNodeFile(Shed2.flt); _viewer-setSceneData(shed); // Realize viewer _viewer-realize(); The main difference here is that I'm not creating a new camera and setting it as a slave. I'm just using the main camera that was provided by the viewer. Also, I am not double-buffering (I'll explain why in a sec). Here is where I actually draw a frame and then try to retrieve it: Code: unsigned char imgData[OSGDLL_FRAME_WIDTH*OSGDLL_FRAME_HEIGHT*4]; memset(imgData, 0x00, OSGDLL_FRAME_WIDTH*OSGDLL_FRAME_HEIGHT*4); _viewer-frame(); glReadBuffer(GL_FRONT); GLenum readBufferError = glGetError(); glReadPixels(0, 0, OSGDLL_FRAME_WIDTH, OSGDLL_FRAME_HEIGHT, GL_BGRA, GL_UNSIGNED_BYTE, imgData); GLenum readPixelsError = glGetError(); As you can see, I am zeroing out the memory before I call glReadPixels. After I make the call, the memory is still zeroed out. I've tried other values as well. For instance, if I use 0x0F as my memset value, the array elements remain as 0x0F even after glReadPixels is called. So, it's not even that the frame buffer is empty and I'm getting all zeros or something. Rather, it's just failing to overwrite my data with whatever is in the frame buffer. And yet, I don't get any errors. Both calls to glGetError in the above code return zero. Now, if I attempt to set double buffering on, and I pass GL_BACK into glReadBuffer, this returns GL_INVALID_OPERATION for reasons I don't understand (the back buffer should exist, to my understanding, and I'm not making this call between glBegin/glEnd, and those are the only reasons that the glReadBuffer man page lists as possible causes for GL_INVALID_OPERATION). So, I just turned double buffering off and passed GL_FRONT in instead. This got rid of the GL_INVALID_OPERATION error, but unfortunately I'm still not getting anything from glReadPixels. As another test, I tried using osg::Image::readPixels, just in case it was doing something important that I am failing to do: Code: osg::ref_ptrosg::Image img = new osg::Image; img-readPixels(0, 0, 256, 256, GL_BGRA, GL_UNSIGNED_BYTE); The end result was the same: it allocated itself a data buffer, but glReadPixels fails to fill it in. The entire buffer is just full of 0xCD's. Although I am not creating any PBOs to my knowledge, I tried binding GL_PIXEL_PACK_BUFFER to 0 just in case. However, this did not seem to help. So, I'm thinking that there is something else about the OpenGL state that needs to be set, which I am missing, in order for this to work. Does anyone, by chance, have any ideas?[/code] The context where the texture lives must be active, so try sticking your readback code into the camera post draw callback. jp -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42371#42371 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous
Re: [osg-users] An Open Scene Graph solicitation has been posted on FedBizOpps
Wow, so this is how a government dept submits a bug report :) Should be nice to hunt this one down, I was just wondering over the weekend what happened to it. References here: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/62225 http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/63954 rgds jp On 19/08/2011 20:31, Judith E Terrill wrote: For your information, a solicitation to develop a fix for Open Scene Graph has been posted on FedBizOpps that may be of interest to you. You may view the solicitation and instructions for responding at: https://www.fbo.gov/index?s=opportunitymode=formid=5b646272c11b0c2fb01ce61f954a4555tab=coretabmode=list= Please note that offerors must be registered in CCR (https://www.bpn.gov/ccr/default.aspx) in order to be considered for award. If you have any questions, please contact Divya Soni at divya.s...@nist.gov. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multi GPU Rendering
I'm sure it can, but effectiveness will depend on what you mean by part. We e.g. use multiple gpu with video streams on multiple monitors. You can also google for equalizer opengl. jp On 18/08/2011 14:37, Miguel Lokida wrote: Hello, I would like to know if OSG can benefit of a PC with several GPU ? I mean, Can we say this part will be rendered by GPU 1 and the other by GPU 2 ? Thank you. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42112#42112 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CullingSet::computePixelSizeVector and AutoTransform
Hi, I've probably asked the questions below at the wrong time of year. Anyone have any ideas/comments? thanks jp On 06/07/2011 11:39, J.P. Delport wrote: Hi all, I'm having some issues with AutoTransform (scale to screen) and wide aspect viewports. To reproduce do something like: export OSG_WINDOW=0 0 800 600 osgautotransform Then zoom out until only Autoscale with no min, max limits is visible. Then make the aspect of the window larger/wider. You will see that the size of the text gets smaller. I've followed that AutoTransform uses CullStack-pixelSize() (to determine its scale) and that this uses CullingSet::computePixelSizeVector(). I can't quite follow the code in computePixelSizeVector, but noticed that the scaleRatio depends on both horizontal and vertical scales, but AFAIK OSG automatically adjusts the projection matrix so that only vertical scale matters. If I change: float scaleRatio = 0.7071067811f/sqrtf(scale_00.length2()+scale_10.length2()); into float scaleRatio = 0.5/sqrtf(scale_10.length2()); then the osgautotransform example behaves like I would expect, i.e. the text stays the same size no matter what the window aspect. I'm not sure this is a solution though. So my questions: - What does the output of computePixelSizeVector represent? Can I write in a matrix multiplation form? MVP*vec? - Will it work for ortho projections? thanks jp BTW, the text getting smaller for wide aspect is also present in the osgtext example for the pixel_size_on_screen line. -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] I cannot render into an 16 or 32 Bit image
Hi, search for hdr in osgprerender and osgmultiplerendertargets examples. jp On 12/08/2011 09:54, Martin Großer wrote: Hello Guys, I am a little bit dissatisfied. I want to render into an Image. I need the pixel data on the cpu memory. That is the reason why I don't use a texture as target. Anyway I need a higher precision than 8 bit. So I tried to render into an 16 Bit luminance image. Then I got an OpenGL error: Warning: detected OpenGL error 'invalid enumerant' after RenderBin::draw(,) I tried other internal formats (i.e. GL_RGBA16F_ARB and GL_RGBA32F_ARB), but I got the same message. Here is partial code from me: // init image _sumImg = new ::osg::Image; _sumImg-allocateImage(1, 1, 1, GL_LUMINANCE16, GL_FLOAT); //... // init pre render camera _preCam = new ::osg::Camera; _preCam-setViewport(0,0,1,1); _preCam-setProjectionMatrixAsOrtho2D(0,0.1,0,0.1); _preCam-setClearColor(::osg::Vec4(0,0,0,1)); _preCam-setReferenceFrame(::osg::Transform::ABSOLUTE_RF); _preCam-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); _preCam-setRenderTargetImplementation(::osg::Camera::FRAME_BUFFER_OBJECT); _preCam-attach(::osg::Camera::COLOR_BUFFER0, _sumImg); _preCam-setRenderOrder(::osg::Camera::PRE_RENDER); // get the pixel color at location (0,0) ::osg::Vec4 c = _sumImg-getColor(0,0); Thanks Martin -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Changing eye position in cull traversal
Hi, you could also try setting the LODscale: view-getCamera()-setLODScale(scale); I'm doing this when creating an ortho camera for osgEarth scenes and placing the camera far from the earth. jp On 10/08/2011 16:14, Emmanuel Roche wrote: Thanks for those inputs Sergey, but actually I tried to follow the way described in another OSG post: to create a custom CullVisitor and override the getDistanceFromViewPoint() method: And this seems to work great !! Just in case someone would need some hints on this: 1. To override the CullVisitor, I do soemthing like: camera-getRenderer()-getSceneView(id)-setCullVisitor(new MyOwnCullVisitor) (do this for id=0 and 1) 2. In my own cull visitor I then have something like: virtual float getDistanceToViewPoint(const osg::Vec3 pos, bool withLODScale) const { if(_lastTraversalNumber!=_traversalNumber) { // Retrieve the beamTarget position X and use it as -Z position in the view frame: osg::PositionAttitudeTransform* beamTarget = _data-getRefosg::PositionAttitudeTransform(beamTarget); CHECK_POINTER(beamTarget,Invalid beamTarget PAT in callback.); double offset = beamTarget-getPosition().x(); referencePoint = osg::Vec3(0.0,0.0,-offset); _lastTraversalNumber = _traversalNumber; } osg::Matrixd mat; if(!_modelviewStack.empty()) { const osg::RefMatrix* mview = _modelviewStack.back().get(); mat.invert(*mview); } osg::Vec3f localViewPoint = referencePoint*mat; //wxLogMessage(I'm in my special getDistanceToViewPoint!); if (withLODScale) return (pos-localViewPoint).length()*getLODScale(); else return (pos-localViewPoint).length(); } And with this I get the expected results without significant performance lost. So all good for me. Cheers, Manu. 2011/8/10 Sergey Polischuk pol...@yandex.ru mailto:pol...@yandex.ru Hi, osg::LOD have option to use object's size on screen (in pixels?) instead of distance to camera to determine which lod to use, you can try these setting. Cheers, Sergey. 10.08.2011, 16:03, Emmanuel Roche roche.emman...@gmail.com mailto:roche.emman...@gmail.com: Hi everyone, I've have a specific question for which I could use some help/advises: - I'm quite up-to-date with OSG 3.0.0 and osgEarth current git version - I'm build an app where I use the osgEarth library to display the earth model. - When I setup a camera on that model, I use a camera with a very very small field of view (about 0.5 degrees in both horizontal and vertical directions), and my camera is actually far away from the earth model I'm looking at. - as a result of this, only low resolution tiles are loaded (because the camera distance to the tiles is used to diced what to load or not). - What I want to do is : to get high resolution tiles displayed around the ground location the camera is pointing at even if it is physically far away. then, because (or thanks to?) the small field of view, I would still see the local details on the high res tile textures. So, any advise how to achieve this ? - so far I have tried the following: 1. Setup this famous camera just as described before, 2. Add a slave camera, using the earth as child too, but this time, positioned very close to the first camera target point on earth (and looking down that point from the local zenith). Both cameras share the same databasepager (I think) and high res tiles are indeed properly loaded because of the second camera cull traversal. The problem is: I was expecting the loaded tiles to be shared by both cameras, yet that is not the case: I still only get the low res tiles displayed by the far away camera. Is there a way to share the tiles as I was expecting ? - The other main idea I have then would be to find a way to trick the cull traversal of the far away camera so that, when traversing pagedLODs the reported distance to the tile would be as if the camera was actually much closer to its target point on the ground. Would that be a good idea ? Any hint on how to proceed then ?? - of course, option 3 would be to actually move the camera to that close location and change the field of view to a bigger value to try to approximate the previous small field of view coverage. But the point is, this camera is meant for a simulator system, and the generated view should not approximate the actual view, it should really be the same, so computing a new field of view would actually be impossible (or too complex to be worth at least).
Re: [osg-users] ANN: osgNVPR (NVidia Path Rendering)
Hi Jeremy, if this could be combined with osgEarth it would be very cool for overlays. rgds jp On 04/08/2011 21:23, Jeremy Moles wrote: NVidia recently added an extension to their 275+ series of drivers called GL_NV_path_rendering. This turns path (sometimes called vector graphics) rendering into first class drawables in OpenGL. Honestly, it's one of the coolest things I've seen in a while, and naturally--given my interest in OpenGL UIs--I began researching it and putting together a NodeKit for OSG. You can find it (in its infancy) here: http://osgnvpr.googlecode.com Run the example thusly: # osgnvprviewer # osgnvprviewer --perspective ..and notice how that no matter what the resolution, scale, or projection, the objects are rendered clear and crisp. There is also support for glyphs inside of GL_NV_path_rendering, so I will very soon be adding support for this style of text rendering into osgPango (and possible, osgText::TextNode). I've only just begun exploring this, and I'm mainly sending this e-mail to see if there is any professional interest in seeing this NodeKit mature in a timely fashion. I don't know if this is outside the allowable etiquette of the lists, but in full disclosure I'm looking to fill some free time by seeking funding for development of by those who would not only use these features but could benefit from being able to influence their development and pace! If this is inappropriate for the lists, just let me know and I'll be sure and keep my peddling to a minimum from here on out. :) At any rate, I'll continue to work on osgNVPR regardless, alongside devleopment of osgCairo/Pango/Widget and the recent TextNode submission. (Can you see a pattern here? All OSG interface development tools...) Some notes: - NV_path_rendering introduces a new kind of rendering style for its path objects. This doesn't map 1:1 to any existing usage of osg::Drawable, though I am able to hijack the compileGLObjects() method to get what I need. :) - BoundingBoxes are calculated with an extension call, but in order to use the extension I need a contextID (provided via either a State object or RenderInfo object). Unfortunately, these are difficult to get to at times, so CameraManipulators cannot properly determine a home position unless the Path has been compiled. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Qt, Manipulator keyEvent, Seeking for Help in an Emergency
Hi, AFAIK alt must be pressed with some other key before you'll get an event. jp On 05/08/2011 09:59, ramy panda wrote: Hi, In my codes, i rewrite keyPressEvent function like below: void AdapterWidget::keyPressEvent( QKeyEvent* event ) { _gw-getEventQueue()-keyPress( (osgGA::GUIEventAdapter::KeySymbol) *(event-text().toAscii().data() ) ); } In my osg codes, i write like this: bool ManipulatorEventHandler::handle(const osgGA::GUIEventAdapter ea, osgGA::GUIActionAdapter aa, osg::Object*, osg::NodeVisitor*) { bool alt = (ea.getModKeyMask() (osgGA::GUIEventAdapter::MODKEY_LEFT_ALT|osgGA::GUIEventAdapter::MODKEY_RIGHT_ALT)) != 0; if (alt) return false; if (ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN) { switch (ea.getKey()) { case 'r': resetTransform(); break; } } return true; } but when i press alt key there is no reponse in my application. I need a help in an emergency and i'm waiting answer online. Thanks very much. Thank you! Cheers, ramy -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41868#41868 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] When Patents Attack
On 26/07/2011 18:57, Paul Martz wrote: On 7/26/2011 8:44 AM, Jeremy Moles wrote: http://www.thisamericanlife.org/ For those of you who live in the US, this was a great, GREAT episode of This American Life on NPR last weekend. It talks about how absolutely insane the patent system is in the US. It's so absurd and depressing I honestly want to stop being a programmer and become an IP lawyer just so I can fight these guys. I wonder... how long will it be before these extortionists worm their way out of the mobile software market and into the games and system-level world? We avoid some of the heat now just because we aren't on the radar, but it won't be long before someone is awarded a patent for A System And Method For Dynamically Colorizing Triangular Regions In Multidimensional Space and we're all having to pay royalties... There's already prior art for that. In the Sperry-Rand versus Honeywell trial in the early 1970s, Honeywell successfully invalidated Sperry-Rand's patent for refreshable memory by demonstrating that such a device had already been invented by John Atanasoff. For the history of Atanasoff's computer (which predates the ENIAC), and a quick overview of the trial: Book: _The Man Who Invented the Computer_ http://www.amazon.com/Man-Who-Invented-Computer-Biography/dp/0385527136/ref=sr_1_1?s=booksie=UTF8qid=1311698749sr=1-1 The story of the intermittent windshield wiper is also pertinent: Movie: _Flash of Genius_ http://movies.netflix.com/WiMovie/Flash_of_Genius/70098902?trkid=2361637 thanks for the links. Another free one I liked: http://patentabsurdity.com/ I'm not in the US, but these things are heading our way too :( jp And it wouldn't matter that the patent would be absolute crap; unless you have the millions required to fight it in court, you're screwed. Prior art or otherwise. It isn't about who is right or wrong it seems, but rather, who has more money to litigate. Totally agree. The Sperry-Rand v Honeywell trial lasted years and had, I think, some 20,000 individual pieces of evidence submitted. And the windshield wiper trial pretty much ruined the plaintiff. Unless you can find a lawyer to represent you pro bono, you're screwed. -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Vertices Selection
Hi, check in MovieEventHandler::handle in osgmovie example. There is an example of how you can get vertex indices for the part of the geometry that was picked. jp On 22/07/2011 09:58, Miguel Lokida wrote: Hi, I would like to know if it is possible to selects vertices of an osg::Geometry and to transform them (translation and rotation). I know that it is possible to select objects (osgpick example) but don-t know about vertices. Is there an example or documentation dealing with vertices selection . Thank you! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41558#41558 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to update image data
Hi, On 20/07/2011 02:35, clement@csiro.au wrote: Hi, I used the following codes to create Volume data display. osg::ref_ptrosg::Image osgImage = new osg::Image; osg::ref_ptrosgVolume::Volume osgVolume = new osgVolume::Volume; osg::ref_ptrosgVolume::VolumeTile osgTile = new osgVolume::VolumeTile; osg::ref_ptrosgVolume::ImageLayer osgLayer = new osgVolume::ImageLayer(osgImage.get()); osgTile-setLayer(osgLayer.get()); osgVolume-addChild(osgTile.get()); osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(0.02f); osgVolume::SampleDensityProperty* sd = new osgVolume::SampleDensityProperty(0.005); osgVolume::TransparencyProperty* tp = new osgVolume::TransparencyProperty(1.0); osgVolume::TransferFunctionProperty* tfp = new osgVolume::TransferFunctionProperty(osgTransFunc.get()); osgVolume::CompositeProperty* cp = new osgVolume::CompositeProperty; cp-addProperty(ap); cp-addProperty(sd); cp-addProperty(tp); cp-addProperty(tfp); osgLayer-addProperty(cp); osgTile-setVolumeTechnique(new osgVolume::RayTracedTechnique); The above codes are used on initializing. I created the image pointer and assigned to image layer. Then I will use setImage method to assign I defined the data pointer. hmm, I'm not familiar with the volume code at all, but I would have though a layer is a texture without depth (nz==1)? osgImage-setImage(nx, ny, nz, 4, GL_RGBA, GL_UNSIGNED_BYTE, pdisp_ptr, osg::Image::NO_DELETE, 1); // where nx, ny, nz are size of data (width, height, depth); // where pdisp_ptr is assigned for using defined data You can change the magic 4 to also GL_RGBA, but it looks OK to me. You still have not said whether you get any image at all, even on the first frame? //Then I also used the following codes to set the size of volume data. I wonder whether I need the following codes if I already the size into image pointer. osg::ref_ptrosg::RefMatrix matrix = new osg::RefMatrix(nx, 0.0, 0.0, 0.0, 0.0, ny, 0.0, 0.0, 0.0, 0.0, nx, 0.0, 0.0, 0.0, 0.0, 1.0); osgLayer-setLocator(new osgVolume::Locator(*matrix)); osgTile-setLocator(new osgVolume::Locator(*matrix)); Then I will try to assign the data value to pdisp_ptr. After that, I will call osgImage-dirty(). But there is no changed on viewer. Any idea? This is my first time to use osg on my application, so I am not sure whether my code is crroect. No change? Was there something at all? How do you assign data to pdisp_ptr? You must change the data pointed to by pdisp_ptr or call setImage again if your data is now somewhere else. jp Clement From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of J.P. Delport [jpdelp...@csir.co.za] Sent: Wednesday, 20 July 2011 1:00 AM To: OpenSceneGraph Users Subject: Re: [osg-users] How to update image data Hi, are you calling setImage only once? Are you using osg::Image::NO_DELETE? How are you changing the data? Do you get the first image correctly? jp On 19/07/2011 16:09, clement@csiro.au wrote: I tried, but it is no update. Is there a function from viewer to update the screen? From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of J.P. Delport [jpdelp...@csir.co.za] Sent: Tuesday, 19 July 2011 11:39 PM To: OpenSceneGraph Users Subject: Re: [osg-users] How to update image data see the dirty() function On 19/07/2011 14:10, clement@csiro.au wrote: Hi, I used the Image to display data. I used setImage and assigned I defined unsigned char pointer. My question is how to let viewer to know to update the view after completed updated the data into image. Regards, Clement ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to antialisze procedural shader?
Hi, On 19/07/2011 10:46, Torben Dannhauer wrote: Hi, currently I'm working on a pixel-based distortion for projection on nonplanar surfaces. The output looks ok , but I would like to enable antialiasing. My Programm renders to texture, modifies this texture with a fragment shader and after that renders the modified texture to the output. The fragment shader pass seems to be the reason why it still looks aliased even if multisampling is enabled. what are the other min/mag filter settings for the RTT texture? The fragment shader moves each pixel to a new localion, based on an distortion map. Adjacent pixels are usually moved similar, but not identical, so even If I enable multisampling in the RTT pass, the rendered image after applying the shader looks a little bit aliased. are you moving sub-pixel distances? You could also move pixels by warping a dense grid in vertex shader. How can I smooth the image output of the distorted texture? Multisampling the final render pass does not work, I think because there is no usefull Z buffer in that pass.. I think you'll have to do everything in the RTT pass, even maybe increase the resolution of the RTT texture and have another pass to reduce it with a filter. jp Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41462#41462 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to update image data
see the dirty() function On 19/07/2011 14:10, clement@csiro.au wrote: Hi, I used the Image to display data. I used setImage and assigned I defined unsigned char pointer. My question is how to let viewer to know to update the view after completed updated the data into image. Regards, Clement ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to update image data
Hi, are you calling setImage only once? Are you using osg::Image::NO_DELETE? How are you changing the data? Do you get the first image correctly? jp On 19/07/2011 16:09, clement@csiro.au wrote: I tried, but it is no update. Is there a function from viewer to update the screen? From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of J.P. Delport [jpdelp...@csir.co.za] Sent: Tuesday, 19 July 2011 11:39 PM To: OpenSceneGraph Users Subject: Re: [osg-users] How to update image data see the dirty() function On 19/07/2011 14:10, clement@csiro.au wrote: Hi, I used the Image to display data. I used setImage and assigned I defined unsigned char pointer. My question is how to let viewer to know to update the view after completed updated the data into image. Regards, Clement ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ 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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT into a single color channel
Hi, I can't follow what you expect and what is working/not? If you are using 2DRect remember that texture coords are not between 0 and 1, so it does not make sense to directly put them into colours then. jp On 15/07/2011 20:31, Bolstad, Mark wrote: So I've done some testing. I've decided to go the shader route as it will give the most flexibility. I've modified osgdistortion from the latest svn. At the end is a short patch to show the changes. The main problem I'm getting is that the FBO texture doesn't appear to be passing to the shader properly. All I'm getting is a black screen. If I swap the shader to color based on texture coordinates, the output is correct. I'm sure that I'm probably missing something simple in the setup/texture binding, and any help is appreciated. Mark 34,36d33 #include osg/Program #include osg/Shader #include osg/Uniform 58,80d54 /// // in-line GLSL source code for the microshader example static const char *shaderVertSource = { // passthru - Simple pass through vertex shader\n void main(void)\n {\n gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n gl_Position = ftransform();\n }\n }; static const char *shaderFragSource = { uniform sampler2DRect textureIn;\n void main(void)\n {\n // gl_FragColor = vec4( gl_TexCoord[0].s, gl_TexCoord[0].t, 0.0, 1.0 );\n gl_FragColor = texture2DRect( textureIn, gl_TexCoord[0].st );\n }\n }; /// 94,98d67 osg::Program* program = new osg::Program; program-setName( texture_shader ); program-addShader( new osg::Shader( osg::Shader::VERTEX, shaderVertSource ) ); program-addShader( new osg::Shader( osg::Shader::FRAGMENT, shaderFragSource ) ); 156,157d124 osg::Vec3 cursor = bottom; osg::Vec2 texcoord = bottom_texcoord; 198,201c165,166 stateset-setTextureAttributeAndModes( 0, texture, osg::StateAttribute::ON ); stateset-addUniform( new osg::Uniform( textureIn, 0 ) ); stateset-setAttributeAndModes( program, osg::StateAttribute::ON ); stateset-setMode(GL_LIGHTING,osg::StateAttribute::ON); --- stateset-setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); 391d355 osg::Vec3 cursor = bottom; 393,394d356 705c667 if (!loadedModel) loadedModel = osgDB::readNodeFile(cow.osg); --- if (!loadedModel) loadedModel = osgDB::readNodeFile(cow.osgt); 786d747 viewer.setUpViewOnSingleScreen( 0 ); */Mark A. Bolstad/* Scientific Computing Janelia Farm Research Campus Howard Hughes Medical Institute 19700 Helix Drive, Ashburn, VA 20147 email:*bolst...@janelia.hhmi.or mailto:bolst...@janelia.hhmi.or**g* office: +1.571.209.4623 web: http://www.hhmi.org/janelia/ On Jul 14, 2011, at 10:45 AM, J.P. Delport wrote: Hi, On 14/07/2011 16:37, Jason Daly wrote: On 07/14/2011 10:08 AM, Bolstad, Mark wrote: I like the idea of combining the passes into one, but if I had a blue object and had to mask it into the red channel, wouldn't it just be black? Yes, it would be black on the red and green passes, but it would show up on the blue pass. When you combined the three passes of the image to an RGB texture, you'd have your blue object. The flow would look something like this: - set the camera to draw to an RGB texture - set camera's color mask to red only - draw the first object - set camera's color mask to green only - draw the second object - set camera's color mask to blue only - draw the third object - fetch the texture from the camera and use it however you need it as J-S said, you save the combine pass and you don't even need any special shader magic. I had talked to a professor who had suggested a one-line fragment shader to do RGB- Luminance and use Color Masking to write into the appropriate channel. Would rendering straight into a Luminance texture with Color Masking work? Maybe I'm not understanding you correctly, but I don't think this would work. You'd end up with a luminance image (effectively, a grayscale image) at the end and not a color image. I think prof meant he must stick the calculated luminance value into all three channels. jp In reality, this is actually more complicated in that it's not three objects, but three separate frames of animation. So the main loop is: while(1) { advance sim frame(); // Render to red advance sim frame(); // Render to green advance sim frame(); // Render to blue Render RTT texture to display. } Maybe if you explained what you're trying to do at a higher level, we'd be able to better help. What is the problem you're trying to solve? --J ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto:osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice
Re: [osg-users] AutoTransform and multiple views
Hi, On 18/07/2011 13:19, David Cofer wrote: Hi, I am using the Drag handlers with an autotransform on them (see code below). I have it set to AutoscaleToScreen. This works great as long as I only have 1 view of the scene. When I have multiple views though, I get a problem where zooming in on one will cause the autotransform to change the scale of the dragger. I can click on the dragger just fine in that window, but when I go back to the other window and try and click on the dragger it is no longer scaled correctly. As an example, if I zoom in to view A then the translate drag handler become larger. I can click anywhere on them and they work correctly. When I go to View B that is zoomed out then I can click not only on the visual representation of the drag handler, but on a projection of it that extends past the visual end of the axis. If I do this the opposite way (Zoom out A and look at zoomed in B), then the opposite happens. I can only click on the drag handler on a smaller portion of the visible axis. I looked around and found this post (http://forum.openscenegraph.org/viewtopic.php?t=4637highlight=). The issue you are hitting up against is a limitation of osg::AutoTransform in that it only has a single set of state so when you have two or more views that require different stats you'll get issues with both views attempting to sets it's value. The only way to solve this would be to refactor osg::AutoTransform to have multiple states in some way. It looks like this may be related to this problem, but I am not sure. It is. Does anyone have any experience with this issue? Is this issue caused by the state problem of autotransform? Yes, basically the autotransform's scale is set when it is visited by the cull traversal of a specific view, so it renders at the correct size. Picking is also a traversal, but just gets the bounds calculated on the latest cull traversal and this could be from any view... Has anyone else found a way around this problem? Does anyone have any suggestions for an easy way to get around this problem without redoing the autotransform node? I've recently worked around this by doing picking in a specific view's camera callback. My pick handler now basically queues picks to be executed after the camera's cull traversal has happened and this ensures the correct scale is used during picking. I'm not sure how easy this would be to do for the draggers... Only other option is to make autotransform more intelligent or add another type of visitor to osg. jp Here is my drag handler code. Code: VsDragger::VsDragger(VsMovableItem *lpParent, BOOL bAllowTranslateX, BOOL bAllowTranslateY, BOOL bAllowTranslateZ, BOOL bAllowRotateX, BOOL bAllowRotateY, BOOL bAllowRotateZ) { if(!lpParent) THROW_ERROR(Al_Err_lParentNotDefined, Al_Err_strParentNotDefined); m_lpVsParent = lpParent; //Create the gripperMT and default it to loc=0, rot=0 m_osgGripperMT = new osg::MatrixTransform(); osg::Matrix osgMT; osgMT.makeIdentity(); m_osgGripperMT-setMatrix(osgMT); m_osgGripperMT-addChild(this); _autoTransform = new osg::AutoTransform; _autoTransform-setAutoScaleToScreen(true); addChild(_autoTransform.get()); _sizeTransform = new osg::MatrixTransform; // Screen coordinates because of AutoTransform parent _sizeTransform-setMatrix(osg::Matrix::scale(100, 100, 100)); _autoTransform-addChild(_sizeTransform.get()); _tbDragger = new VsTrackballDragger(bAllowRotateX, bAllowRotateY, bAllowRotateZ); _tbDragger-setName(TrackballDragger); //addChild(_tbDragger.get()); _sizeTransform-addChild(_tbDragger.get()); _transDragger = new VsTranslateAxisDragger(bAllowTranslateX, bAllowTranslateY, bAllowTranslateZ); _transDragger-setName(TranslateAxisDragger); //addChild(_transDragger.get()); _sizeTransform-addChild(_transDragger.get()); this-addDragger(_tbDragger.get()); this-addDragger(_transDragger.get()); this-getOrCreateStateSet()-setMode(GL_RESCALE_NORMAL, osg::StateAttribute::ON); this-setParentDragger(getParentDragger()); } VsDragger::~VsDragger(void) { } void VsDragger::setupDefaultGeometry() { _tbDragger-setupDefaultGeometry(); _transDragger-setupDefaultGeometry(); SetupMatrix(); } void VsDragger::AddToScene() { SetupMatrix(); if(m_lpVsParent m_lpVsParent-RootGroup() m_osgGripperMT.valid()) if(!m_lpVsParent-RootGroup()-containsNode(m_osgGripperMT.get())) m_lpVsParent-RootGroup()-addChild(m_osgGripperMT.get()); } void VsDragger::RemoveFromScene() { if(m_lpVsParent m_lpVsParent-RootGroup() m_osgGripperMT.valid()) if(m_lpVsParent-RootGroup()-containsNode(m_osgGripperMT.get())) m_lpVsParent-RootGroup()-removeChild(m_osgGripperMT.get()); } void VsDragger::SetupMatrix() { if(m_lpVsParent m_lpVsParent-RootGroup() m_osgGripperMT.valid()) { //This gives the radius of the boundign sphere for the selected part. //We will multiply that by 2 and then scale the entire dragger by that amount. //We will also use that setting for the minimum scale of the autotransform. float fltMaxDim =
Re: [osg-users] ATI FirePro M8900
Hi, for posterity and the future frustrated, here is what had to be done make the FirePro believe it can do OpenGL. Specs again: Dell Precision M6600 AMD (ATI) FirePro M8900 (FireGL) Mobility Pro Graphics Driver version: 2011/05/31 8.851.0.0 Windows 7 64-bit Grep the OSG source code for Radeon and everywhere add FirePro for the existing workarounds. They have the same Pro-ness. Short circuit State::computeVertexBufferObjectSupported() to return false no matter what. Make the databasepager use display lists: pager-setDrawablePolicy(osgDB::DatabasePager::USE_DISPLAY_LISTS); After all this, OSG at least does not crash, but an annoying +-1s pause was occurring every now and then. This appears to be happening in other OpenGL apps too. To get rid of the pauses we had to disable all eye-candy on Windows 7, i.e. switch to the classic theme. I've now wasted enough time on this. If you got this far, let it be a reminder to spend a bit more and get the NVidia GeForce/Quadro next time. jp PS. Wish I could find an AMD support email address to copy this too, but they're hiding behind web forms with lots of required fields. Bah. On 12/07/2011 08:35, J.P. Delport wrote: Hi Luc, thanks for the feedback. I'm going to try disable VBO wherever possible and see what happens. I'll probably have to make a visitor for all other loaded objects or somehow convince OSG that the ATI does not support VBO. I've been spared the ATI madness till now, so I'll check the list for older VBO workarounds too. It's sad that ATI/AMD misuses their advantage of being the underdog [1] to keep churning out crap OpenGL support. jp [1] People like competition and always seem to give ATI/AMD another chance, only to be disappointed again. On 11/07/11 17:51, Luc Frauciel wrote: I work on a Dell M6400 with a FirePro M7740 on Windows 7 64-bit. Same issue. Hours of installation/desinstallation of different drivers did nothing. The only workaround I've found is to disable VBO : pager-setDrawablePolicy(osgDB::DatabasePager::USE_DISPLAY_LISTS); There is also an Env setting to do that I think. It put an end to Geometric nightmare and random crashes. I really don't know what's pro in Ati FirePro... Luc De : J.P. Delport jpdelp...@csir.co.za A : osg users osg-users@lists.openscenegraph.org Date: 07/11/2011 05:18 PM Objet : [osg-users] ATI FirePro M8900 Envoyé par : osg-users-boun...@lists.openscenegraph.org Hi all, we've got users with shiny new Dell Precision M6600 laptops with the FirePro M8900 ATI chips on Windows 7 64-bit. Terrain databases that work perfectly well almost everywhere produce artistic but not quite pleasing results in osgviewer, see attached. Any ideas on how to work around ATI's OpenGL uselessness? We've already suggested buying NVidia cards :/ Help on installing other driver versions, other than those blessed by Dell with AMD shrugging their shoulders [1], would also be welcome. cheers jp [1] http://support.amd.com/us/kbarticles/Pages/737-28041SupportforATIMobility.aspx -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. [pièce jointe ati-junk.jpg supprimée par Luc Frauciel/STAR-APIC] ___ 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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting RGB-values out of frame
Hi, On 15/07/2011 11:14, Diana Kittelmann wrote: Hi, I'm implementing a lidar scanner simulator ins osg and got kind oft stucked. I'm loading a world from file as my scene and let my sensor fly through the world, everything works fine. From a 3d Party I got a Vertex- and Fragment Shader to calculate the actual view of the lidar scanner. In other words what I get right now is an image with colored Pixel -the color of a pixel tells me the distance between the sensor and point of object hit by the laser ray -the image doesent have any depth informations -when I get the distance-values I have to send them vie ethernet (not relevant here cause already implemennted) so waht I need as result ist a vector of long-values including the length of the laser rays And now I don't know how I can get the distance or better I don't know how I can get the RGB-Values of the Pixel in the image. (notice that image doesen't mean I get an Image-object but the actual picture shown in the View) I tried to realize it via osg::Image: Code: osg::Image* buffer = new osg::Image; ... void getBuffer() { buffer-readPixels(0,0,200,200,GL_RGB,GL_FLOAT); float* bufferRaw; bufferRaw = (float*) buffer-data(); ... } you have the right idea with readpixels, but you must make sure that the readpixels is happening after the camera has drawn so that the context where the data lives is still active. Stick it into a drawcallback. See the osgscreencapture example for inspiration. It also shows the other methods of reading data back to the CPU. With this I just get a wrong value (something undefined like -4.3160208e+008) I have no idea if I am on the right way or totally wrong. I'm just new to OSG. So can anyone give me a tip what I should try or for what to search ... I'm using OSG 2.8.1, have one View and one Camera (the one the view got by default) and I'm using a kind of complex class hierarchie (ie: I have a cameraView-clas which realizes the view, and I have a lidarView-class which realizes the lidar stuff and calls the shaders and which inherits from the cameraView). Thank you! Cheers, Diana PS: The worst ist that it hast to be very fast. I have to write a real-time lidar scanner simulation.[/code] You'll probably be limited by the amount of data you can read back from the GPU to CPU. You'll have to test this on your setup and you can work out the required rate you'll need. jp -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41378#41378 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT into a single color channel
Hi, On 13/07/11 17:04, Bolstad, Mark wrote: For an application that we are developing, I need to be able to render three different objects into the three color channels separately, then render to the display. I'm currently using a setup similar to osgdistortion. The question is how to render into a single channel. My setup looks like: osg::Texture2D* texture = new osg::Texture2D; texture-setTextureSize(tex_width, tex_height); texture-setInternalFormat(GL_RGBA); texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); If I set the Internal format to GL_RED, GL_GREEN, ... in successive renders, would the color data be packed? Or, do I need to use a subcopy, or ? you will need to combine them manually, GL_RED is like GL_LUMINANCE so you'll get only one output value per pixel packed. I think easiest would be to render to 3 luminance textures and then combine in another step into rgb. rgds jp Thanks, Mark */Mark A. Bolstad/* Scientific Computing Janelia Farm Research Campus Howard Hughes Medical Institute 19700 Helix Drive, Ashburn, VA 20147 email:*bolst...@janelia.hhmi.or mailto:bolst...@janelia.hhmi.or**g* office: +1.571.209.4623 web: http://www.hhmi.org/janelia/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT into a single color channel
Hi, On 14/07/2011 14:58, Jean-Sébastien Guay wrote: Hi Mark, JP, I think easiest would be to render to 3 luminance textures and then combine in another step into rgb. Why not render 3 passes into the same RGB texture but just write to one channel per pass using color masking? You'd save the combine pass. sounds like it should work, I've never tried color masking before... jp J-S -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT into a single color channel
Hi, On 14/07/2011 16:08, Bolstad, Mark wrote: I like the idea of combining the passes into one, but if I had a blue object and had to mask it into the red channel, wouldn't it just be black? I had talked to a professor who had suggested a one-line fragment shader to do RGB- Luminance and use Color Masking to write into the appropriate channel. Would rendering straight into a Luminance texture with Color Masking work? In reality, this is actually more complicated in that it's not three objects, but three separate frames of animation. So the main loop is: while(1) { advance sim frame(); // Render to red advance sim frame(); // Render to green advance sim frame(); // Render to blue Render RTT texture to display. } Thanks for the suggestions and any further advice. I think you're at the stage where you should just try :) Trying it out in my head I'm quite sure rendering to 3 luminance and then combining in extra step would work. Fragment shader that distributes colours to all channels with color masks should also work. jp Mark */Mark A. Bolstad/* Scientific Computing Janelia Farm Research Campus Howard Hughes Medical Institute 19700 Helix Drive, Ashburn, VA 20147 email:*bolst...@janelia.hhmi.or mailto:bolst...@janelia.hhmi.or**g* office: +1.571.209.4623 web: http://www.hhmi.org/janelia/ On Jul 14, 2011, at 8:58 AM, Jean-Sébastien Guay wrote: Hi Mark, JP, I think easiest would be to render to 3 luminance textures and then combine in another step into rgb. Why not render 3 passes into the same RGB texture but just write to one channel per pass using color masking? You'd save the combine pass. J-S -- __ Jean-Sebastien Guay jean-sebastien.g...@cm-labs.com mailto:jean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org mailto: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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT into a single color channel
Hi, On 14/07/2011 16:37, Jason Daly wrote: On 07/14/2011 10:08 AM, Bolstad, Mark wrote: I like the idea of combining the passes into one, but if I had a blue object and had to mask it into the red channel, wouldn't it just be black? Yes, it would be black on the red and green passes, but it would show up on the blue pass. When you combined the three passes of the image to an RGB texture, you'd have your blue object. The flow would look something like this: - set the camera to draw to an RGB texture - set camera's color mask to red only - draw the first object - set camera's color mask to green only - draw the second object - set camera's color mask to blue only - draw the third object - fetch the texture from the camera and use it however you need it as J-S said, you save the combine pass and you don't even need any special shader magic. I had talked to a professor who had suggested a one-line fragment shader to do RGB- Luminance and use Color Masking to write into the appropriate channel. Would rendering straight into a Luminance texture with Color Masking work? Maybe I'm not understanding you correctly, but I don't think this would work. You'd end up with a luminance image (effectively, a grayscale image) at the end and not a color image. I think prof meant he must stick the calculated luminance value into all three channels. jp In reality, this is actually more complicated in that it's not three objects, but three separate frames of animation. So the main loop is: while(1) { advance sim frame(); // Render to red advance sim frame(); // Render to green advance sim frame(); // Render to blue Render RTT texture to display. } Maybe if you explained what you're trying to do at a higher level, we'd be able to better help. What is the problem you're trying to solve? --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ATI FirePro M8900
Hi Luc, thanks for the feedback. I'm going to try disable VBO wherever possible and see what happens. I'll probably have to make a visitor for all other loaded objects or somehow convince OSG that the ATI does not support VBO. I've been spared the ATI madness till now, so I'll check the list for older VBO workarounds too. It's sad that ATI/AMD misuses their advantage of being the underdog [1] to keep churning out crap OpenGL support. jp [1] People like competition and always seem to give ATI/AMD another chance, only to be disappointed again. On 11/07/11 17:51, Luc Frauciel wrote: I work on a Dell M6400 with a FirePro M7740 on Windows 7 64-bit. Same issue. Hours of installation/desinstallation of different drivers did nothing. The only workaround I've found is to disable VBO : pager-setDrawablePolicy(osgDB::DatabasePager::USE_DISPLAY_LISTS); There is also an Env setting to do that I think. It put an end to Geometric nightmare and random crashes. I really don't know what's pro in Ati FirePro... Luc De :J.P. Delport jpdelp...@csir.co.za A : osg users osg-users@lists.openscenegraph.org Date: 07/11/2011 05:18 PM Objet : [osg-users] ATI FirePro M8900 Envoyé par :osg-users-boun...@lists.openscenegraph.org Hi all, we've got users with shiny new Dell Precision M6600 laptops with the FirePro M8900 ATI chips on Windows 7 64-bit. Terrain databases that work perfectly well almost everywhere produce artistic but not quite pleasing results in osgviewer, see attached. Any ideas on how to work around ATI's OpenGL uselessness? We've already suggested buying NVidia cards :/ Help on installing other driver versions, other than those blessed by Dell with AMD shrugging their shoulders [1], would also be welcome. cheers jp [1] http://support.amd.com/us/kbarticles/Pages/737-28041SupportforATIMobility.aspx -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. [pièce jointe ati-junk.jpg supprimée par Luc Frauciel/STAR-APIC] ___ 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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] GPU Data Access
Hi, On 11/07/11 17:47, Martin Großer wrote: Hello, I have written a little application, which renders a scene into a texture. I use the frame buffer object, but my problem is, I need the data on the cpu after the rendering. I know that is the bottleneck, but I hope someone can give me a clever tip how I can do this without big delay. Maybe, is it possible to get access to the texture via a cuda program. Then I can do my procedure on the gpu and then I only transport the result back to the cpu? My procedure is quite simple. I have a depth map and I want to get the sum over all pixel values. There are some ideas about my problem? you can do this with osgCompute and its osgCUDA. It can read the OSG texture and then you can do some CUDA kung-foo on it. E.g. we've used thrust to make a histogram in GPU. Let me know if you need more help. jp Cheers Martin -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT issue when switching from fullscreen to windowed mode
Hi, this is known behaviour. Currently OSG caters for the common case where the size and attachments of the RTT camera does not change frequently. There are workarounds. I suggest you search the list archives for runCameraSetup. You can also check how osgPPU handles resizes. rgds jp On 07/07/11 11:35, Alessandro Terenzi wrote: Hi, I just tried the prerender example by issuing the --fb parameter and I get the same problem as described above...so I guess that this is the expected behaviour even though it is not the effect one could expect. So, is there something that must be done in order to use RTT when a window resizing occurs? Thanks. Alessandro -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41232#41232 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.orgHi, -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] RTT issue when switching from fullscreen to windowed mode
Hi, Are you recreating the texture so that it fits the new view size? Are you modifying the RTT camera viewport? Above is however not needed when using FBO RTT, the texture size can stay the same no matter what the final view window size is, unless you want to match it pixel for pixel. I double checked it with your original app. You only had: camera_RTT-setViewport(0,0,screenWidth,screenHeight); missing, then the FBO path works fine. I also attach code that worked for me. Any specific reason for not using FBO? jp On 07/07/11 13:14, Alessandro Terenzi wrote: Thanks JP, after having searched the archives, I tried to create a cull callback and in its operator() method I tried different things among adding these lines: Code: cv-getCurrentRenderBin()-getStage()-setCameraRequiresSetUp(true); cv-getCurrentRenderBin()-getStage()-runCameraSetUp(cv-getRenderInfo()); But this seems to be not enough. I also tried to detach the COLOR_BUFFER and attach it again along with the RTT texture, but still same issue. I do not understand what happens behind the scenes, so I still cannot think about what else to try...any hint about the workaround you were talking about? :) Cheers. Alessandro -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41234#41234 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. #include osgDB/ReadFile #include osgUtil/Optimizer #include osg/CoordinateSystemNode #include osg/Switch #include osgText/Text #include osgViewer/CompositeViewer #include osgViewer/ViewerEventHandlers #include osgGA/TrackballManipulator #include osgGA/FlightManipulator #include osgGA/DriveManipulator #include osgGA/KeySwitchMatrixManipulator #include osgGA/StateSetManipulator #include osgGA/AnimationPathManipulator #include osgGA/TerrainManipulator #include iostream int main( int argc, char **argv ) { osg::ArgumentParser arguments(argc,argv); osgViewer::Viewer viewer(arguments); // add stats and window size handlers... viewer.addEventHandler( new osgViewer::StatsHandler() ); viewer.addEventHandler( new osgViewer::WindowSizeHandler() ); int screenWidth = 1366; int screenHeight = 768; // create the texture to render to... osg::ref_ptrosg::Texture2D texture_RTT = new osg::Texture2D; texture_RTT-setTextureSize(screenWidth, screenHeight); texture_RTT-setInternalFormat(GL_RGBA); texture_RTT-setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR); texture_RTT-setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); texture_RTT-setResizeNonPowerOfTwoHint(false); // create the quad... osg::ref_ptrosg::Geometry quad_RTT = osg::createTexturedQuadGeometry( osg::Vec3(0.0, 0.0, 0.0), osg::Vec3(screenWidth, 0.0, 0.0), osg::Vec3(0.0, screenHeight, 0.0)); quad_RTT-setDataVariance( osg::Object::DYNAMIC ); osg::ref_ptrosg::Geode quad_geode_RTT = new osg::Geode; quad_geode_RTT-addDrawable(quad_RTT.get()); quad_geode_RTT-setDataVariance( osg::Object::DYNAMIC ); osg::StateSet *quadState = quad_geode_RTT-getOrCreateStateSet(); quadState-setTextureAttributeAndModes(0, texture_RTT.get(), osg::StateAttribute::ON); quadState-setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED ); // create the camera... osg::ref_ptrosg::Camera camera_RTT = new osg::Camera; #ifdef USE_IMAGE osg::ref_ptrosg::Image image_RTT = new osg::Image; image_RTT-allocateImage(screenWidth, screenHeight, 1, GL_RGBA, GL_UNSIGNED_BYTE); camera_RTT-attach(osg::Camera::COLOR_BUFFER, image_RTT.get()); texture_RTT-setImage(0, image_RTT.get()); #else camera_RTT-attach(osg::Camera::COLOR_BUFFER, texture_RTT.get()); #endif camera_RTT-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); //camera_RTT-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER); camera_RTT-setRenderOrder(osg::Camera::PRE_RENDER); camera_RTT-setReferenceFrame( osg::Camera::ABSOLUTE_RF ); camera_RTT-setClearColor( osg::Vec4( 0., 0., 1., 1. ) ); camera_RTT-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // add whatever children you want drawn to the texture osg::ref_ptr osg::Node node = osgDB::readNodeFile(cow.osg); if(node.valid()) { const osg::BoundingSphere bs = node-getBound(); float znear =
Re: [osg-users] RTT issue when switching from fullscreen to windowed mode
Hi Alessandro, On 07/07/11 15:46, Alessandro Terenzi wrote: Well, no, I was not re-creating the texture, so if I understood it correctly: if I want to use the FRAME_BUFFER target I also need to re-create the texture every time a resize occurs and also call runCameraSetup as well, right? If you change texture dimensions you definitely need to call setCameraRequiresSetUp(true); The runCameraSetup is actually performed inside RenderStage, so you don't have to call this yourself. I'm not 100% sure of the requirement to resize the texture when the viewport changes for FRAME_BUFFER, but I assume that if the camera is re-using the frame buffer of the viewer then their sizes should match. You'll have to double check this. Actually the decision not to use FBOs is not final, I'm just trying the possibilities...to this regard I wonder which target, among FRAME_BUFFER, FBO and pbuffer, is the one that is most likely going to work on, let's say, 3 or 5 years old computers? Well I've tested your code on an old (+-5 years) Dell D820 laptop with an NVidia GeForce Go 7400 and FBO works fine on that. I'd say if you can use FBO at all go for that. cheers jp Thank you again. Cheers. Alessandro -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41237#41237 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CullingSet::computePixelSizeVector and AutoTransform
Hi all, I'm having some issues with AutoTransform (scale to screen) and wide aspect viewports. To reproduce do something like: export OSG_WINDOW=0 0 800 600 osgautotransform Then zoom out until only Autoscale with no min, max limits is visible. Then make the aspect of the window larger/wider. You will see that the size of the text gets smaller. I've followed that AutoTransform uses CullStack-pixelSize() (to determine its scale) and that this uses CullingSet::computePixelSizeVector(). I can't quite follow the code in computePixelSizeVector, but noticed that the scaleRatio depends on both horizontal and vertical scales, but AFAIK OSG automatically adjusts the projection matrix so that only vertical scale matters. If I change: float scaleRatio = 0.7071067811f/sqrtf(scale_00.length2()+scale_10.length2()); into float scaleRatio = 0.5/sqrtf(scale_10.length2()); then the osgautotransform example behaves like I would expect, i.e. the text stays the same size no matter what the window aspect. I'm not sure this is a solution though. So my questions: - What does the output of computePixelSizeVector represent? Can I write in a matrix multiplation form? MVP*vec? - Will it work for ortho projections? thanks jp BTW, the text getting smaller for wide aspect is also present in the osgtext example for the pixel_size_on_screen line. -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Hello OSG
Hi all, I've recently fixed some of these in our own code. See here: http://code.google.com/p/flitr/source/detail?r=34 It was for ffmpeg on Debian sid: apt-cache policy ffmpeg ffmpeg: Installed: 5:0.8-0.1 It should give some hints on where to start. I'm too busy to help currently. cheers jp On 05/07/11 16:04, Ryan Pavlik wrote: On Tue, Jul 5, 2011 at 8:03 AM, Donn Washburn n5...@comcast.net mailto:n5...@comcast.net wrote: On 07/05/2011 03:31 AM, Alberto Luaces wrote: Donn Washburn writes: This is my first time to join in on OSGs email. The main purpose was to notify of a error I am getting on a SVN version on two different OS versions. It shows up on ffmpeg/FFmpegDecoder.cpp which is at about 99% and states depreciated causing OSG to fail. I do have it saved so if this is the correct place to ask I can send it. Hi Donn, Yes, it should be helpful that you provide the exact error you are getting and your ffmpeg version. Ok will do! osg.err So the deprecation warnings you mention aren't actually the problem strictly speaking - those are warnings, not errors. The errors are better hidden - here they are without the warnings around them: [ 96%] Building CXX object src/osgPlugins/ffmpeg/CMakeFiles/osgdb_ffmpeg.dir/FFmpegDecoder.o In file included from /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegHeaders.hpp:12:0, from /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegClocks.hpp:10, from /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoderAudio.hpp:9, from /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.hpp:5, from /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:2: /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp: In member function �void osgFFmpeg::FFmpegDecoder::findAudioStream()�: /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:211:64: error: �CODEC_TYPE_AUDIO� was not declared in this scope /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp: In member function �void osgFFmpeg::FFmpegDecoder::findVideoStream()�: /mnt/sda7/fgfs/OpenSceneGraph/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp:229:64: error: �CODEC_TYPE_VIDEO� was not declared in this scope What version of ffmpeg and linux are you using? Ryan -- Ryan Pavlik HCI Graduate Student Virtual Reality Applications Center Iowa State University rpav...@iastate.edu mailto:rpav...@iastate.edu http://academic.cleardefinition.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] non-solid texture color and osg::Image.setImage
Hi, for an RGBA texture you would need data to be of size width*height*4. Also, not sure what your magic 4 is in image - setImage. Put GL_RGBA instead of 4. Try: image - setImage (width, height, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, data, osg::Image::NO_DELETE ); jp On 22/06/11 08:17, Sergey Alekseev wrote: I generate a texture as follows: osg::Texture2D * map () { int width = 38, height = 40; osg::Texture2D * map = new osg::Texture2D; map - setTextureSize (width, height); map - setFilter (osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR); map - setFilter (osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR); osg::Image * image = new osg::Image; unsigned char * data = new unsigned char [width * height]; for ( unsigned y = 0; y height ; y ++ ) for( unsigned x = 0; x width; x ++ ) { int random = rand () % 5000; data [y * width + x] = (unsigned char) x * y; } image - setImage (width, height, 1, 4, GL_RGBA, GL_UNSIGNED_BYTE, data, osg::Image::NO_DELETE ); map - setImage (image); return map; } However, despite different values the data placed in the osg::Image buffer data a texture always it is displayed by solid color. Color changes depending on value of parameters: width, height, 1, 4, GL_RGBA, GL_UNSIGNED_BYTE,but always stays as solid. How i can make that each point of a texture was displayed by the color set in the buffer data? Where I can read more detailed documentation on osg:: Image.setImage? thanks, sergey -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40728#40728 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] non-solid texture color and osg::Image.setImage
Hi, On 22/06/11 11:29, Sergey Alekseev wrote: Hi, JP, thanks you for your answer. I have made as you wrote and have received - the same solid texture color. Only has changed color of a texture: from dark lila to dark grey. how are you applying the texture to geometry? Are your texture coordinates OK? jp thank you, sergey -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40738#40738 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamically changing render targets
Hi, other option is described in this thread: http://thread.gmane.org/gmane.comp.graphics.openscenegraph.user/65564/ cheers jp On 20/06/11 14:26, Robert Osfield wrote: H Dnaiel, The normal way to manage rendering to multiple textures is to have two different Camera, if you want to switch between these just using an osg::Switch above the Cameras, Robert. On Mon, Jun 20, 2011 at 1:17 PM, Daniel Melzerd.mel...@gmx.net wrote: Hi everybody, Just a quick question on changing render targets. I have an osg::Camera with a Texture attached as render target. Depending on certain conditions I want to detach the old Texture and attach a different Texture. My inital guess would be something like this: camera-detach(..., oldTexture); camera-attach(..., newTexture, ..); Unfortunately this doesn't work and the camera continues to render to the old Texture. Anything I'm missing out? Would be glad for any suggestions. Thank you! Cheers, Daniel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40685#40685 ___ 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 -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] Difficulties to load images from memory
Hi, std::string has a constructor that you can pass a char* and size to. string ( const char * s, size_t n ); This ignores \0's. You can then it into a stringstream or possibly even directly put it into stringstream.str() HTH jp On 14/06/11 16:35, Daniel Cámpora wrote: Hello community, Apparently, the problem is related to the formation of the strings I'm trying to pass to the istringstream. Since they contain the \0 character, they finish earlier than expected. Has anybody found any workaround for this? Thank you! Cheers, Daniel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=40466#40466 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] too much computation
Hi, On 07/06/11 17:34, hemanth korrapati wrote: Thank you for your answer. can I find an example related to this idea ? I can make you one, but that would leave no fun/exploration for you :) Start simple and look at what osgviewer --image myimage.jpg does. Or look at osgmovie. These examples load an osg::Image and place it onto a quad. What you need to do instead of loading the image, is creating an empty image of the right size (and allocating memory for it - see the osg::Image header for the calls) and then poke your values into it. Attach the image to a texture and then attach the texture to a quad. You can set the texture sampling for the texture (search for FilterMode and NEAREST). You can visualise this quad with your texture on in many ways, depending on what camera you use to look at it. E.g. normal OSG camera where you can spin it around, or you can put it in a HUD, or you can make an orthographic camera. HTH jp On Tue, Jun 7, 2011 at 1:27 PM, J.P. Delport jpdelp...@csir.co.za mailto:jpdelp...@csir.co.za wrote: Hi, another option instead of drawing geometry would be to put your data into a texture (image) and then just visualise that. Using nearest sampling would give you little squares too. jp On 07/06/11 12:38, Sebastian Messerschmidt wrote: From the first look I'd advise to split up the geometries and put them into multiple nodes. Looking at the code I don't know which limit you're hitting here, but there are limits in the opengl implementations that might dissallow buffers beyond certain sizes. cheers Sebastian Hi I have modified the createHUD function provided in the 'osgpick' example, for my application as below. Essentially i have to plot a matrix of values on the screen with each matrix entry represented by a square and its color represented by its value. The size of the matrix is 1615 x 1615. when i run the program, it takes a long time with a blank screen before giving a segmentation fault message. Can I get some help on this - the reason for the error and an efficient way to do this, because I may have to plot 6500 x 6500 sized matrices in the future. I have also posted the gdb output below. Thank you == modified createHUD function used in my application osg::Node* createHUD(osgText::Text* updateText, vectorvectordouble simmat, double max) { // create the hud. derived from osgHud.cpp // adds a set of quads, each in a separate Geode - which can be picked individually // eg to be used as a menuing/help system! // Can pick texts too! osg::Camera* hudCamera = new osg::Camera; hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); hudCamera-setProjectionMatrixAsOrtho2D(0,3200,0,1600); hudCamera-setViewMatrix(osg::Matrix::identity()); hudCamera-setRenderOrder(osg::Camera::POST_RENDER); hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT); std::string timesFont(fonts/times.ttf); // turn lighting off for the text and disable depth test to ensure its always ontop. osg::Vec3 position(100.0f,1550.0f,0.0f); osg::Vec3 delta(0.0f,-60.0f,0.0f); osg::Geode* geode = new osg::Geode(); osg::StateSet* stateset = geode-getOrCreateStateSet(); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); for(int i=0; isimmat.size(); i++) { for(int j=0; jsimmat[i].size(); j++) { osg::Geometry *quad=new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array(4); // 1 quad osg::Vec4Array* colors = new osg::Vec4Array; double colorval=simmat[i][j]/max; colors-push_back(osg::Vec4(colorval,colorval,colorval, 1.0)); quad-setColorArray(colors); quad-setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg::Vec3 newpos=position+osg::Vec3(j,i,0
Re: [osg-users] too much computation
Hi, another option instead of drawing geometry would be to put your data into a texture (image) and then just visualise that. Using nearest sampling would give you little squares too. jp On 07/06/11 12:38, Sebastian Messerschmidt wrote: From the first look I'd advise to split up the geometries and put them into multiple nodes. Looking at the code I don't know which limit you're hitting here, but there are limits in the opengl implementations that might dissallow buffers beyond certain sizes. cheers Sebastian Hi I have modified the createHUD function provided in the 'osgpick' example, for my application as below. Essentially i have to plot a matrix of values on the screen with each matrix entry represented by a square and its color represented by its value. The size of the matrix is 1615 x 1615. when i run the program, it takes a long time with a blank screen before giving a segmentation fault message. Can I get some help on this - the reason for the error and an efficient way to do this, because I may have to plot 6500 x 6500 sized matrices in the future. I have also posted the gdb output below. Thank you == modified createHUD function used in my application osg::Node* createHUD(osgText::Text* updateText, vectorvectordouble simmat, double max) { // create the hud. derived from osgHud.cpp // adds a set of quads, each in a separate Geode - which can be picked individually // eg to be used as a menuing/help system! // Can pick texts too! osg::Camera* hudCamera = new osg::Camera; hudCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); hudCamera-setProjectionMatrixAsOrtho2D(0,3200,0,1600); hudCamera-setViewMatrix(osg::Matrix::identity()); hudCamera-setRenderOrder(osg::Camera::POST_RENDER); hudCamera-setClearMask(GL_DEPTH_BUFFER_BIT); std::string timesFont(fonts/times.ttf); // turn lighting off for the text and disable depth test to ensure its always ontop. osg::Vec3 position(100.0f,1550.0f,0.0f); osg::Vec3 delta(0.0f,-60.0f,0.0f); osg::Geode* geode = new osg::Geode(); osg::StateSet* stateset = geode-getOrCreateStateSet(); stateset-setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); for(int i=0; isimmat.size(); i++) { for(int j=0; jsimmat[i].size(); j++) { osg::Geometry *quad=new osg::Geometry; osg::Vec3Array* vertices = new osg::Vec3Array(4); // 1 quad osg::Vec4Array* colors = new osg::Vec4Array; double colorval=simmat[i][j]/max; colors-push_back(osg::Vec4(colorval,colorval,colorval, 1.0)); quad-setColorArray(colors); quad-setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg::Vec3 newpos=position+osg::Vec3(j,i,0); (*vertices)[0]=newpos; (*vertices)[1]=newpos+osg::Vec3(0.0f,-1.0f,0.0f); (*vertices)[2]=newpos+osg::Vec3(1.0f,-1.0f,0.0f); (*vertices)[3]=newpos+osg::Vec3(1.0f,0.0f,0.0f); quad-setVertexArray(vertices); quad-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geode-addDrawable(quad); } } hudCamera-addChild(geode); return hudCamera; } === GDB output: Starting program: /hemanth/Workspace/visualization/a.out /hemanth/Workspace/loop_closure/log_pavin25610_56_usurf128_delta4_tfidfm/matches [Thread debugging using libthread_db enabled] [New Thread 0xb7b48b70 (LWP 3756)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7b48b70 (LWP 3756)] 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so (gdb) bt #0 0x01276690 in ?? () from /usr/lib/dri/swrast_dri.so #1 0x012767d8 in _mesa_NewList () from /usr/lib/dri/swrast_dri.so #2 0x002c1944 in osg::Drawable::compileGLObjects(osg::RenderInfo) const () from /usr/local/lib/libosg.so.65 #3 0x005ac85b in osgUtil::GLObjectsVisitor::apply(osg::Drawable) () from /usr/local/lib/libosgUtil.so.65 #4 0x005ad461 in osgUtil::GLObjectsVisitor::apply(osg::Geode) () from /usr/local/lib/libosgUtil.so.65 #5 0x002d7079 in osg::Geode::accept(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #6 0x0030e7d4 in osg::Group::traverse(osg::NodeVisitor) () from /usr/local/lib/libosg.so.65 #7 0x005ad3db in
Re: [osg-users] ANN: Godzi - 3D mapping for WebGL
Awesome! On 02/06/11 17:30, Glenn Waldron wrote: Friends, Slightly off-topic perhaps, but hopefully of interest! I'd like to make you aware of our brand new FOSS project - Godzi. (http://godzi.org) Inspired by osgEarth, and built atop Cedric's excellent OSGJS library (http://osgjs.org), Godzi (pronounced God's Eye) is a 3D mapping toolkit for WebGL/Javascript. Godzi is an application-level API for rendering 3D maps in your browser without a plugin. Godzi requires a WebGL-compliant browser like Firefox 4 or Chrome 11. Being in its early stages, it's still quite simple.. but there's plenty more to come. But enough talk. Visit the project page and try out the examples: http://godzi.org Glenn Waldron / Pelican Mapping / @glennwaldron ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org