Hi Robert, many thanks. I fully understand your "you are the only one".
"First ...": OK, I'll try to modify my shader code to use the built in uniforms. I'll let you know about the result. "Secondly ..." : My intention is getting high resolution screen shots (> 400 DPI). glReadPixels() is working fine but gives just the screen resolution. Also modifying projections in a loop and using glReadPixels() works fine,
but the flickering on the screen is not acceptable."Finally ...": I'll transfer my project to other systems and check it out there. But I don't believe in that. Usually the latest NVIDIA drivers are quite good and without geometry shaders everything works perfect with PBO.
Thanks anyway. - Werner - Am 17.12.2014 um 15:44 schrieb Robert Osfield:
Hi Werner,I haven't got your code in front of me to know what might be amiss. As you are the only one with the actual code, the actual OS and hardware combination that is producing the particular problem you are seeing I'm afraid you're the only one who can do any direct debugging of the issue. All the rest of us can do is guess.First up, do you need to use the State::setUse*(true) that you are using? You don't need either if you shaders are just using gl_ModelViewMatrix etc in your shaders, it's only if you are using osg_ModelViewMatrix etc. that you need to use these. I really don't know if there might be some association between the above and the problems you are having.Secondly, perhaps there is some kind of issue with PBO usage. You don't need to use PBO's for screen capture, a directly glReadPixels() will work fine is a little slow. For debugging the issue try just disabling the PBO code.Finally, have a look at other systems - hardware, OS, drivers so see if there is particular issue on hour system that doesn't appear on others. It could even be that geometry shaders aren't supported.Robert.On 17 December 2014 at 10:40, Werner Modenbach <werner.modenb...@texion.eu <mailto:werner.modenb...@texion.eu>> wrote:Hi all, unfortunately I can't manage to solve my problem. Maybe I wasn't clear enough. Doing an offscreen rendering of my scene including my own vertex and fragment shaders to a PBO via a slave camera worked fine until I started using a geometry shader. For this one to work I had to set setUseModelViewAndProjectionUniforms(true) and setUseVertexAttributeAliasing(true) to the graphics context of my screen window. Doing the same settings to the context of the PBO doesn't show up the scene in the PBO. I can't figure out if I have to do some more settungs to the new render target or if the shaders don't work on PBO. Where is my mistake? - Werner - BTW OSG is NOT compiled against gl3! Am 15.12.2014 um 11:30 schrieb Werner Modenbach:Hi Robert, thanks for the really quick answer. I didn't compile OSG againt gl3 because I also need the possibility to run my program without gl3 in simpler cases. That is why in case of gl3 I use setUseModelViewAndProjectionUniforms() etc. The intention of the code is creating high res screenshots without visual impact to the screen. I do this by using a separate camera, giving it a PBO as render target and doing several render steps with moving projection matrices. The screenshot camera I add as a slave to the view. Is this a wrong or overloaded approach? - Werner - Am 15.12.2014 um 11:17 schrieb Robert Osfield:Hi Werner, I can't really work out what you are doing a why from your code, it would appear that you are conflating various elements that don't need to be. I am left rather confused by trying to second guess what you are trying to achieve and why you've cobbled together this particular combination of code to achieve it. Could you take a step back and tell us what end result you are looking for in your application. As a general note, you don't need to compile the OSG against a GL3 target to use geometry shaders - you can just use them with a normal default build of the OSG, The OSG queries for a sets up extensions individually. Robert. On 15 December 2014 at 10:04, Werner Modenbach <werner.modenb...@texion.eu <mailto:werner.modenb...@texion.eu>> wrote: Dear all, I'm using OSG now for years and I'm very satisfied. In one of my projects I'm very much related to using geometry shaders and so I have to use gl3 features. I do this by settingcamera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(supportsOpenGL3()&&!forceGL2Mode);camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(supportsOpenGL3()&&!forceGL2Mode);I have to handle all calculations myself in the shaders and it works fine. Unfortunately I can't manage rendering to PBOs for getting high res snapshots etc. Here is what I do: doublescale=(double)image_dpi/(double)dpi; // Berechnung der Bildgroesse und der Anzahl der Teilbilder pro Zeile int width = (int) (view->getGraphicsWidth()); int height = (int) (view->getGraphicsHeight()); int imageWidth = (int)(width * scale); int imageHeight = (int)(height * scale); int tiles = (imageWidth - 1) / width + 1; osg::ref_ptr<osg::Camera>camera; osg::ref_ptr<osg::Image>image=newosg::Image; if(methode==PIXELBUFFER){ osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Tra it s; traits->x = 0; traits->y = 0; traits->width = width; traits->height = 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; osg::ref_ptr<osg::GraphicsContext> pbuffer = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!pbuffer.valid()) return QImage(); camera = new osg::Camera; camera->setGraphicsContext(pbuffer.get()); camera->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(use_gl3); camera->getGraphicsContext()->getState()->setUseVertexAttributeAliasing(use_gl3); camera->setViewport(new osg::Viewport(0,0,width,height)); camera->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); camera->setReferenceFrame( osg::Transform::ABSOLUTE_RF ); camera->setRenderTargetImplementation(osg::Camera::PIXEL_BUFFER); GLenum buffer = pbuffer->getTraits()->doubleBuffer ? GL_BACK : GL_FRONT;camera->setDrawBuffer(buffer);camera->setReadBuffer(buffer);view->addSlave(camera.get(), true);osg::ref_ptr<osg::PixelBufferObject> pbo= new osg::PixelBufferObject(image.get( ));image->setPixelBufferObject(pbo.get());image->allocateImage(width,height,1,GL_RGBA,GL_UNSIGNED_BYTE, 1);camera->attach( osg::Camera::COLOR_BUFFER, image.get());pbuffer->realize();} else .... Then I move arround the camera by giving offsets to the projection matrix and call the frame() method.This works very fine except when using gl3 mode. I know I'm missing just a little thing but I can't figure it out. I think the problem why PPU package doesn't work any more might be the same kind of problem. Any hint would be highly appreciated. - Werner --- *TEXION Software Solutions, Rotter Bruch 26a, D-52068Aachen* Phone: +49 241 475757-0 Fax: +49 241 475757-29 <tel:%2B49%20241%20475757-29> Web: http://texion.eu eMail: i...@texion.eu <mailto:i...@texion.eu>_______________________________________________ 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-- *TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen*Phone: +49 241 475757-0 Fax: +49 241 475757-29 <tel:%2B49%20241%20475757-29> Web: http://texion.eu eMail: i...@texion.eu <mailto:i...@texion.eu>-- *TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen*Phone: +49 241 475757-0 Fax: +49 241 475757-29 <tel:%2B49%20241%20475757-29> Web: http://texion.eu eMail: i...@texion.eu <mailto:i...@texion.eu> _______________________________________________ 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
-- *TEXION Software Solutions, Rotter Bruch 26a, D-52068 Aachen* Phone: +49 241 475757-0 Fax: +49 241 475757-29 Web: http://texion.eu eMail: i...@texion.eu
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org