Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在初始化阶段使用的函数(来自遗留库)中有一个简单的代码 - 例如在纹理加载器模块中。
loadTexture() { // ... gl_func = wglGetProcAddress(...) // ... gl_func() }
我应该担心wglGetProcAddress通话费用吗?或者可能它是如此之快以至于不需要缓存机制?或者,WGL 是否会为进程缓存此类调用?
wglGetProcAddress
GLX 和 Apple 的其他类似功能呢?我是否也应该担心它们?
wglGetProcAddress至少会做一些字符串比较,所以它不是免费的。最大的问题是,如果您wglGetProcAddress每次使用 gl 函数时都插入,您的代码会很丑陋。
最好使用一个生成器,将所有丑陋的东西wglGetProcAddress放在一个单独的文件中。例如使用glux或glloadgen。