Anyone using glad?

Jason Jeffory via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 10 14:37:28 PST 2016


On Sunday, 10 January 2016 at 21:53:45 UTC, Dav1d wrote:
> 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.
>>
>> http://glad.dav1d.de/
>>
>> I generated the bindings for all the latest versions of the 
>> various specifications.
>> Does anyone have any tutorials that use this library 
>> effectively?
>>
>> There's this
>>
>> https://github.com/Dav1dde/glamour
>>
>> 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 
>> bindings?
>>
>> 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)
>>
>> Thanks.
>
> Hey,
>
> I am the guy behind glad, you are most likely looking for: 
> https://github.com/Dav1dde/glad#d
> 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.
>
> Usage:
>
> 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).


Cool, it looks really well done. I spend several hours 
researching and looking at various approaches. It was basically 
Derelict stuff or a lot of things that didn't look well done. I 
was wishing there was something that would automatically do 
it(looked into htod, swift, etc)... then I stumbled across your 
work!!! Was exactly what I wanted!

glfw is separate or have you done something with it(is it wgl?)?

I'm basically trying to get a minimal setup running on winx64. I 
don't want a lot of hassle that other "solutions" seem to have(no 
derelict, sdl, etc...). I know there has to be some windows 
stuff(glfw) haven't yet found a solution for it(haven't really 
looked yet).



More information about the Digitalmars-d-learn mailing list