Integrating Irrlicht into existing 2D game

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
stuey
Posts: 3
Joined: Wed Feb 11, 2009 1:50 pm

Integrating Irrlicht into existing 2D game

Post by stuey »

Hi all,

I want to prove a 3d concept by adding irrlicht into an existing 2d game engine (DirectDraw) - with the aim of moving totally to irrlicht if it's suitable.

I want to blend a 3d image into my existing 2d drawing chain - I'm thinking the way to do this is to export my current backbuffer to irrlicht, use that as the background and render on top of it (as render to texture), then extract the rendered texture back into my backbuffer.

Is that possible? Is there a better way of doing it?

I have about 1hour's experience with Irrlicht so appologies if it's possible to get Irrlicht to render directly to a DirectDraw surface or backbuffer - that would be just heaven. Fingers crossed!

Thanks,
Stu
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

Hmm sounds like "i want to buy a new car but i am scared of changing. So i want combine both cars". May be there is a way but i guess it would be easier to invest one or two days to make a complete change.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

What you're proposing should work, although it won't be lightning fast.

Irrlicht can also render to any HWND, but it craps over it, so that's probably not a viable alternative. There's currently no way to pass a DDRAW surface in to the D3D9 driver; I'd suspect that it won't have the right caps anyway, but if you want to take a poke at the engine, it may be possible.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, if everything else fails you should be able to memcpy your backbuffer into an ITexture and render both into one window from inside Irrlicht.
stuey
Posts: 3
Joined: Wed Feb 11, 2009 1:50 pm

Post by stuey »

Nox - you're right about the wanting to change, but unfortunately the "one or two days" estimate would be considerably more. The game engine is a bit of a beast and the graphics aren't easily abstracted.

Rogerborg - yep, I was expecting a performance hit. I've already tried rendering to the window, that works fine but as you say, you completely overwrite a chunk of your display.

hybrid - yes that was what I was thinking. I finally got what I wanted by doing quite a bit less, ie by only rendering to a part of my backbuffer that was static I only had to copy that portion once to irrlicht then render my stuff with the irrlicht child window sitting on top of my app - all smoke and mirrors but it looks just like irrlicht is rendering straight into my backbuffer.

This was really just an exercise for me to get familiar with the irrlicht engine which was good. I did have a problem with draw2DImage, I was expecting it to behave like a pixel blit but it started to scale itself and shrink if I didn't draw at (0,0), maybe this is normal, maybe I was doing something wrong, I'll check this again and post a new topic if I still think there's a problem.
Nox
Posts: 304
Joined: Wed Jan 14, 2009 6:23 pm

Post by Nox »

keep in mind that there are different draw2DImage with different effects. May one meets your requirements.
Post Reply