Getting going with D/OpenGL

Anders F Björklund afb at algonet.se
Mon Oct 23 01:44:25 PDT 2006


Bill Baxter wrote:

>> 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++).
> 
> Which is which?  Do they all support OpenGL 2.0?  Looks like Derelict 
> does now.  Are there any conflicts from having them all installed (e.g. 
> does more than one want to be called gl.gl)?  Any 
> performance/functionality differences?

Let's see now, the first two uses loaders and the second two linking.

They all live in different D namespaces, even though I think all of
the modules based on DedicateD's use the sdl.sdl/[open]gl.gl naming ?

There is a minor cost in space for the function pointers and startup
loading time, but that shouldn't make any difference in actual use...

I just use the import modules directly, since I find it to be easier.
(especially on platforms like Mac, without DMD and Build easy to use)

>> 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...)
> 
> Ah, but I do like the SDL's cross-platform goodness.  Certain don't want 
> to bother with a bunch of wgl-ing or WinMain-ing to get an otherwise 
> platform neutral GL app up and running.

No, but it is much easier to just use GLUT or GLFW for that...

> I was thinking more of rewriting something "GLUI-like" in D rather than 
> actually wrapping GLUI.  GLUI depends on GLUT for its windowing and 
> input which is kinda annoying, since GLUT has some problems.  And the 
> GLUI code's concept of OO is ... interesting.  Ideally the input/window 
> interface would be abstracted a little bit, so the toolkit could work on 
> top of SDL, for example (albeit single-windowed) or GLUT, or GLFW.  And 
> maybe I'd like to add some simple theming, too.  Not everybody's crazy 
> about the Win95 look 'n' feel, after all. :-)

No, something themable would be nice - I agree with you.

I even did an attempt to make it look a little like MacOS,
by using freetype for the fonts and some bitmap buttons ?
But it wasn't finished, and I didn't need it in the end...

--anders



More information about the Digitalmars-d-learn mailing list