Mogre - Windows form - how to?

hedphelym

29-10-2008 09:22:38

Hi,

I have successfully done the tutorial with the console app.
But how would one go about making it work in a "windows form"?

I would like to be able to use the normal form buttons and sliders and such to make my UI.

feanor91

29-10-2008 10:12:08

Hi

Look here : http://www.ogre3d.org/wiki/index.php/ClOgre

Beauty

29-10-2008 12:12:07

ClOgre is only for Visual Basic.
(By the way - now I remember that we wanted to rename ClOgre)

In Mogre tutorial 6 will be shown how to integrate Mogre to a Windows Form (with C#):
www.ogre3d.org/wiki/index.php/Mogre_Basic_Tutorial_6

In my application I use the common GUI elements of Windows Forms. It's not so flexible and nice like an Ogre GUI system, but very easy to use.

feanor91

29-10-2008 15:20:29

Hi

As a DLL clOgre can be use with any language, as if, of course bu as a tutorial, yes is for VB.

hedphelym

01-11-2008 19:28:10

I just want to know how to use windows form with mogre.
One basic form for the graphics.
(or picturebox, or whatever)
I do not understand how to do this.
I've looked at tutorial 6, but still i can't get it..

Any sample projects floating around somewhere?

Beauty

02-11-2008 08:05:42

I added a Panel to the Form and there the picture will be shown.

In my application I found this lines of code.
this.renderpanel is the Panel in the Form.
Maybe it helps you.

// Create Render Window
root.Initialise(false, "Main Ogre Window");
NameValuePairList misc = new NameValuePairList();
misc["externalWindowHandle"] = this.renderPanel.Handle.ToString();
RenderWindow renderWindow = root.CreateRenderWindow("Main RenderWindow", 1024, 768, false, misc);
// ... (load ressources, create camera) ...
// Create ViewPort
Viewport viewport = renderWindow.AddViewport(camera);

hedphelym

02-11-2008 10:00:01

Thank you.

I use VB - so i just convert this code to VB with:
http://www.developerfusion.com/tools/convert/csharp-to-vb/

the resulting VB code is :

' Create Render Window
root.Initialise(False, "Main Ogre Window")
Dim misc As New NameValuePairList()
misc("externalWindowHandle") = Me.renderPanel.Handle.ToString()
Dim renderWindow As RenderWindow = root.CreateRenderWindow("Main RenderWindow", 1024, 768, False, misc)
' ... (load ressources, create camera) ...
' Create ViewPort
Dim viewport As Viewport = renderWindow.AddViewport(camera)


I'll try to get this to work now.. :)

Beauty

02-11-2008 21:08:31

oh, what a nice converter tool :)

Good luck with the code. I'm away for about one week. Maybe later I could help with questions.