Anyone using glad?
Dav1d via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 10 13:53:45 PST 2016
On Sunday, 10 January 2016 at 21:30:32 UTC, Jason Jeffory wrote:
> Seems like it is a very nice way to get into openGL from D.
> I generated the bindings for all the latest versions of the
> various specifications.
> Does anyone have any tutorials that use this library
> There's this
> But not sure what it is(diff between it and glad). Says it's a
> wrapper to OpenGL... but does it use the glad generated
> It looks like I'd prefer this to derelict because it seems like
> it is a automatically generated binding... which means future
> extensibility and no "extra" stuff.
> Would be nice if it works with dub. How could I use it easily
> with dub as a local library? (create a dependency from a local
> file location)
I am the guy behind glad, you are most likely looking for:
Instead of downloading the glad sources and installing Python you
can use the website http://glad.dav1d.de/
(If I have time I will write more documentation and also have it
on the website)
glad is just another way to load your OpenGL functions (kinda
like Derelict does it), the main difference is, it exactly allows
you to generate the feature set you need, if you're in doubt, you
can also just generate everything.
Another difference is, it uses the official XML-Specification
files, so it is always up to date and doesn't need to be
maintained. This also means it can can generate files for
EGL/GLES/WGL and GLX.
Glad itself is a library which happens to include a D generator
'backend', that allows you to extend it and make a more advanced
loader (e.g. introduce another layer and automatically check
glGetError, see C/C++ Debug), but for your normal use the
included generator is good enough.
Basically you download the zip, add the source files to your
project and build system and call gladLoadGL() (check the return
value, `enforce(gladLoadGL())`) after creating a context. This
will use the internal loader, if you use glfw you can pass
glfwGetProcAddress to gladLoadGL(), if you use SDL you can use
SDL_GL_GetProcAddress: `gladLoadGL(x => glfwGetProcAddress(x))`.
Then you can just go ahead and call the imported gl functions.
Why no dub?:
Well why would you want to use dub? Just generate the files and
copy them into your source.
I also wrote glamour, glamour is just a library which abstracts
the the OpenGL API and has some glue code for gl3n (maths), SDL
(texture loading), glad/Derelict (for gl).
More information about the Digitalmars-d-learn