I'm trying to display the content of an Ogre3Ds window in a winform panel.
I have this fonction which usually open a render window:
AppOgre1.mRenderWindow = AppOgre1.mRoot.Initialise(false, "Test1");
The first argument, when set FALSE doesn't display the window. I think this is OK....
I've put it in the Panels fonction in the winform.
But what do i have to do to make her fill the content of my Panel??....
You need to do this:
AppOgre1.mRenderWindow = AppOgre1.mRoot.Initialise(thePanel);
You must be some experienced on C# for work with it.
This will work fine, but you will have troubles with events, be sure that the panel is active. So, you must do the initialization after the form is loaded. I recomends to use a separated Thread (for your 3D logic) from logic for the form. But.... you will need to use "invoke" for events or any kind of updates to Form where is called from 3D Objects.
How I learn that 5 days ago? Read code of Ogre (c++), interfaces declared on SWIG, OgreDotnet (C#) and Direct3DInput (W32API).
Dont play with fire if you aren't a fireman o have a Asbesto's Gloves!!!
Thanx for the answer! yes i'm a newbie with C#
so i don't know if i will carry on with it.
I've tried with the piece of code you gave me. Where should I put it? I've tried like this, but it doesn't work:
public partial class Form1 : Form
private void panel1_Paint(object sender, PaintEventArgs e)
AppOgre1 = new AppOgre();
AppOgre1.mRenderWindow = AppOgre1.mRoot.Initialise(panel1_Paint);
ok I've just taken the DemoWinform from the OgreDotNet CVS and it works...
So no problem at all!
good for you...
The problem with your code is that Panel_paint is not a good place to put Initialization code!