Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
May 05, 2013 Standalone opengl bindings | ||||
---|---|---|---|---|
| ||||
I wrote this mainly for my own benefit, but I figured it might be useful to someone else. It's a small program which generates opengl bindings for D directly from the specification. https://github.com/Diggsey/OpenGL-D-Bindings It generates a single file "gl.d" which by default will do no more or less than what you'd get by including "gl/gl.h". This will give you access to GL 1.1 functions. You can then call "loadGL" passing in the opengl version and the names of any extensions you want to use and it will automatically load in the relevant functions. It does this at compile time so at runtime it just loads precisely those functions which you asked for. It provides only the platform independent part of opengl - it expects wgl***/glX*** functions to be provided by the platform sdk. Unfortunately the built in windows bindings for D are fairly useless, but I've forked druntime and phobos to use the windows bindings from the dsource bindings project instead, which are far better: https://github.com/Diggsey/druntime https://github.com/Diggsey/phobos/tree/win32-bindings |
May 05, 2013 Re: Standalone opengl bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Diggory | On 2013-05-05 05:58, Diggory wrote: > I wrote this mainly for my own benefit, but I figured it might be useful > to someone else. It's a small program which generates opengl bindings > for D directly from the specification. > > https://github.com/Diggsey/OpenGL-D-Bindings > > It generates a single file "gl.d" which by default will do no more or > less than what you'd get by including "gl/gl.h". This will give you > access to GL 1.1 functions. Sorry, but I can't understand why you would want to have this instead of Derelict. -- /Jacob Carlborg |
May 05, 2013 Re: Standalone opengl bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Sunday, 5 May 2013 at 08:52:27 UTC, Jacob Carlborg wrote:
> On 2013-05-05 05:58, Diggory wrote:
>> I wrote this mainly for my own benefit, but I figured it might be useful
>> to someone else. It's a small program which generates opengl bindings
>> for D directly from the specification.
>>
>> https://github.com/Diggsey/OpenGL-D-Bindings
>>
>> It generates a single file "gl.d" which by default will do no more or
>> less than what you'd get by including "gl/gl.h". This will give you
>> access to GL 1.1 functions.
>
> Sorry, but I can't understand why you would want to have this instead of Derelict.
A few reasons:
- It's one file that does JUST the opengl stuff. With derelict, the functions it provides overlap with the platform SDK. Sure you can prevent conflicts by aliasing them but it's messy and a waste.
- Derelict requires countless files over two different sub-projects just to get simple opengl support. You would certainly want to build it separately and then link it in, with this it's just a case of adding one file to your project.
- I'm building on top of this, this way it's one fewer dependency to worry about.
- Because it's generated automatically from the spec it will always be up to date (currently 4.3, whereas derelict is only on 2.1!).
|
May 05, 2013 Re: Standalone opengl bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Diggory | > A few reasons: > - It's one file that does JUST the opengl stuff. With derelict, the > functions it provides overlap with the platform SDK. Sure you can > prevent conflicts by aliasing them but it's messy and a waste. I don't understand it, which function e.g. conflicts? > - Derelict requires countless files over two different sub-projects just to get simple opengl support. You would certainly want to build it separately and then link it in, with this it's just a case of adding one file to your project. Well, for Derelict I have to add ~5 files (all of the opengl subfolder) > - I'm building on top of this, this way it's one fewer dependency to worry about. I use Derelict with a git submodule and only compile the folders in I need, works great. > - Because it's generated automatically from the spec it will always be up to date (currently 4.3, whereas derelict is only on 2.1!). I think you're misinformed, Derelict always supported more than that, current version supports 4.3 as well |
May 05, 2013 Re: Standalone opengl bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to David | On Sunday, 5 May 2013 at 10:47:39 UTC, David wrote: > I don't understand it, which function e.g. conflicts? Derelict defines a bunch of platform specific functions (wgl***, some pixel format functions, etc.) which belong in the platform sdk, not in the opengl bindings. > Well, for Derelict I have to add ~5 files (all of the opengl subfolder) Whereas with this I have to add 1 file which declares precisely those functions which I need and no more. >> - I'm building on top of this, this way it's one fewer dependency to >> worry about. > I use Derelict with a git submodule and only compile the folders in I > need, works great. I'm sure it does, that doesn't stop it from being a dependency. As I said I did this for my own benefit, I'm not forcing people to use it. > I think you're misinformed, Derelict always supported more than that, > current version supports 4.3 as well Ah I was looking at Derelict rather than Derelict2 apparently - slightly confusing having the latest version in a branch... |
May 05, 2013 Re: Standalone opengl bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Diggory | Actually, the current (well, WIP) version is Derelict3: https://github.com/aldacron/Derelict3 |
May 06, 2013 Re: Standalone opengl bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Diggory | On Sunday, 5 May 2013 at 21:33:35 UTC, Diggory wrote:
> Ah I was looking at Derelict rather than Derelict2 apparently - slightly confusing having the latest version in a branch...
I never really *finished* Derelict 2. The only thing holding me back from declaring it so was the lack of documentation. I just never got around to doing it. After support for D1 was announced to be going away, and given that most D projects had moved over to github and that DSource was pretty much dead, I decided to leave everything there as it is and start anew with a D2-only version on github. I did leave a note about it on the project page at DSource.
I have a disclaimer in the Derelict 3 readme that it's an alpha, but that's to cover my ass when errors are found. I do everything mostly by hand, with a couple of very specific custom scripts to make it a little bit easier (which, now that I think about it, I no longer have after my format disaster a few weeks back). So copy-paste errors and whatnot crop up from time to time. But it's very much in a usable state. Most of the time, it just works. I'm always open to ideas to make it easier to work with, though. Once it's been in usage for a bit longer and I've got some docs to go with it, I'll be ready to call it gold.
Currently you can use OpenGL two ways in Derelict 3. The preferred way is to import the gl3 module to get only the core functions. I also provide a gl module that can be used instead to get everything, including the deprecated stuff.
|
Copyright © 1999-2021 by the D Language Foundation