using irrlicht in a background application?
-
- Posts: 15
- Joined: Sun Feb 24, 2008 4:27 am
using irrlicht in a background application?
First, I'm very excited to be using Irrlicht. It looks great.
My issue is that I need to use Irrlicht strictly to render to an offscreen buffer. I don't want a window, event handling or anything else.
createDevice and createDeviceEx both seem to want to create windows or go into fullscreen mode. Should I be using something lower-level, or do I need to create a hidden window and use createDeviceEx to render to that?
Any help would be appreciated.
My issue is that I need to use Irrlicht strictly to render to an offscreen buffer. I don't want a window, event handling or anything else.
createDevice and createDeviceEx both seem to want to create windows or go into fullscreen mode. Should I be using something lower-level, or do I need to create a hidden window and use createDeviceEx to render to that?
Any help would be appreciated.
Try using EDT_NULL as driver type.
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: 15
- Joined: Sun Feb 24, 2008 4:27 am
I saw that, but from the description, it didn't sound like what I'm looking for. It's described as "Null device, useful for applications to run the engine without visualisation. The null device is able to load textures, but does not render and display any graphics."CuteAlien wrote:Try using EDT_NULL as driver type.
I do want it to render, and I do want to use hardware acceleration. I just want it to render only into my offscreen buffer.
Any more tips?
Try using createDeviceEx and pass it a NULL window handle. That, or integrate the application into a wxWidgets or window form, and set that form to not visible.
Cheers
Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
- Posts: 15
- Joined: Sun Feb 24, 2008 4:27 am
Yes, exactly right. I just want my application to run invisibly in the background, rendering images to an offscreen buffer. Don't ask me why, this is the requirement.TheBeef wrote:What exactly are you trying to do?
It sounds like you want to do everything that Irrlicht is supposed to, but only to an 'offscreen buffer,' for a 'background application.'
So I'm stumped. I have tried createDeviceEx using both NULL and a existing window handle. In both cases, Irrlicht created a new window.
I'm also not clear how to render to a bitmap. I can see how to render to a texture, but I hope there's a better way.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
I'm not sure if this is possible. AFAIK, both hw drivers require a window to set up the necessary drivers. It would indeed be necessary to pass Irrlicht a window handle which is already set up for the proper driver, and hide that one. Please check example 14 for how to pass the window handle in a way that Irrlicht uses that one instead of creating its own.
-
- Posts: 15
- Joined: Sun Feb 24, 2008 4:27 am
Thanks for all of your help.
So I am successfully rendering to a hidden window using a texture as a target, and obtaining the bitmap by calling the texture's Lock and Unlock methods.
This seems like a workable solution. The reason I wasn't thrilled with using a texture was mainly because of the size restriction. I really wanted to use 640 by 480, but am hoping that 512 x 512 will work. That decision is up to the client.
If there's a more flexible and/or more efficient solution, I'd love to hear it - otherwise I'll stick with this approach.
So I am successfully rendering to a hidden window using a texture as a target, and obtaining the bitmap by calling the texture's Lock and Unlock methods.
This seems like a workable solution. The reason I wasn't thrilled with using a texture was mainly because of the size restriction. I really wanted to use 640 by 480, but am hoping that 512 x 512 will work. That decision is up to the client.
If there's a more flexible and/or more efficient solution, I'd love to hear it - otherwise I'll stick with this approach.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Which driver do you use for the render job? d3d and opengl do handle this stuff a little different, but there are also some bugfixes to come in the next version (opengl and ATI have a problem with FBO support, and d3d is limited to something smaller than the current window). Also, some drivers do support non-POT textures, for which you could check and choose the proper size depending on this (might happen automatically, show us your RTT init code).
-
- Posts: 15
- Joined: Sun Feb 24, 2008 4:27 am
Actually, my solution doesn't work in OpenGL, only in DirectX and the software renderers. This makes me sad, because we will need a Mac version one day.hybrid wrote:Which driver do you use for the render job? d3d and opengl do handle this stuff a little different, but there are also some bugfixes to come in the next version (opengl and ATI have a problem with FBO support, and d3d is limited to something smaller than the current window). Also, some drivers do support non-POT textures, for which you could check and choose the proper size depending on this (might happen automatically, show us your RTT init code).
I am using a power of two (512 x 512) but it may be too big for OpenGL. And yes, I'm initializing the window to be 512 x 512 as well.
The other reason I'm not so psyched about using a texture is that they seem to always be 32 bits per pixel, and I have to convert it down to 24 bits. Not a big deal, but overhead I'd like to avoid.
Any other approaches I could try?