opengl - OpenGL 中的多个窗口?

标签 opengl multi-window

是否可以在 2 个窗口中使用 openGL?就像在2个不同的窗口中(假设第一个是640x480,另一个是1024x768)渲染不同的东西(假设一个窗口是编辑器,另一个是主/普通窗口显示)

最佳答案

是的,这是可能的。对于每个窗口,您将需要创建一个唯一的设备上下文和渲染上下文。

HDC hDC = GetDC( hWnd ); /* get the device context for a particular window */
/* snip */
HGLRC hRC;
hRC = wglCreateContext( hDC ); /* get a render context for the same window */
/* repeat with hDC2 and hRC2 with another window handle*/

在对窗口进行 GL 调用之前,您必须像这样调用 wglMakeCurrent:

wglMakeCurrent( hDC, hRC );
/* GL calls for first window */
wglMakeCurrent( NULL, NULL);

wglMakeCurrent( hDC2, hRC2 );
/* GL calls for second window */
wglMakeCurrent( NULL, NULL);

关于opengl - OpenGL 中的多个窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/452806/

相关文章:

java - 平均法线结果为零长度 vector

opengl - 如何计算法线矩阵?

android - 如何在我的 Android 应用程序中启用分屏?

android - 如何为多窗口模式配置应用程序?

android - 使用一个启动器在分屏中启动我的两个应用程序 - Android

java - OpenGL/Java 学习曲线

java - LWJGL 旋转 : Won't rotate

c++ - 窗口在 NVIDIA 显卡上使用 OpenGL 渲染闪烁

javascript - 带有多个窗口的弹出窗口(如 sap.m.dialog)

android - android N 中的多窗口拖放