D, Derelict2, and OpenGL

David d at dav1d.de
Wed Feb 22 15:44:36 PST 2012


Am 22.02.2012 23:36, schrieb Chris Pons:
> I have been reading the book "The D Programming Language" and am really
> enjoying D. However, my current motivation to use D was specifically for
> programming through OpenGL, and I was excited when I found out Dereict2
> provided support for OpenGL.
>
> My current Gfx card can only support up to OpenGL 3.3, Can Derelict2
> support up to OpenGL 3.3?
>
> Also, and most importantly, would it be possible for me to follow a book
> such as the "Red Book" to learn about using OpenGL with D?
>
> Does anyone have a recommendation for a book about OpenGL that is geared
> towards people new to OpenGL?
Hello,

Yes Derelict2 supports OpenGL 3(.3), you maybe wanna take a look at 
Derelict3, but be aware, that's just a binding to the gl3-Header, which 
means you dont have the deprecated function-set (aka. fixed pipeline, 
<3.0). You can also follow any OpenGL-programming book you like, you've 
just to port the examples to D, which isn't that hard (opengl function 
names stay the same), I did it also. Sometimes it's a bit tricky, but 
it's really doable (e.g. .sizeof on a dynamic array does not return it's 
size in memory as you would expect as a C-programmer).

I used http://www.arcsynthesis.org/gltut/ to teach myself OpenGL, all in 
all it's a great book, but the source-code is in my opinion really 
"ugly" and you can't port all the code (well you can but that will take 
you very long, since they are using their own mesh-formats and loader), 
therefor I've written some librarys which may be usefule for you: 
https://bitbucket.org/dav1d/gljm - gljm loads meshes from 2 common 
formats (.ply and .obj, blender e.g. can export to them) and a custom 
json format. https://bitbucket.org/dav1d/gl3n - gl3n which implements 
vector/matrix/quaternion math.

Hope this helps
- David


More information about the Digitalmars-d-learn mailing list