博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wglCreateContext
阅读量:6916 次
发布时间:2019-06-27

本文共 2104 字,大约阅读时间需要 7 分钟。

hot3.png

WglCreateContext

WglCreateContext函数创建一个新的OpenGL渲染描述表,此描述表必须适用于绘制到由hdc返回的设备.这个渲染描述表将有和设备上下文(dc)一样的像素格式.
HGLRC wglCreateContext(

   HDC     // device context of device that the rendering context

              // will be suitable for

);

Parameters

hdc

用于函数将要创建的适合的OpenGL渲染描述表的设备上下文(dc)句柄.

Return Values

如果函数调用成功,返回有效的OpenGL渲染描述表句柄.否则返回NULL.

Remarks

渲染描述表并不等于设备描述表,创建渲染描述表之前应该仙设置设备描述表的像素格式.获得更多的设置设备描述表的像素格式的信息可以查看函数SetPixelFormat.
使用OpenGL, 你创建一个渲染描述表,选则它作为一个线程的当前渲染描述表,然后再调用OpenGL函数.当你使用完渲染描述表以后,记得调用wglDeleteContext函数释放掉这个渲染描述表
wglCreateContext

The wglCreateContextfunction creates a new OpenGL rendering context, which is suitable for drawing on the device referenced by hdc. The rendering context has the same pixel format as the device context.

HGLRC wglCreateContext(

   HDC     // device context of device that the rendering context

              // will be suitable for

);

Parameters

hdc

Handle to a device context for which the function creates a suitable OpenGL rendering context.

Return Values

If the function succeeds, the return value is a valid handle to an OpenGL rendering context.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

A rendering context is not the same as a device context. Set the pixel format of the device context before creating a rendering context. For more information on setting the device context's pixel format, see the function.

To use OpenGL, you create a rendering context, select it as a thread's current rendering context, and then call OpenGL functions. When you are finished with the rendering context, you dispose of it by calling the function.

The following code example shows wglCreateContext usage:

HDC     hdc;

HGLRC   hglrc;

// create a rendering context

hglrc = wglCreateContext (hdc);

// make it the calling thread's current rendering context

wglMakeCurrent (hdc, hglrc);

// call OpenGL APIs as desired ...

// when the rendering context is no longer needed ...  

// make the rendering context not current

wglMakeCurrent (NULL, NULL) ;

// delete the rendering context

wglDeleteContext (hglrc);

转载于:https://my.oschina.net/u/1469992/blog/271174

你可能感兴趣的文章
高清视频教程网站的搭建和分享
查看>>
Android 混淆代码总结
查看>>
Spark 二次排序
查看>>
zend studio中vim的安装
查看>>
实施微服务,我们需要哪些基础框架
查看>>
Linux 简单创建用户并指定文件夹权限
查看>>
openstack cobbler Icehouse ks 配置文件
查看>>
C++基本的数据类型
查看>>
Thinkphp 5.0实战 仿百度糯米开发多商家电商平台
查看>>
oracle10 ora-12154错误的解决办法
查看>>
OpenStack 架构 - 每天5分钟玩转 OpenStack(15)
查看>>
DotProject环境搭建
查看>>
linux学习二
查看>>
关于form表单的reset功能无法还原hidden中的值
查看>>
搞PHP怎么不知道CURL呢,呵呵。。。。。
查看>>
希捷硬盘1T挂了(1)
查看>>
关闭ADOX.Catalog创建Access的链接,避免ldb锁定
查看>>
我的友情链接
查看>>
360云盘退役后 剩下的几家云存储平台要上演“饥饿游戏”了
查看>>
用Memcache缓存加速Mysql的查询
查看>>