On Thursday, 7 June 2018 at 02:47:12 UTC, Entity325 wrote:



I added the line, "mixin glContext!(GLVersion.gl33);" after the import statement. I didn't do anything with the context because I assumed SDL2 handled that, and creating my own would likely break the code.


You aren't mixing in the deprecated symbols. From the documentation [1]:

"glFreeFuncs takes an optional paramter that will include deprecated types and function pointer declarations. This is false by default, but can be enabled with, e.g., mixin glFreeFuncs(GLVersion.gl33, true);."

So step-by-step:

1. Set version=DerelictGL3_CustomFreeFuncs on the command line (via dub's "versions" directive).

2. Create a module specifically for importing DerelictGL, e.g. mygl.d, and add this:

module mygl;
public import derelict.opengl;
mixin glFreeFuncs!(GLVersion.gl33, true);

3. In any module where you need opengl, import mygl instead of derelict.opengl.

With this, Derelict will attempt to load all OpenGL functions, including the deprecated ones, up to 3.3. You'll just need to make sure you have the proper context created to support them.

FYI, I'm working on a new bindings package that's @nogc and -betterC comaptible (Derelict being neither). I've taken a completely different approach there, making everything configurable via commandline versions. For anyone interested in seeing what it looks like, I set up a github group a while back and have the loader package and the SDL bindings up now (though not yet in the dub repository). I've got most of OpenGL and GLFW done and will upload them in the not-too-distant future, to be followed by ports of other commonly-used Derelict packages. I'll push everything to the dub repo when I'm ready to formally make the announcement. It's best to consider the Derelict packages in maintenance mode, though I plan to keep supporting them for a long while to come.

[1]: http://derelictorg.github.io/packages/gl3/#using-derelictgl3
[2]: https://github.com/BindBC

Reply via email to