Getting going with D/OpenGL

Anders F Björklund afb at algonet.se
Mon Oct 23 00:34:08 PDT 2006


Bill Baxter wrote:

> What's the easiest way to get going with OpenGL under D?

Use either e.g. Derelict's loaders, or the OpenGL import modules:

http://www.dsource.org/projects/derelict/
http://www.dsource.org/projects/bindings/
http://shinh.skr.jp/d/porting.html
http://www.algonet.se/~afb/d/

One approach uses function pointers and loads symbols at runtime,
while the other links directly to the libraries (as in C or C++).

I will be bundling my modules for SDL and GL with my GDC builds,
and wxD now has preliminary samples for using SDL and GL, as well.

import sdl.sdl;
import gl.gl;

> It seems like Derelict has OpenGL support using SDL, but I don't really 
> like SDL's single-window limitation or draconian approach to window 
> resizing (i.e. trash all your textures).

You don't have to use SDL to use GL, but you can if you like.
(i.e. SDL can use GL, but you can go directly to GL instead...)

> Are there other options?  What's the best supported / actively developed?

Both of the two approaches mentioned above are still supported.

> I was considering working on a GLUI-alike library.  GLUI is a simple, 
> easy to use GUI library based on OpenGL.  It's pretty popular in the 
> graphics research community just because it's so brain-dead easy to use, 
> is very lightweight, and has very few dependencies.  Perfect for 
> slapping a few buttons and sliders up on the screen to control your 
> OpenGL program.  I think it could be very nice for D, since D is also 
> all about ease-of-use.

Yes, GLUI would work fine for D. And GLUT can also be used,
if you only need a simple GL window and not a full "GUI" ?

There is also the GLFW project: http://glfw.sourceforge.net/

--anders



More information about the Digitalmars-d-learn mailing list