SDL* and GL bindings

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Mon May 22 03:57:10 PDT 2006


Anders F Björklund wrote:
> Bruno Medeiros wrote:
>>> 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?
> 

Huh? Jamie Pelcis bindings are similar to Derelict, since they also load 
function pointers. You said it yourself.

>>> 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)
> 

gdmd? What's that about? Isn't it an old project?

In any case, you can't do "dmd *.d" on the bindings just fine (with dmd 
at least,haven't tried with gdc), as it fails the compilation because of 
the mismatched module names, which is what I'm trying to say.

>>> 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.
> 
Like I said, if I'm not mistaken, it only worked because you compiled 
each module separately, and because you imported only the sdl.sdl module 
(or sdl.main).
(And thanks for the upcoming fix.)

>>> 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

I'm not understanding you here. What special DMC libraries? What's the 
relation with OpenGL? (that phrase seems a bit misconstructed)

-- 
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list