如何阅读Windows特定的扩展名 [英] How to read windows specific extensions

查看:64
本文介绍了如何阅读Windows特定的扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OpenGL最佳实践中,该示例说我可以通过以下方式读取Windows特定的扩展名:

In OpenGL superbible the example says I can read Windows specific extensions via:

//Type defined in the book as char, but that is not what glGetString returns...
const GLubyte *extensions = glGetString(GL_EXTENSIONS);
if(strstr(extensions, "WGL_EXT_swap_control") != NULL)
{
    wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
    if(wglSwapIntervalEXT != NULL)
        wglSwapIntervalEXT(1);
}

strstr不采用GLubyte.怎么做?

推荐答案

您可以将glGetString的返回值强制转换为const char指针,并使用您喜欢的字符串处理函数.

You can just cast the return value of glGetString to a const char pointer and use your favorite string handling functions.

但实际上,我建议您使用一个库,例如 GLEW ,用于管理扩展程序.

But really I'd recommend using a library, e.g. GLEW, for managing extensions.

这篇关于如何阅读Windows特定的扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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