Re: [osg-users] Viewer raw pixel data

2020-11-09 Thread OpenSceneGraph Users
Sure. What you're looking for is called Render To Texture, and there are a
variety of OSG Render To Texture examples around that do a variety of
things with that rendered texture, like save it to disk, etc.

On Mon, Nov 9, 2020 at 8:44 AM Luigi Castelli 
wrote:

> We are in need of wrapping the OSG library inside a vector graphic
> environment.
> 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.
>
> /** Create an image surface from given pixel data.
> Data should point to start of top line of bitmap, stride tells how to get
> to next line.
> For upside down windows bitmaps, data = (pBits-(height-1)*stride) and
> stride is a negative number.
> @ingroup jsurface
> @param data The data.  For example, an RGBA image loaded in memory.
> @param format The format of the data.
> @param width The width of the new surface.
> @param height The height of the new surface.
> @param stride The number of bytes between the start of rows in the data
> buffer.
> @param freefun If not NULL, freefun will be called when the surface is
> destroyed
> @param freearg This will be passed to freefun if/when freefun is called.
> @return A pointer to the new surface.
> */
> 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);
>
> 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.
>
> Thanks for any help
> Regards
>
> - Luigi
>
> --
> You received this message because you are subscribed to the Google Groups
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osg-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osg-users/1d655ece-f41b-4599-b9a8-30903c42f390n%40googlegroups.com
> 
> .
>


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS •
osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile •
iPhone/iPad/iOS • Android
@alphapixel  facebook.com/alphapixel (775)
623-PIXL [7495]

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/CAGoufma%3DuHVLZQkN%3D-7gRygYuZrOdpH964BvaDps%3D_fonhVM7A%40mail.gmail.com.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Viewer raw pixel data

2020-11-09 Thread OpenSceneGraph Users
Hi Luigi,

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.

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.

Robert.

On Mon, 9 Nov 2020 at 16:00, OpenSceneGraph Users <
osg-users@lists.openscenegraph.org> wrote:

> We are in need of wrapping the OSG library inside a vector graphic
> environment.
> 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.
>
> /** Create an image surface from given pixel data.
> Data should point to start of top line of bitmap, stride tells how to get
> to next line.
> For upside down windows bitmaps, data = (pBits-(height-1)*stride) and
> stride is a negative number.
> @ingroup jsurface
> @param data The data.  For example, an RGBA image loaded in memory.
> @param format The format of the data.
> @param width The width of the new surface.
> @param height The height of the new surface.
> @param stride The number of bytes between the start of rows in the data
> buffer.
> @param freefun If not NULL, freefun will be called when the surface is
> destroyed
> @param freearg This will be passed to freefun if/when freefun is called.
> @return A pointer to the new surface.
> */
> 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);
>
> 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.
>
> Thanks for any help
> Regards
>
> - Luigi
>
> --
> You received this message because you are subscribed to the Google Groups
> "OpenSceneGraph Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osg-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osg-users/1d655ece-f41b-4599-b9a8-30903c42f390n%40googlegroups.com
> 
> .
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/mailman.28412.1604939366.3538.osg-users-openscenegraph.org%40lists.openscenegraph.org.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/mailman.28412.1604939366.3538.osg-users-openscenegraph.org%40lists.openscenegraph.org.