Render to and take screenshots from a buffer that isn't the main frame buffer

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Eduuu
Posts: 3
Joined: Tue Nov 15, 2022 8:46 pm

Render to and take screenshots from a buffer that isn't the main frame buffer

Post by Eduuu »

Hi all

I was taking a look at the createScreenshot function and saw that it takes two optional arguments, the second of which being a render target. I am currently trying to get a headless copy of minetest running that will still allow you to take screenshots of what is going on "behind the scenes" (for reinforcement learning), so this was of interest to me. I thought that it could be possible to set this texture to something other than the main frame buffer and just "render" to this.

However, the argument accepted by createScreenshot is an enum that allows you to choose between a few "special" render targets. Even more strangely, one of the options is ERT_RENDER_TEXTURE, with the accompanying description "Render target is a render texture". On paper this sounds like the behaviour I want, but why is this a fixed-value enum? (I want to create a dummy target and pass it in here). I am very confused and would like this clearing up, and more generally if anyone has any suggestions as to how I might achieve my goal that would be awesome.

Thank you for your patience.
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Render to and take screenshots from a buffer that isn't the main frame buffer

Post by CuteAlien »

Sorry, this looks like a feature someone once planned but no one ever implemented. I've added a comment in svn trunk. There's no other options supported here besides the default (and not sure if there ever will be, I'd rather add other options like passing an existing IImage and also rendertargets work a lot different by now than they did in the past).
Maybe the idea was to take a screenshot from the currently active rendertarget texture. Which makes not that much sense to me right now, but I've not dig too deep into it.

If you want to use rendertargettextures please take a look at example 13.RenderToTexture. Can't help you much more with this as the concrete solution depends a lot on how your app implemented rendering.
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
Post Reply