本文介绍了在Windows窗体中嵌入GLFW窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows窗体用户界面在opengl中为3d世界创建编辑器.我正在Visual Studio 2012 Express上进行开发,我想将GLFW窗口/上下文嵌入Windows窗体中.就像在本教程中一样 http://www.codeproject.com/Articles/16051/Creating-an-OpenGL-view-on-a-Windows-Form (正常工作).以及用于opengl上下文的GLFW.

这可能吗?我应该改用Qt吗?而我将如何做呢?我并不一定要使用Windows窗体,我只需要一个简单美观的功能UI即可用于我的项目.

解决方案

这是三个不同的框架(Windows窗体,GLFW,Qt),它们可以做相同的事情,即在其中创建窗口和OpenGL上下文. /p>

请参见此处,以获取一个简单的示例,了解如何使用带有GLFW的OpenGL上下文创建窗口. /p>

有关Qt示例,请参见此处.

>

因此,您必须在其中之一之间进行选择. GLFW和Qt的优点是您的代码也可以在MacOSX和Linux上运行;甚至可以在iPhone上完成一些工作.


如果要使用GLFW进行窗口创建和事件处理以及其他操作,而GUI仍使用Qt,则可以使用某些方法进行脱机绘制(某些参考此处此处 a>或此处)Qt小部件,然后绘制将其粘贴到一些OpenGL纹理上.或者,您也可以通过OpenGL直接绘制它们(不确定).

I'm making an editor for 3d worlds in opengl using the windows forms UI. I'm developing on visual studio 2012 express and i would like to embed a GLFW window/context inside a windows form. just like done in this tutorial http://www.codeproject.com/Articles/16051/Creating-an-OpenGL-view-on-a-Windows-Form except working. And with GLFW for opengl context.

Is this possible? should i use Qt instead? and how would i got about doing this? I'm not bound to using windows forms i just need a simple good-looking functional UI for my project.

解决方案

That are three different frameworks (Windows Forms, GLFW, Qt) which can all do the same thing, i.e. creating a window and an OpenGL context in it.

See here for an easy example how to create a window with OpenGL context with GLFW.

Or see here for the Qt example.

So, you have to choose between one of them. GLFW and Qt have the advantages that your code will also work on MacOSX and on Linux; with some work even on iPhone.


If you want to do the window creation and event handling and other stuff with GLFW but the GUI still with Qt, there is some way to do offline drawing (some ref here or here or here) the Qt widgets and then draw it onto some OpenGL texture. Or you might also be able to directly draw them via OpenGL (not exactly sure).

这篇关于在Windows窗体中嵌入GLFW窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 20:48