WglCreateContext 函数详解
来源:互联网 发布:禅城数据便民服务中心 编辑:程序博客网 时间:2024/05/16 17:07
WglCreateContext
WglCreateContext函数创建一个新的OpenGL渲染描述表,此描述表必须适用于绘制到由hdc返回的设备.这个渲染描述表将有和设备上下文(dc)一样的像素格式.
HGLRC wglCreateContext(
HDC 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 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 SetPixelFormat 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 wglDeleteContext 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);
WglCreateContext函数创建一个新的OpenGL渲染描述表,此描述表必须适用于绘制到由hdc返回的设备.这个渲染描述表将有和设备上下文(dc)一样的像素格式.
HGLRC wglCreateContext(
HDC 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 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 SetPixelFormat 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 wglDeleteContext 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);
- WglCreateContext 函数详解
- SDL2 自建窗口使用OpenGL 时候 wglCreateContext 失败的解决方法
- 函数详解
- API函数详解:CreateSemaphore函数
- sql函数 group_concat函数详解
- 仿函数 ( 函数对象 ) 详解
- send函数&recv函数详解
- scan函数函数用法详解
- 【函数】register_shutdown_function函数详解【原创】
- ASP函数详解
- DateDiff 函数详解
- ASP函数详解
- ASP函数详解
- ASP的函数详解
- Window.open函数详解
- ASP函数详解
- XML系列函数详解
- ASP函数详解
- !!!Obj-C 2.0 -- Chapter 4 Declared Properties
- javascript学习笔记2-正则表达式入门
- ZOJ-1877 Bridge
- SSH 配置
- java程序员菜鸟进阶(九)windows下搭建SVN服务器及配置myeclipse SVN客户端
- WglCreateContext 函数详解
- CareerCup-4.2
- 互芯最新资料大全
- 可靠数据传输的原理:比特差错
- UVA 539 - The Settlers of Catan
- ZOJ-1756 Robots
- 多线程编程之————条件变量
- 司马憙:宫女难除,举为王后
- 彻底解决Win7无线网络连接问题,无法连接不用怕