Vladimir Gazbarov
Vladimir Gazbarov

Reputation: 860

Loading OpenGL extension at runtime

I am trying to acquire additional openGL functions e.g. glCreateShader(), using wglGetProcAddress at runtime, as described in many tutorials. The return value however is NULL and no shader-related functions can be found.

How can this problem be solved? Thanks!! :-)

Upvotes: 0

Views: 226

Answers (2)

Vladimir Gazbarov
Vladimir Gazbarov

Reputation: 860

I have solved this problem. The openGL context must be created first, and the pixel format must be selected and suitable for the set of extensions you want.

If you do not do the above, wglGetProcAddress will not find your extensions.

Upvotes: 1

rodrigo
rodrigo

Reputation: 98348

Those functions are provided by the graphics driver. So you have 2 options:

  • Upgrade your graphics driver to the latest version and hope that the manufacturer has developed that extensions.
  • Change your graphics card to a better one, which driver provides the required extensions.

Note that there are many of low-end graphics cards that simply cannot do what that extensions require, so their manufacturers will never provide them.

Upvotes: 1

Related Questions