When do I need to use an OpenGL function loader?

后端 未结 3 957
北恋
北恋 2020-12-03 08:16

I\'m a bit confused about when exactly I need to use an OpenGL function loader like GLEW. In general, it seems like you first obtain a window and valid OpenGL context and th

3条回答
  •  遥遥无期
    2020-12-03 09:13

    OpenGL functions (core or extension) must be loaded at runtime, dynamically, whenever the function in question is not part of the platforms original OpenGL ABI (application binary interface).

    • For Windows the ABI covers is OpenGL-1.1
    • For Linux the ABI covers OpenGL-1.2 (there's no official OpenGL ABI for other *nixes, but they usually require OpenGL-1.2 as well)
    • For MacOS X the OpenGL version available and with it the ABI is defined by the OS version.

    This leads to the following rules:

    • In Windows you're going to need a function loader for pretty much everything, except single textured, shaderless, fixed function drawing; it may be possible to load further functionality, but this is not a given.
    • In Linux you're going to need a function loader for pretty much everything, except basic multitextured with just the basic texenv modes, shaderless, fixed function drawing; it may be possible to load further functionality, but this is not a given.
    • In MacOS X you don't need a function loader at all, but the OpenGL features you can use are strictly determined by the OS version, either you have it, or you don't.

    The difference between core OpenGL functions and extensions is, that core functions are found in the OpenGL specification, while extensions are functionality that may or may be not available in addition to what the OpenGL version available provides.

    Both extensions and newer version core functions are loaded through the same mechanism.

提交回复
热议问题