gpt4 book ai didi

opengl - OpenGL 中的多个窗口?

转载 作者:行者123 更新时间:2023-12-01 16:26:06 25 4
gpt4 key购买 nike

是否可以在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com