开发者

In What Windows Library is glCreateProgramObjectARB Defined?

I'm trying to do some shader programming on windows. All the code I've been able to find online says you have to use wglGetProcAddress to figure out where开发者_C百科 these functions are, but i'm not sure what library to link against.


Ben Voigt's answer is nearly correct, with two exceptions:

  • All OpenGL 1.0 and 1.1 functionality is inlcuded in opengl32.lib, only 1.3 and upwards and all extension must be loaded dynamically.
  • WGL guarantees that all contexts sharing the same pixel format share identical function pointers. This is an important detail, as otherwise any application using either OpenGL 3.x/4.x or multisampling would necessarily be malformed.

However, in short, forget all this blah blah. Download GLEW and be done in 5 minutes. It just works and you need not care about petty implementation details. Call one init function at program start, and everything is good.


You link against opengl32.lib to get wglGetProcAddress. All the rest must be dynamically obtained via wglGetProcAddress after you have made a context current, since different contexts can use different implementations of the various functions.

An extension loader such as GLee or GLEW can do the function-pointer details for you, but you still need to be linking opengl32.lib.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜