Horde3D
http://horde3d.org/forums/

Horde3d support for mono Winforms on Linux Diary
http://horde3d.org/forums/viewtopic.php?f=8&t=760
Page 1 of 1

Author:  tlaukkan [ 29.05.2009, 15:37 ]
Post subject:  Horde3d support for mono Winforms on Linux Diary

Hello

I will report to this thread the work log and information about how to run Horde3D + mono WinForms on Linux. Any help is much appreciated. :roll:

Current status:

1. OpenGL context is created without errors to child X-window opened on top of chosen Panel.
2. Horde3D is initialized without errors.
3. Window is drawn with the color defined in the pipeline xml.
4. No objects are rendered but there is no initialization errors on application log nor engine log. :!:

Approach:

New X-windows is created as child window to the Panel as the panel window is not directly OpenGL compliant on X11. The X-window requires explicit resizes when panel is resized. The Horde3d changes are attached as patch file. The C# application is initialized with the following code:

Code:
   
                Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
                if (xplatui != null)
                {

                    IntPtr display = (IntPtr) xplatui.GetField("DisplayHandle",
                                                               System.Reflection.BindingFlags.Static |
                                                               System.Reflection.BindingFlags.NonPublic).GetValue(null);


                    if (!Horde3DNET.Utils.Horde3DUtils.initOpenGLX11(display, this.renderPanel.Handle))
         throw new Exception("Failed to initialize OpenGL");
                }
                else
                {
                    if (!Horde3DUtils.initOpenGL(GetDC(renderPanel.Handle).ToInt32()))
                        throw new Exception("Failed to initialize OpenGL");
                }


Resizing the X-window on panel resize requires:
Code:
                Horde3DUtils.setOpenGLWindowSize(width,height);


Information from mono windows mailing list :!: :

Code:
Ivan N. Zlatev to me, mono-winforms-.
show details May 27 (2 days ago)

In X11 we have 2 X windows for each control - one for the client
(ClientWindow) and one for the non-client areas (WholeWindow).
Control.Handle is the handle for the Client window returned by
XCreateWindow. You can see more details in CreateWindow () in
http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
and http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs
for details.


Attachments:
horde3d_x11.patch [11.21 KiB]
Downloaded 1013 times

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/