将子窗口(glfwCreateWindow)作为子对象嵌入C ++ MFC父窗体 [英] embed window(glfwCreateWindow) as child to C++ MFC parent form

查看:463
本文介绍了将子窗口(glfwCreateWindow)作为子对象嵌入C ++ MFC父窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参考此链接

在Windows窗体中嵌入GLFW窗口

如何使用VC ++将glfw窗口嵌入到父窗体中来实现相同的目的?

How can the same achieved by using VC++ to embed glfw window to Parent form?

推荐答案

尝试一下:

  1. 调用 glfwWindowHint() GLFW_DECORATED GLFW_VISIBLE 设置为 false .
  2. 调用 glfwCreateWindow().
  3. 调用 glfwGetWin32Window()以获取OpenGL窗口的本机句柄.
  4. 调用 SetParent()将您的表单设置为OpenGL窗口的新父级.
  5. 调用 GetWindowLong()/ SetWindowLong()删除 WS_POPUP 并为其添加 WS_CHILDWINDOW 样式OpenGL窗口.
  6. 调用 ShowWindow()最终使OpenGL窗口可见.
  1. Call glfwWindowHint() to set GLFW_DECORATED and GLFW_VISIBLE to false.
  2. Call glfwCreateWindow().
  3. Call glfwGetWin32Window() to get the native handle of the OpenGL window.
  4. Call SetParent() to set your form as the new parent of the OpenGL window.
  5. Call GetWindowLong() / SetWindowLong() to remove the WS_POPUP and add the WS_CHILDWINDOW style for the OpenGL window.
  6. Call ShowWindow() to finally make the OpenGL window visible.

我从 github.com/Chronial/foo_chronflow ::EngineWindow.cpp .

您还可以调用 SetWindowPos()来调整OpenGL窗口在表单中的位置.

You might also call SetWindowPos() to adjust the position of the OpenGL window within your form.

这篇关于将子窗口(glfwCreateWindow)作为子对象嵌入C ++ MFC父窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆