在常规窗口中使用OpenGL(Win32) [英] Using OpenGL in a regular window (Win32)

查看:364
本文介绍了在常规窗口中使用OpenGL(Win32)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在WndProc中使用OpenGL,但不确定如何使用.我也不希望GL占据整个屏幕,只是屏幕的一部分.最后,我基本上想制作一个绘图win32应用程序,但使用OGL而不是GDI.那么如何告诉GL使用控件(面板)的hdc进行绘制?

I want to use OpenGL in my WndProc but I'm not sure how. I also don't want GL to occupy the whole screen, just a portion of the screen. In the end I basically want to make a drawing win32 app but use OGL instead of GDI. so how can I tell GL to use my control (a panel) 's hdc for drawing?

推荐答案

调用wglCreateContext时,传递控件的HDC而不是窗口.相同的东西在OpenGL和DirectX上也可以使用.

When you call wglCreateContext, pass the control's HDC instead of the window. The same thing works on OpenGL and DirectX.

这篇关于在常规窗口中使用OpenGL(Win32)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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