Anyone using glad?

Dav1d via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 10 15:14:33 PST 2016


On Sunday, 10 January 2016 at 22:37:28 UTC, Jason Jeffory wrote:
> 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:
>>> [...]
>>
>> 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).

I would recommend using glfw for a context/window, there is a 
binding in Deimos https://github.com/D-Programming-Deimos/glfw - 
You need to either compile it yourself or just download the pre 
compiled package from the website and get the .lib file 
(http://www.glfw.org/).

There is also an abstraction I wrote once: 
https://github.com/Dav1dde/glwtf not sure if it still works, it 
*should*.
But even without the abstraction, getting a window and context up 
with glfw is really easy (documentation is really good! 
http://www.glfw.org/documentation.html). There is also a C++ 
example using glad: 
https://github.com/Dav1dde/glad/blob/master/example/c%2B%2B/hellowindow2.cpp which can easily be ported to D.

Basically all you need is glfw and glad to get started!


More information about the Digitalmars-d-learn mailing list