C#, rendering in tabpages (TabControl)

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
MacK
Posts: 9
Joined: Sun Oct 29, 2006 2:31 am

C#, rendering in tabpages (TabControl)

Post by MacK »

Hello, I'm working on a rather large project that I will not go into details as it's not ready to be announced yet.

Anyhow, I'm using the TabControl for the level editor and I need to be able to render to each TabPage. When the user clicks "Tab1", I want the rendering device to switch to "Tab1". If the user clicks "Tab2", I want the rendering device to switch over to "Tab2" and forget about "Tab1"... and so on.

Can this be done?

Thank you!
rooly
Posts: 224
Joined: Tue Oct 25, 2005 4:32 pm
Location: Louisiana, USA, backwater country
Contact:

Post by rooly »

yep, it sure can, with enough time, trouble, and experience, or maybe just an engine with a more evolved gui. simple eh?
When banks compete, you win.
When ISPs compete, you win.
When electronics retailers compete, you win.
When governments compete...you get drafted.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

a completely worthless answer there rooly, thanks for that. :evil:

to render 3d to a tab- just add a gui image with a render target as the texture, and use getActiveTab to decide which one you are drawing to.

since only one image will be visible at once, you might as well add the same texture to each tab and just change the current camera or scene manager in your render loop. see the meshviewer (for tabs) and render to texture tutorials for details.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

Isn't he talking about Windows Forms' Tabs ? I mean, including Irrlicht in a Windows Forms tab control :roll:

If so, I'd say it could be done by adding a picture box for both tabs (because Irrlicht can only handle one control at the same time) and handle in events where the user switched the tabs ;)
Or you can create two devices and switch the first to pause when the user uses the second tab...

Anyway, please give more details :)
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
sgt_pinky
Posts: 149
Joined: Sat Oct 14, 2006 11:20 am
Location: Melbourne, Australia

Post by sgt_pinky »

See, I was thinking he was talking about wrapping Java tabs in .NET DeusXL - but then I couldn't work out if it was Swing, or some other GUI interface - so I just decided not to reply ;)
Intellectuals solve problems - geniuses prevent them. -- Einstein
#irrlicht on irc.freenode.net
MacK
Posts: 9
Joined: Sun Oct 29, 2006 2:31 am

Post by MacK »

Sorry- I'm talking about Windows Forms.

It's for a level editor, so if you open multiple levels it'll open in a new tab (the game is 2d/isometric that's why).

All I need to know is how to change the rendering source which is defined here (RendowWindow is the control rending to):

Code: Select all

            Device = new IrrlichtDevice(DriverType.DIRECT3D9,
                new Dimension2D(640, 418), 32, false, false,
                false, false, RenderWindow.Handle); 
All I need to know is how to change that last option dynamically (the handle of the RenderWindow).

By the way, I've been using Irrlicht for one day so far.

Thanks!
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

MacK wrote:

Code: Select all

            Device = new IrrlichtDevice(DriverType.DIRECT3D9,
                new Dimension2D(640, 418), 32, false, false,
                false, false, RenderWindow.Handle); 
All I need to know is how to change that last option dynamically (the handle of the RenderWindow).
Impossible (unless I'm wrong).

The only solution is to create a new device for each tab and to use it only when the tab is focused.
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I'm just guessing here, but can't you just put it inside another windows control and move that around instead.
I don't think you can create more than one device at present.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
MacK
Posts: 9
Joined: Sun Oct 29, 2006 2:31 am

Post by MacK »

bitplane wrote:I'm just guessing here, but can't you just put it inside another windows control and move that around instead.
I don't think you can create more than one device at present.
Well I need it so the user can open multiple windows at once. I might just go ahead and use the Irrlicht GUI system instead... I was messing with it and it felt pretty good...
2playgames
Posts: 2
Joined: Mon Mar 20, 2006 9:25 pm

Post by 2playgames »

don't know about irrlicht, but in directx you can set a Panel as rendering target. maybe you can do that and use buttons instead of tabs to switch to another level
fvapres
Posts: 2
Joined: Wed Jun 20, 2007 1:50 am

Post by fvapres »

What about saving the view of the map to a jpg/png/bmp format in the working folder directory, then loading that image as the image for the tab control (iirc already a property built into the tab control you can use right away)
Locked