[osg-users] How to resize when using PIXEL_BUFFER?

Giorge Koulin gosha.koulin at gmail.com
Tue Dec 12 03:25:57 PST 2017


Hi Robert,

I have come accross a similar issue. I am working on a GtkmmOsgViewer for gtkmm3. I have found this is to be quite challenging and was not able to use new Gtk::GLArea widget for this. Perhaps someone with better knowledge of OpenGL than myself could solve that problem. The code from examples/osgviewerGTK was useful however I decided to follow a slightly different approach.

I create pBuffer context and attach image to main camera. Then after each frame I redraw the image onto the cairo surface of the widget using cairo_image_surface_create_for_data() similar to osgPlugins/pdf/ReaderWriterPDF.cpp . So far I have been creating an oversized PixelBuffer and only using a subset of it, this avoids re-creating the context each time the widget is resized. I also have to set camera->RenderTargetImplementation(FRAME_BUFFER); as this is the only option that gives me image with transparency alpha values. The other implementations ignore alpha.

My problems are:

• I am unable to achieve multisampling of the image. I've tried setting traits->samples = 4; and also samples on camera->attach(COLOR_BUFFER, image, 4 /* samples */); . I have tried setting a scaled up viewport, for example scale = 4, and letting cairo downsample to achieve antialiasing. This is however very slow (in frame time) since CPU is used for this downsampling operation. How can I achieve multisampling for the attached image? 

• I think your advice "using a single PixelBuffer and then using a FrameBufferObject within this to do the rendering to and copying from" is great. Could you please explain how to do this? Are there any specific considerations for multisampling?


Looking forward to your answer.

Cheers,
Giorge

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72570#72570







More information about the osg-users mailing list