SDL* and GL bindings

Anders F Björklund afb at algonet.se
Sun May 21 09:30:17 PDT 2006


Bruno Medeiros wrote:

>> But I just updated the old versions that were provided by DedicateD,
>> and are also available from Japan: http://shinh.skr.jp/d/porting.html
> 
> Huh? I don't understand what you mean here. Where your bindings also 
> based on DedicateD? What what does that have to do with the D-Porting 
> bindings and why did you mention it?

AFAIK (my japanese isn't too good), those japanese ports are based on 
the versions from DedicateD (http://int19h.tamb.ru/files.html) and they 
are based on the same "idea" that the ones I did - i.e. just port them.

I just started mine over from "scratch" (i.e. the original C headers)
both for copyright and for updating reasons. The end results is very
similar though, and they are both in the "opengl" and "sdl" modules.

So I think all of these should all be source-compatible, for instance ?

>> A recent post included more modern/open source versions of the headers,
>> built from Mesa OpenGL and FreeGLUT instead of "my" SGI OpenGL and GLUT.
>>
>> http://www.digitalmars.com/d/archives/digitalmars/D/announce/2982.html
> 
> *Sigh*, yes, another binding to the mix. Like you said it seems similar 
> to Derelict, except it is based on different GL headers?

It's similar to the ones above, in that is based on a port of C headers.
(seems to include more headers though, including the "platform" GL ones)

Derelict is based on a different idea, namely loading function pointers?

> I (currently) don't know enough about OpenGL to know the differences 
> (and thus the advantages) between those newer/older opengl headers, so I 
> don't know how more useful that binding would be over Derelict. (Meaning 
> I'd rather use Derelict over that one)

I think you understood the difference just fine, with your posting...
(they differ in automatization, and how they link to the libraries)

>> Basically I just include everything in sdl/*.d and link it with SDL ?
>> (similar to how you use it from C, so it's wasn't very documented no)
> 
> No, you *also* have to link with the SDL_D libs, right? (This is 
> something that must be mentioned.)

The only tricky part is that Mac OS X can't use the regular SDLmain, but 
must use a SDLmain_d that has been patched to use a different "main" 
name so that the D and the Objective-C startup can co-exist nicely...

The other libraries are just a convenience that I used so that I didn't 
have to include all the of the source code files with every compilation.
But you *can* do that just fine, with the regular DMD syntax: gdmd *.d

(well, at least that was the idea - maybe it was messed up in practice)

>> The other ones just had implicit names, since they're all in "sdl"...
> 
> I know they have implicit names, I can see that myself :P
> But it is still broke. It works *only* if you compile each module 
> separately, *and* if you only import sdl.sdl (or sdl.main) in your 
> application. (if you import certain other sdl modules it breaks)
> Surely you agree this is not proper behavior.?

I do, but it worked for me when I put it in my /usr/include/d/sdl...
But I'll add the module names at the top of each file, to "fix" it.

>> Once I update the headers to SDL 1.2.10 (etc), I will package it up too.
>> It will probably only work with GDC, but Derelict is good for DMD use ?
>>
> Whoa! "will probably only work with GDC" !?  :|
> (And MikeP also mentioned that Derelict didn't work with GDC as of yet) 

My main target is GDC and Make. I know that others prefer DMD and Build, 
  which is why I suggest that other libraries might be better if you do ?

In theory all the platforms belongs the same "GNU" target interface...
But I usually test my releases on Mac OS X, Windows XP and Fedora Core.

> Are GDC and DMD so far off from each other that it is hard to build code 
> that works in both?! What kind of things are working differently? (I 
> only know of 'the lack of newer D features', and 'the typeof ==/is 
> problem', both of which don't seem very problematic to the creation of 
> bindings.)

In my case, I just can't ever seem to get the standard (GCC) libraries 
working with the special (DMC) libraries with for instance OpenGL etc. ?

There are no real source changes, beyond that DMD uses "linux" and GDC 
uses "Unix" and that GDC is of an older DMD (language) specification.

--anders



More information about the Digitalmars-d mailing list