[Lazarus] OpenGL 4.6 bindings and generator

Kostas Michalopoulos badsectoracula at gmail.com
Wed Aug 16 12:08:06 CEST 2017


Hi all,

After finding the OpenGL bindings that come with Lazarus a bit on the
ancient side of things (i think it only supports up to 4.0? Also there is a
4.3 version loading function but only seems to call 3.3's loader - ignoring
4.0 - and loads only a single extension) and never really liking the global
functions of pointers approach (if nothing else it makes the autocompletion
in the IDE a bit annoying) i decided to make some brand new bindings.

I wrote a parser for Khronos' XML spec (gl.xml) that generates the
appropriate interface and implementation. You only have to call LoadGLProcs
after you have a context ready and it tries to load everything it knows of.
Instead of Load_some_extension you get a global Has_some_extension variable
(these are initialized via LoadGLProcs too). As a bonus you get a
HasExtension function as well as an AllExtensions array of strings.

Btw it is not a drop in replacement for GL/GLext/GLotherstuff, although you
can use it with the OpenGL control that comes with Lazarus and most likely
it is compatible as long as you don't use it from the same unit (since all
they do is call the driver stuff anyway) and you initialize both using the
same context (since different contexts might give different functions).

You can find the code as well as a pregenerated "OpenGL" unit at:

http://runtimeterror.com/rep/gl2unit/index

At the moment only Windows is supported, but soon i'll add Linux and
eventually Mac OS X support (it should be around ~10 lines of code for each
OS, hopefully). Also i have done minimal testing so there might be bugs :-).

Kostas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170816/5e7f344d/attachment.html>


More information about the Lazarus mailing list