Re: [osg-users] OSG website unresponsive
Robert Maybe it is a good time to investigate OSUOSL The Oregon State University Open Source Lab is the home of growing, high-impact open source communities. Its world-class hosting services enable the Linux operating system, Apache web server, the Drupal content management system and over 50 other leading open source software projects to collaborate with contributors and distribute software to millions of users globally. http://osuosl.org/ We migrated mucgh of http://osgeo.org there a while ago and have found OSUOSL to be a great outfit to work with :-) Cheers Norman ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] VS2010 64bit compile problem
Hi, I get errors, when I try to compile my project on visual studio for 64bit platform. Before on ANYCPU configurations I had no problems. The error which I get is variable WINGDIAPI is not a type name c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h and other 150 errors because of this wingdiapi. I changed the platform, preprocessor definitions to WIN64;_WIN64;_DEBUG, the path to 64bit dlls, libs and include directory. What else should I change? I am sending my project in the attachment. One more question: Is there any performance or other advantage if compiled for 64bit instead of anyCPU? Thank you! Cheers, Peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44570#44570 Attachments: http://forum.openscenegraph.org//files/osg64bit_718.zip ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hi, You should post which OS version and which VS Version you use. Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44571#44571 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Yes, sorry, I'm using VS2010 on Windows 7 64bit Peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44572#44572 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hi, sorry, I can't help you: I use VS 2008 in 32 and 64 bit. Good luck! Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44573#44573 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hi, On Wed, Jan 4, 2012 at 10:52 AM, Peter Bako osgfo...@tevs.eu wrote: Hi, I get errors, when I try to compile my project on visual studio for 64bit platform. Before on ANYCPU configurations I had no problems. The error which I get is variable WINGDIAPI is not a type name c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h This error usually means that you need to #include windows.h before #including GL/GL.h Cheers, Mourad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hi Peter, Le 04/01/2012 10:52, Peter Bako a écrit : Hi, I get errors, when I try to compile my project on visual studio for 64bit platform. Before on ANYCPU configurations I had no problems. The error which I get is variable WINGDIAPI is not a type name c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gl\gl.h and other 150 errors because of this wingdiapi. I changed the platform, preprocessor definitions to WIN64;_WIN64;_DEBUG, the path to 64bit dlls, libs and include directory. What else should I change? I am sending my project in the attachment. One more question: Is there any performance or other advantage if compiled for 64bit instead of anyCPU? Thank you! There is no attachment to this thread, but IIRC, AnyCPU is a C# thing, not C++ If you are really compiling C++, then, as Mourad said, be sure you included windows.h before gl/gl.h Regards, -Fred ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPPU] Fixed crash in UnitTexture, when external texture has no image.
Thank you! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43990#43990 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hi Peter, That quite a common issue, Mourad is probably correct, windows.h being included after gl.h...instead of before. Cheers Martin -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Peter Bako Sent: 04 January 2012 10:07 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] VS2010 64bit compile problem Yes, sorry, I'm using VS2010 on Windows 7 64bit Peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44572#44572 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hi! Thank you very much, you were right, I have to include windows.h on the very beginning. So now I am able to compile my app but now I get an error after launch :-(. The application was unable to start correctly (0xc07b). Click OK to close the application. Does anyone have an idea what should I do? Thank you once again! Cheers, Peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44581#44581 Attachments: http://forum.openscenegraph.org//files/error_596.png ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hi, use dependencywalker to get an idea which dll is missing. additionally read windows' application log to get an more etailed error description. Thank you! Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44582#44582 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] setUseVertexBufferObjects(..) create problem in osg 3.0.1
Hi, I have written a program using visual studio 2008 and osg 2.8.5. In this program I was using geometry-setUseDisplayList( false ); //Disable display lists geometry-setUseVertexBufferObjects( true ); //Enable VBO But when I switch higher version of visual studio (2010) and osg ( 3.0.1), it create problem. When I comment above line program works fine. I am using graphics card: NVIDIA GeoForce 6800 XT (Microsoft Corporation - WDDM) Is that problem due to graphics card? Thank you! Cheers, Lalit -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44583#44583 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS2010 64bit compile problem
Hello zonk and others! Thank you for the idea to use dependency walker, I haven't used it before. Now I found out, that x86 libraries are used at runtime instead of x64, because I forgot to put the path to x64 dlls into the %PATH% variable. Thank you very much! Peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44584#44584 ___ 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?
On 1/3/2012 11:43 PM, J.P. Delport wrote: Hi, On 03/01/2012 23:39, wang shuiying wrote: 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. I have to agree. Attaching an Image to a Camera doesn't render to the Image. It forces a glReadPixels() every frame to copy the pixel data into the Image. It looks like he's rendering into the default framebuffer, and I don't see anything to indicate that he has specifically asked for alpha in the default framebuffer. A glReadPixels() from a source that doesn't contain alpha will return 1.0 for the alpha, as I said previously. To fix the issue, he can either render into an FBO with a RGBA texture for the color buffer, or he can configure GraphicsContext::Traits to request alpha in the default framebuffer. -Paul ___ 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, J.P. I am really confused now. I just want to get pre-rendering information from a camera through an image, which is attached to the camera. But I don't want to draw the image onto a texture. The rendering process goes through programmable shader and I need to write four different variables into the four elements of gl_fragcolor in fragment shader. But the fourth element of gl_fragcolor remains to be 1 when I read it through the related image. so what is the difference between FRAME_BUFFER_OBJECT and FRAME_BUFFER? And in what way do RenderTargetImplementation ( e.g. FRAME_BUFFER_OBJECT and FRAME_BUFFER) and BufferComponent(e.g.DEPTH_BUFFER, COLOR_BUFFER,) affect my program? how can I get the details as to how the renderTargetImplementation works? According to what you suggest, where I can access the code in RenderStage::runCameraSetUp ? Plus, is there something wrong with the osg website? when I want to take a look at prerender example, It needs a long time to get onto the website and the webpage turns out to be something like this: Traceback (most recent call last): File /usr/lib/python2.5/site-packages/trac/web/api.py, line 339, in send_error 'text/html') File /usr/lib/python2.5/site-packages/trac/web/chrome.py, line 684, in render_template data = self.populate_data(req, data) Best regards Shuiying On 01/04/2012 07:43 AM, J.P. Delport wrote: 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG website unresponsive
I should also point out that github provides free hosting for open source projects, including wiki... though I'm not sure that projects can have a forum on github. Just a thought. Matthew On Jan 3, 2012 11:10 PM, Torben Dannhauer tor...@dannhauer.info wrote: Hi , @ Chris I have a physical root server, and I use XEN for my own virtualization. In some month I plan to upgrade to a newer version with more RAM (http://www.hetzner.de/en/hosting/produkte_rootserver/ex4) It has a 100Mbit connection with 5 TB traffic per month. All above has only a 10Mbit connection. For me and my customers I need round about .5 TB Nevertheless, for permanent hosting I would like to know in detail about the requirements. Just an offer to solve the issue with the current hosting - especcially because Robert wrote that the funding is gone and the server will be closed for OSG. Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44568#44568 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] StateSet and Text, state sets may be shared inadvertently
Dear all, Trying to use different StateSet with different osgText::Text objects it happens that all text objects transparently may share the same StateSet depending on how the state sets are created. Image that we have two text objects t1 and t2, then the following calling sequences behave as follows: Case 1 t1-getOrCreateStateSet() // t2 with the default empty state set t1 will have a new StateSet and t2 will inherit it from its parent. Case 2 t1-getOrCreateStateSet() t2-getOrCreateStateSet() Both texts will use the same state Case 3 t1-setStateSet(a_state) t2-getOrCreateStateSet() Each object will have its own state. Case 4 t1-getOrCreateStateSet() t2-setStateSet(a_state) Each object will have its own state. Case 5 t1 // created first no stateset assigned t2-getOrCreateStateSet() Both texts will use the same state While it may make sense, it seems a bit weird to me. If this is the expected behaviour I couldn't find where does it say so in the reference. Is it actually supposed to work like that and what is the reason behind it? Thanks and regards, Juan PS I attach a simple program in case someone wants to verify my statements. #include osgViewer/Viewer #include osgText/Text #include osgText/Font #include osg/ShapeDrawable #include osg/Geode #include osg/Depth #include osg/Material #include iostream int main() { osgViewer::Viewer viewer; osg::Geode *geode = new osg::Geode(); geode-addDrawable (new osg::ShapeDrawable(new osg::Box(osg::Vec3(0, 0, 0), 20, 20, 20))); osgText::Text *text1 = new osgText::Text(); text1-setText(label1); text1-setPosition(osg::Vec3(10, 10, 10)); text1-setAxisAlignment(osgText::Text::SCREEN); geode-addDrawable(text1); // Uncommenting this line and commeting the other two below will cause // both labels to share the same text. //state = text1-getOrCreateStateSet(); osg::StateSet *state = new osg::StateSet(); //text1-setStateSet(state); //state-setAttributeAndModes //(new osg::Depth(osg::Depth::ALWAYS, 0, 1, false)); osg::Material *material = new osg::Material(); //material-setDiffuse(osg::Material::FRONT, osg::Vec4(1, 0, 0, 1)); //state-setAttributeAndModes(material); osgText::Text *text2 = new osgText::Text(); text2-setText(label2); text2-setPosition(osg::Vec3(-10, -10, -10)); text2-setAxisAlignment(osgText::Text::SCREEN); geode-addDrawable(text2); material = new osg::Material(); material-setDiffuse(osg::Material::FRONT, osg::Vec4(0, 0, 1, 1)); state = text2-getOrCreateStateSet(); state-setAttributeAndModes(material); viewer.setSceneData(geode); viewer.run(); } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG website unresponsive
On 1/4/2012 1:35 AM, Norman Vine wrote: The Oregon State University Open Source Lab is the home of growing, high-impact open source communities. Its world-class hosting services http://osuosl.org/services/hosting/ enable the Linux operating system, Apache web server, the Drupal content management system and over 50 other leading open source software projects to collaborate with contributors and distribute software to millions of users globally. http://osuosl.org/ We migrated mucgh of http://osgeo.org there a while ago and have found OSUOSL to be a great outfit to work with :-) That sound promising. Cheers Norman -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. There is no Truth. There is only Perception. To Perceive is to Exist. - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] What callback for setting the viewMatrix of the camera every frame?
Hi, I used a class derived from osgGA:StandardManipulator and in the handle() i caught the FRAME event type. Thank you! Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44590#44590 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shader that can calculate pixel depth in meters
Thanks GMan for the reply and the source code, much appreciated. I was able to tweak your shaders for my needs and I think I am off to a good start. However I'm still not sure exactly what coordinate system I'm dealing with. In my case, I have an osg terrain loaded in in geocentric coordinates with various trees and other objects placed on the terrain. I will then set my camera position. When I visualize he scene, I have to apply a shader that is able to tell me, in meters, the distance between the camera and whatever object is being viewed in each pixel. For example, for a given camera angle, I may have a leaf of a tree in the upper left pixel of the frame. I need to be able to get the distance in meters from the camera to that leaf so that I can apply some scientific equations and recolor that pixel. This is important because I have a modified osg viewer that reads in the red channel of the pixels from the framebuffer and does further calculations based on the value of that red channel. Most GLSL examples are geared at creating visual effects, whereas I am encoding real scientific data in the color bands and then decoding them at various steps so I can't just scale values according to what looks best. Any advice on how I might get the distance in meters (assuming that every osg object in my scene has been loaded in already in meters)? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44591#44591 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shader that can calculate pixel depth in meters
Your issue is a relatively straightforward linear algebra problem. If you didn't pick up this skill set in grade school or a university-level course, It's unlikely someone will teach you linear algebra on this mail list. (Not trying to sound like a know-it-all; it's simply a fact that software developers attempting to code 3D graphics should have a strong background in linear algebra.) The OpenGL red book contains a good overview of OpenGL's coordinate spaces, plus there are many good linear algebra books that focus on 3D graphics. You could also hire a consultant to code the solution for you. Does the distance computation have to run on the GPU? For example, you could read back the depth buffer and then do the distance computation on the CPU. CPU code to do this already exists; see SceneView::projectWindowIntoObject(), in SceneView.cpp at line 1481 as one example. (Note this back-transforms to object space, not world space, so modify it if necessary to suit your situation.) If the code has to run on the GPU, certainly you can use the SceneView function as inspiration. -Paul On 1/4/2012 12:41 PM, Ethan Fahy wrote: Thanks GMan for the reply and the source code, much appreciated. I was able to tweak your shaders for my needs and I think I am off to a good start. However I'm still not sure exactly what coordinate system I'm dealing with. In my case, I have an osg terrain loaded in in geocentric coordinates with various trees and other objects placed on the terrain. I will then set my camera position. When I visualize he scene, I have to apply a shader that is able to tell me, in meters, the distance between the camera and whatever object is being viewed in each pixel. For example, for a given camera angle, I may have a leaf of a tree in the upper left pixel of the frame. I need to be able to get the distance in meters from the camera to that leaf so that I can apply some scientific equations and recolor that pixel. This is important because I have a modified osg viewer that reads in the red channel of the pixels from the framebuffer and does further calculations based on the val ue of that red channel. Most GLSL examples are geared at creating visual effects, whereas I am encoding real scientific data in the color bands and then decoding them at various steps so I can't just scale values according to what looks best. Any advice on how I might get the distance in meters (assuming that every osg object in my scene has been loaded in already in meters)? ___ 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, To J.P. and Paul: Thank you both very much ! After I change the renderTargetImplementation from FRAME_BUFFER to FRAME_BUFFER_OBJECT , it works! That is, I can get the fourth element of gl_FragColor modified in Fragment Shader though image. Plus, the camera in question is a pre-render camera, not the main scene camera. Thank you very much again and Cheers Shuiying On 01/05/2012 07:48 AM, J.P. Delport wrote: Hi, On 04/01/2012 17:17, wang shuiying wrote: Hi, J.P. I am really confused now. I just want to get pre-rendering information from a camera through an image, which is attached to the camera. I assume this camera is a different camera from your main scene camera? If so, I'd recommend using this camera to render to an FBO with the pixel format you want. You can read back the data to an image. But I don't want to draw the image onto a texture. Why not? The data needs to go somewhere into GPU memory anyway. An image is always a copy of GPU memory to CPU memory. FBO is flexible. The rendering process goes through programmable shader and I need to write four different variables into the four elements of gl_fragcolor in fragment shader. But the fourth element of gl_fragcolor remains to be 1 when I read it through the related image. Like Paul said before, if the target you are rendering to does not have (which is common for frame buffer targets) an alpha (fourth) channel, then the value you get back would be 1.0 always. so what is the difference between FRAME_BUFFER_OBJECT and FRAME_BUFFER? This question requires a very long answer and you should probably check the OpenGL spec or a book, but in short: the frame buffer is what gets drawn onto the screen, an FBO is an internal OpenGL object that normally has a texture/textures associated with it that is specifically there for doing off-screen rendering. And in what way do RenderTargetImplementation ( e.g. FRAME_BUFFER_OBJECT and FRAME_BUFFER) and BufferComponent(e.g.DEPTH_BUFFER, COLOR_BUFFER,) affect my program? It determines where you render to, whether frame buffer/FBO and in the case of FBO you can attach your own textures to receive the colour and depth information from the camera rendering. how can I get the details as to how the renderTargetImplementation works? According to what you suggest, where I can access the code in RenderStage::runCameraSetUp ? Download the OSG source code. Use a subversion client and point it to this url: https://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk Then check in src/osgUtil for RenderStage.cpp Plus, is there something wrong with the osg website? Yes, there is currently some problem. Please look at the osgprerender example as soon as you have the source code. regards jp when I want to take a look at prerender example, It needs a long time to get onto the website and the webpage turns out to be something like this: Traceback (most recent call last): File /usr/lib/python2.5/site-packages/trac/web/api.py, line 339, in send_error 'text/html') File /usr/lib/python2.5/site-packages/trac/web/chrome.py, line 684, in render_template data = self.populate_data(req, data) Best regards Shuiying On 01/04/2012 07:43 AM, J.P. Delport wrote: 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); //