OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Image capture in memory


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
icf80
User


Joined: 12 Apr 2019
Posts: 22

PostPosted: Fri Apr 12, 2019 6:11 pm    Post subject:
Image capture in memory
Reply with quote

Hi,

What is the canonical way to capture an image of a view to memory with different resolutions?

Thank you!
Back to top
View user's profile Send private message
Alberto Luaces
Guest





PostPosted: Tue Apr 16, 2019 2:52 pm    Post subject:
Image capture in memory
Reply with quote

"Catalin Flower" writes:

Quote:
Hi,

What is the canonical way to capture an image of a view to memory with different resolutions?

Hi, I think that examples/osgposter/osgposter.cpp might be what you are
looking for.

--
Alberto



------------------
Post generated by Mail2Forum
Back to top
sbrkopac
Newbie


Joined: 14 Jun 2018
Posts: 19

PostPosted: Tue Apr 16, 2019 6:30 pm    Post subject:
Image capture in memory
Reply with quote

https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osgposter/osgposter.cpp  


On Tue, Apr 16, 2019 at 12:22 PM Catalin Flower < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,

What is the canonical way to capture an image of a view to memory with different resolutions?

Thank you!

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
icf80
User


Joined: 12 Apr 2019
Posts: 22

PostPosted: Tue Apr 23, 2019 11:57 am    Post subject:
Reply with quote

Hi,

The example is quite complex, it works if I run it.

I have two issues:

1) I am trying to copy the code to my app, I cannot get the any image output for some reason
2) It creates windows, I don't want to see windows flashing on the screen while the capture happens

I don't understand what it is doing.

Thank you!

Cheers,
Catalin
Back to top
View user's profile Send private message
Alberto Luaces
Guest





PostPosted: Wed Apr 24, 2019 7:30 am    Post subject:
Image capture in memory
Reply with quote

"Catalin Flower" writes:

Quote:
2) It creates windows, I don't want to see windows flashing on the screen while the capture happens

If I recall correctly, this is what the pbuffer option does, setting

renderImplementation = osg::Camera::PIXEL_BUFFER;

You can try the others to see the effect, though.

--
Alberto



------------------
Post generated by Mail2Forum
Back to top
icf80
User


Joined: 12 Apr 2019
Posts: 22

PostPosted: Wed Apr 24, 2019 8:33 am    Post subject:
Reply with quote

Hi Alberto,

This example is half baked as I see it:

if you run it:

osgposter.exe cow.osg --inactive --use-pbuffer

--inactive - suppose to be without windows but it creates a window anyway
--use-pbuffer still creates a window

This is the code path that I tried to import in my app but no image is generated and it creates a black .bmp image.

if you run it:

osgposter.exe cow.osg

if you can see the cow in a window and you can press 'P' and it captures an image fine to the disk

I need a simple example to capture an image off-screen without any windows popping up on screen. This is a basic feature that should be simple implement and understand.

Does OSG even support such a basic feature?


Thank you!

Cheers,
Catalin
Back to top
View user's profile Send private message
icf80
User


Joined: 12 Apr 2019
Posts: 22

PostPosted: Wed Apr 24, 2019 9:12 am    Post subject:
Reply with quote

Hi,

pbuffer seems to be the old way of doing offscreen rendering.


Pbuffers and Frame buffer objects (FBO) are two methods for rendering to an offscreen buffer
The major difference between a Pbuffer and an FBO is that each Pbuffer needs its seperate OpenGL context, as opposed to FBOs where you can have as many FBOs as (sanely) possible in one OpenGL context.
Pbuffers are older and considered obsolete, the FBO extension is the best method for rendering to textures as of now, in my opinion.

By default osgposter uses frame buffer objects:
osg::Camera::RenderTargetImplementation renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;

Thank you!

Cheers,
Catalin
Back to top
View user's profile Send private message
Trajce Nikolov NICK
Guest





PostPosted: Wed Apr 24, 2019 9:29 am    Post subject:
Image capture in memory
Reply with quote

Hi Catalin,


I don't have build env at the moment but looking into the code, can you try this:


osgposter.cpp, Ln: 377
just add: viewer_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);


this shouldn't open any window




On Wed, Apr 24, 2019 at 11:12 AM Catalin Flower < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Alberto,

This example is half baked as I see it:

if you run it:

osgposter.exe cow.osg --inactive --use-pbuffer

--inactive - suppose to be without windows but it creates a window anyway
--use-pbuffer still creates a window

This is the code path that I tried to import in my app but no image is generated and it creates a black .bmp image.

if you run it:

osgposter.exe cow.osg

if you can see the cow in a window and you can press 'P' and it captures an image fine to the disk

I need a simple example to capture an image off-screen without any windows popping up on screen. This is a basic feature that should be simple implement and understand.

Does OSG even support such a basic feature?


Thank you!

Cheers,
Catalin

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
icf80
User


Joined: 12 Apr 2019
Posts: 22

PostPosted: Wed Apr 24, 2019 9:39 am    Post subject:
Reply with quote

Hi,

osg::Camera::RenderTargetImplementation renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;
...
camera->setRenderTargetImplementation( renderImplementation );

By default it is using FBO, osgposter.cpp line 259 & 315

This example is created with windows in mind I guess, I want a pure example without
osgViewer::Viewer being used.

Thank you!

Cheers,
Catalin
Back to top
View user's profile Send private message
icf80
User


Joined: 12 Apr 2019
Posts: 22

PostPosted: Tue May 21, 2019 1:06 pm    Post subject:
Reply with quote

Hi,

For future reference...

OSG (windows at least) supports off screen rendering without any window flashing on the screen by using pbuffer.

When you create the Traits object, set traits->pbuffer = true;

See example osgscreencapture, see pbuffer-only parameter.

Start the example with osgscreencapture --pbuffer-only 512 512 cow.osg

Thank you!

Cheers,
Catalin
Back to top
View user's profile Send private message
Chris Hanson
Guest





PostPosted: Tue May 21, 2019 8:49 pm    Post subject:
Image capture in memory
Reply with quote

Additional note: At this time, I think it's recommended to use FBOs (Frame Buffer Objects) instead of PBuffers.

On Tue, May 21, 2019 at 3:06 PM Catalin Flower < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi,

For future reference...

OSG (windows at least) supports off screen rendering without any window flashing on the screen by using pbuffer.

When you create the Traits object, set traits->pbuffer = true;

See example osgscreencapture, see pbuffer-only parameter.

Start the example with osgscreencapture --pbuffer-only 512 512 cow.osg

Thank you!

Cheers,
Catalin

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Chris 'Xenon' Hanson, omo sanza lettere. 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]

------------------
Post generated by Mail2Forum
Back to top
icf80
User


Joined: 12 Apr 2019
Posts: 22

PostPosted: Wed May 22, 2019 8:15 am    Post subject:
Reply with quote

Hi Chris,

I would be happy to use FBO, but I have no idea how to!

Please give me an example.

Thank you!

Cheers,
Catalin
Back to top
View user's profile Send private message
Chris Hanson
Guest





PostPosted: Wed May 22, 2019 9:49 am    Post subject:
Image capture in memory
Reply with quote

I think there was some code in this post:http://forum.openscenegraph.org/viewtopic.php?t=17504 


It was failing to resize dynamically, but it doesn't sound like that would be an issue for you. 



On Wed, May 22, 2019 at 10:15 AM Catalin Flower < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Chris,

I would be happy to use FBO, but I have no idea how to!

Please give me an example.

Thank you!

Cheers,
Catalin

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Chris 'Xenon' Hanson, omo sanza lettere. 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]

------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts problem about reconstructing world co... swaggydong General 0 Sun Jun 23, 2019 8:26 am View latest post
No new posts remove mipmap data from osg::Image Trajce Nikolov NICK General 0 Tue May 28, 2019 2:40 pm View latest post
No new posts Memory not being released, causing crash Juanelm General 1 Thu May 16, 2019 10:15 pm View latest post
No new posts Write Image From texture Generated by... GarfieldPig General 1 Wed May 08, 2019 11:42 am View latest post
No new posts Image::copySubImage freqfly General 0 Tue Dec 04, 2018 12:32 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP