简体   繁体   English

如何在Windows窗体应用程序中集成opengl窗口

[英]how to integrate the opengl window in windows form application

I am using OpenGL and TaoFramework in c# . 我在c#中使用OpenGL和TaoFramework。 I created a window for openGL excluding the windows form and I dont know how can I integrate this window in windows form. 我为openGL创建了一个不包含Windows窗体的窗口,但我不知道如何将该窗口集成到Windows窗体中。

  [STAThread]
        static void Main()
        {




            Glut.glutInit();
            Glut.glutInitDisplayMode(Glut.GLUT_DOUBLE | Glut.GLUT_RGB | Glut.GLUT_DEPTH);
            Glut.glutGetWindow();
            Glut.glutInitWindowSize(600, 600);
            Glut.glutInitWindowPosition(700, 100);
            Glut.glutCreateWindow("Lang Yuzer Robot Arm");

            Gl.glEnable(Gl.GL_COLOR_MATERIAL);
            Gl.glEnable(Gl.GL_LIGHTING);
            Gl.glEnable(Gl.GL_LIGHT0);
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glEnable(Gl.GL_NORMALIZE);
            Gl.glEnable(Gl.GL_CULL_FACE);

            Glut.glutDisplayFunc(Form1.myDisplay);
            Glut.glutReshapeFunc(Form1.myReshape);
            Glut.glutIdleFunc(Form1.myIdle);


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

                  Glut.glutMainLoop();


    }
    }

GLUT is a windowing toolkit; GLUT是一个窗口工具包; WinForms is a different windowing toolkit. WinForms是一个不同的窗口工具包。 Unless GLUT allows reparenting (unlikely), there is no straightforward way to combine the two. 除非GLUT允许重成族(不太可能),否则没有直接的方法将两者结合起来。

The best solution would be to use OpenTK.GLControl , which is cross-platform and well maintained. 最好的解决方案是使用OpenTK.GLControl ,它是跨平台的并且维护良好。 NuGet version available here: https://www.nuget.org/packages/OpenTK.GLControl/ NuGet版本可在此处获得: https : //www.nuget.org/packages/OpenTK.GLControl/

Another solution would be to use Tao.SimpleGlControl , which is windows-only and no longer maintained. 另一个解决方案是使用Tao.SimpleGlControl ,它仅用于Windows,不再维护。

Without messing around with Window handles, I would suggest using OpenTK, which uses the Tao Framework. 在不搞乱Window句柄的情况下,我建议使用OpenTK,它使用Tao框架。 This library has an OpenGLControl which makes integrating OpenGL graphics into a windows form. 该库具有OpenGLControl,可将OpenGL图形集成到Windows窗体中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在.net windows窗体应用程序中将访问控制与我的ORM集成? - How to integrate access control with my ORM in a .net windows form application? 是否可以在 C# 窗口形式的桌面应用程序中集成 Google Pay - is it possible to integrate Google Pay in C# window form desktop application 在 Windows 桌面应用程序中通过 OpenGL 窗口显示 WPF 控件 - Display WPF controls over OpenGL window in Windows desktop application 如何在Windows应用程序中集成命令提示符/终端? - How to Integrate Command prompt/Terminal in a Windows application? 如何保持从主程序重新启动Windows窗体,直到另一个窗口窗体退出应用程序? - How to keep re-launching a windows form from the main program until another window form exits the application? 如何将GUI dll集成到另一个应用程序(例如Windows或wpf应用程序) - how to integrate a GUI dll into another application (like windows or wpf application) 如何与Windows Phone的Office /图片共享窗口集成? - How to integrate with Windows Phone's Office's/Pictures Share window? 如何使用C#在Windows窗体应用程序的新窗口中查看Crystal报表? - How to view Crystal Reports in new Window of Windows Form Application using C#? 如何将sdl.net窗口添加到C#Windows窗体应用程序? - How to add sdl.net window to a C# windows form application? 如何将WhatsApp API与C#WPF Windows Application PC集成 - How to Integrate whatsapp api with c# wpf windows application pc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM