Using OpenGL extensions with GLEW and Lua
The GLEW library handles the correct mapping of the OpenGL function's entry points. This way you won't have issues with calling nonexistent extension functions if that extension is not available on the current system.
Getting ready
Support for the GLEW library is included in the OpenGL wrapper module called GL. First, you need to include this library in the Lua environment with the following code:
local gl = require 'luagl'
The GLEW library is initialized with the call of the gl.InitGLEW
function.
How to do it…
With the GLEW library initialized, you are able to query for the presence of the specified extension or the OpenGL version. To do this, you'll need to call the gl.IsSupported
function. The only parameter of this function is an extension name or the GL_VERSION_{version}
string. This function also accepts more than one string parameter delimited with space. It will return true if such a combination is supported on the current system, otherwise it...