Reading Back/Front buffer?
-
- Posts: 20
- Joined: Mon Feb 16, 2015 3:05 pm
Reading Back/Front buffer?
Is it possible to do so?
I want to be able to "print screen" and just save the buffer.
I know i can set everything to render to a texture, but i don't see how that's actually good as i have to do everything twice, so it's better to just copy the buffer instead of making a "new one".
I want to be able to "print screen" and just save the buffer.
I know i can set everything to render to a texture, but i don't see how that's actually good as i have to do everything twice, so it's better to just copy the buffer instead of making a "new one".
Re: Reading Back/Front buffer?
createScreenshot()
-
- Posts: 20
- Joined: Mon Feb 16, 2015 3:05 pm
Re: Reading Back/Front buffer?
Can that be used for making video recordings as well? (getting 60fps = 60images, and then of course some other code for the video stuff).
EDIT:
Seems like it pretty much takes screenshots like windows does, cause if windows get behind something the screenshot is of that instead.
So it's no copying the buffer i guess:S
EDIT:
Seems like it pretty much takes screenshots like windows does, cause if windows get behind something the screenshot is of that instead.
So it's no copying the buffer i guess:S
Re: Reading Back/Front buffer?
No it's not copying the buffer - and it's even very slow (creating a new Image each time). Screenshot functionality should be improved. But as alternative - try using render-to-texture. Maybe it's faster than this.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 20
- Joined: Mon Feb 16, 2015 3:05 pm
Re: Reading Back/Front buffer?
but in order to use that, don't i have to double the drawing?
Cause when i render to texture buffer is blank, can i render to both at the same time without having to double the code and doing the drawing twice?
Cause when i render to texture buffer is blank, can i render to both at the same time without having to double the code and doing the drawing twice?
Re: Reading Back/Front buffer?
You could use the rendered texture and draw that. So you render the scene once - and then draw that texture on a screen-quad (search for XEffects in this forum, it has a screenquad node I think).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Reading Back/Front buffer?
Hi Zerowalker,
Probably obvious, but when I want to save a screen shot I just hit the printscreen button. I have it linked to dropbox, so as soon as I hit the printscreen button it saves the screen to dropbox. Then I sometimes crop it in photoshop.
Probably obvious, but when I want to save a screen shot I just hit the printscreen button. I have it linked to dropbox, so as soon as I hit the printscreen button it saves the screen to dropbox. Then I sometimes crop it in photoshop.
-
- Posts: 20
- Joined: Mon Feb 16, 2015 3:05 pm
Re: Reading Back/Front buffer?
Well the thing isn't about just print screening, it's supposed to be automatic and also be possible to record a video with it (though that's more complex and it's nothing i will try to achieve now;P).
Re: Reading Back/Front buffer?
There is a way to read (more correctly said, undersample) the backbuffer to a texture, a rendertarget anyway, in DX you can use the stretchrect function, i don't know in GL. But I also guess that for both options it would be better to modify the engine on your own so you added that method to the video driver. It is much faster than the create screenshot option and retains the MSAA from the backbuffer.
Or the render to texture option, which is quite valid as well, keep in mind that the render may happen only once, and you can draw the results to the screen any number of times you want, or you may access afterwards the data, just keep in mind that if you do that later, you will be moving the data back and forth from the video memory to the system memory, and that is the slowest part, so, if you have to do it, make it count.
Or the render to texture option, which is quite valid as well, keep in mind that the render may happen only once, and you can draw the results to the screen any number of times you want, or you may access afterwards the data, just keep in mind that if you do that later, you will be moving the data back and forth from the video memory to the system memory, and that is the slowest part, so, if you have to do it, make it count.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
-
- Posts: 20
- Joined: Mon Feb 16, 2015 3:05 pm
Re: Reading Back/Front buffer?
Well i guess modifying the engine somehow is the way to go. Sadly that's a bit out of my knowledge.
But i guess if i can understand it a bit it shouldn't be that hard to be able to grab a pointer to it.
But i guess if i can understand it a bit it shouldn't be that hard to be able to grab a pointer to it.
-
- Posts: 20
- Joined: Mon Feb 16, 2015 3:05 pm
Re: Reading Back/Front buffer?
Okay trying to figure out how to implement this:
http://www.codeproject.com/Articles/505 ... the-screen
As i guess that's pretty much what we want right?
Though i get linking error even though d3d9.lib should be there, so yeah..stuck;P
it complains on: extern IDirect3DDevice9* g_pd3dDevice;
And that even works on my own application, so confused how it can't be working on the irrlicht source code.
EDIT:
i got the pointer and all, not sure what i am supposed to do with stretchrect as i needs to copy from one rect to another, which means i have to use the first method anyway to get the first surface?
http://www.codeproject.com/Articles/505 ... the-screen
As i guess that's pretty much what we want right?
Though i get linking error even though d3d9.lib should be there, so yeah..stuck;P
it complains on: extern IDirect3DDevice9* g_pd3dDevice;
And that even works on my own application, so confused how it can't be working on the irrlicht source code.
EDIT:
i got the pointer and all, not sure what i am supposed to do with stretchrect as i needs to copy from one rect to another, which means i have to use the first method anyway to get the first surface?