On Saturday, 20 April 2013 at 03:26:29 UTC, Diggory wrote:
I've been trying to write a win32 app using opengl in D, but
none of the bindings I've found have been sufficient:
- core.sys.windows.windows:
Missing large parts of wingdi.h, including PFD_* constants,
ChoosePixelFormat(), SwapBuffers(), wgl*() functions.
- win32.windows:
Apparantly out of date and gives linker errors, although it
does declare all the functions needed.
- derelict.util.wintypes:
Declares a small number of useful windows functions, many of
which conflict with those declared in
"core.sys.windows.windows" (such as PIXELFORMATDESCRIPTOR).
However, "SetPixelFormat" is not declared.
- derelict.opengl.gl:
Has all of opengl plus wgl* functions needed for windows, but
has more dependencies than an ideal opengl binding would have.
Why isn't there a simple relationship between C/C++ header
files and D modules, instead of this weird mix where some
things are duplicated and others not declared at all?
All of the windows specific functions including wgl* are
supposed to be in "windows.h", and opengl functions in "gl/gl.h"
It's a shame because I really like the ideas behind D - in fact
the reason I found it is that I'd come up with a whole bunch of
ideas I wanted in an ideal language and it turned out D already
implemented them all...
Deimos has some OpenGL bindings for up to 3.1 core here
https://github.com/D-Programming-Deimos/OpenGL/tree/master/deimos/gl
I also have my own that are up to 4.2 core here
https://bitbucket.org/Kapps/shardgraphics/src (gl.d, glfuncs.d,
gltypes.d, and possibly glfw.d if you need that), which include
loading the function pointers, but there may be some licensing
issues because they're parsed from the OpenGL man pages. Also
there may be some incorrect functions in mine because of parsing
errors.