<div dir="ltr"><div>Hi Luigi,</div><div><br></div><div>The OSG can render to a framebuffer that is defined by a Window or a PixelBuffer. If you want a RGBA image from either of these you'll need to use a Camera final draw callback to do a glReadPixel or osg::Image::readPixels(..) call to copy the framebuffer data that resides on the GPU back to the CPU so you can use it. This round trip is relatively slow though. <br></div><div><br></div><div>The most efficient way to render the vertex graphics together with 3D will render the vector graphics with OpenGL/OSG so there is no need to copy any data, you just render it all together. <br></div><div><br></div><div>Robert.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 9 Nov 2020 at 16:00, OpenSceneGraph Users <<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>We are in need of wrapping the OSG library inside a vector graphic environment.</div><div>The vector graphic environment doesn't offer any OpenGL functionality in and of itself, however there is a function in its SDK to create and display a bitmap image given an array of bytes.</div><div><br></div><div>/**<span style="white-space:pre-wrap"> </span>Create an image surface from given pixel data.</div><div><span style="white-space:pre-wrap"> </span>Data should point to start of top line of bitmap, stride tells how to get to next line. </div><div><span style="white-space:pre-wrap"> </span>For upside down windows bitmaps, data = (pBits-(height-1)*stride) and stride is a negative number.</div><div><span style="white-space:pre-wrap"> </span>@ingroup<span style="white-space:pre-wrap"> </span>jsurface</div><div><span style="white-space:pre-wrap"> </span>@param<span style="white-space:pre-wrap"> </span>data<span style="white-space:pre-wrap"> </span>The data. For example, an RGBA image loaded in memory.</div><div><span style="white-space:pre-wrap"> </span>@param<span style="white-space:pre-wrap"> </span>format<span style="white-space:pre-wrap"> </span>The format of the data.</div><div><span style="white-space:pre-wrap"> </span>@param<span style="white-space:pre-wrap"> </span>width<span style="white-space:pre-wrap"> </span>The width of the new surface.</div><div><span style="white-space:pre-wrap"> </span>@param<span style="white-space:pre-wrap"> </span>height<span style="white-space:pre-wrap"> </span>The height of the new surface.</div><div><span style="white-space:pre-wrap"> </span>@param<span style="white-space:pre-wrap"> </span>stride<span style="white-space:pre-wrap"> </span>The number of bytes between the start of rows in the data buffer.</div><div><span style="white-space:pre-wrap"> </span>@param<span style="white-space:pre-wrap"> </span>freefun<span style="white-space:pre-wrap"> </span>If not NULL, freefun will be called when the surface is destroyed</div><div><span style="white-space:pre-wrap"> </span>@param<span style="white-space:pre-wrap"> </span>freearg<span style="white-space:pre-wrap"> </span>This will be passed to freefun if/when freefun is called.</div><div><span style="white-space:pre-wrap"> </span>@return<span style="white-space:pre-wrap"> </span>A pointer to the new surface.<span style="white-space:pre-wrap"> </span></div><div>*/</div><div>t_jsurface* jgraphics_image_surface_create_for_data(unsigned char *data, t_jgraphics_format format, int width, int height, int stride, method freefun, void *freearg);</div><div><br></div><div>The question is whether it is possible to extract the graphical output of the OSG Viewer as raw RGBA bytes. Then we could use the above function to basically create a pixel dump of the OSG viewer output and have the 2D vector graphic environment display it.</div><div><br></div><div>Thanks for any help</div><div>Regards</div><div><br></div><div>- Luigi</div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com" target="_blank">osg-users+unsubscribe@googlegroups.com</a>.<br>
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/1d655ece-f41b-4599-b9a8-30903c42f390n%40googlegroups.com?utm_medium=email&utm_source=footer" target="_blank">https://groups.google.com/d/msgid/osg-users/1d655ece-f41b-4599-b9a8-30903c42f390n%40googlegroups.com</a>.<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>