FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

opengl and sdl bindings or derelict?

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
he-man



Joined: 29 Apr 2006
Posts: 14

PostPosted: Mon Jun 05, 2006 2:21 am    Post subject: opengl and sdl bindings or derelict? Reply with quote

Hi. I've been searching bindings for opengl and SDL and I saw two different projects.

Looking at the documentation I saw that derelict just supports opengl 1.1 but the opengl bindings are up to 2.0. But this project seems to be more active. Which ones should I use? I'm specially interested in using opengl and sdl and its libraries. A piece of advice, please. Very Happy

Thanks for your time.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Mon Jun 05, 2006 3:50 am    Post subject: Reply with quote

When you say "OpenGL bindings", I assume you mean the bindings that are part of the Bindings project. The short answer: your question can only be answered by you. Either set of bindings (Derelict or otherwise) will allow you to access OpenGL and SDL just fine. Which one you select really depends upon the specifics of your project requirements. The long answer follows.

DerelictGL will, in the not too distant future, include definitions for and access to OpenGL 2.0 and extensions. As you pointed out, it currently only supports 1.1. This means that if your project relies on a version of OpenGL greater than 1.1, DerelictGL might not be a good option for you at all.

On the otherhand, the Derelict bindings handle loading of the bound libraries dynamically at runtime, whereas other bindings require you to link to an import library. On Windows, the only possible OpenGL import library that can be linked to is 1.1, anyway. Functionality beyond that must be loaded manually through WGL. On other platforms, linking to a specific version of the library will require users to have that at least that version installed when the application is launched (this part is true also for SDL).

You need to examine your project requirements and go from there. Either approach is just as suitable as the other. I can tell you until I'm blue in the face that I think Derelict's dynamic loading is a much more flexible option, and if you need advanced OpenGL features that it doesn't take much work to implement your own OpenGL extension modules for exactly what you need and then to load the required bits yourself. But ultimately, any advice anyone gives you hinges on what your project requires. Only you can decide that.
Back to top
View user's profile Send private message Send e-mail
JoeCoder



Joined: 29 Oct 2005
Posts: 294

PostPosted: Mon Jun 05, 2006 11:14 am    Post subject: Reply with quote

I just add this file in derelict's opengl directory, add the line
Code:
DerelictGL/derelict/opengl/glext.d
to DerelictGL's forbuild.txt, type dmd -run buildme.d into my console, and I have ready for myself a Derelict OpenGL import library that includes all of the functionality of glext.

I can then use SDL_GL_GetProcAddress() like so:
Code:
glCreateShaderObjectARB      = cast(pfglCreateShaderObjectARB)SDL_GL_GetProcAddress("glCreateShaderObjectARB");

and can load and use any OpenGL function beyond 1.1 that I need. This works on Windows and Linux. I'm sure Aldacron has a cleaner solution planned for the future, but this works for me for the time being.
Back to top
View user's profile Send private message
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Mon Jun 05, 2006 8:55 pm    Post subject: Reply with quote

I'm biased, but I'd go with Derelict any time. It works well, and Windows OpenGL is only up to version 1.1 anyway.

Actually, for me the best thing about Derelict is that it makes it really easy to dynamically link to LGPL libraries (like SDL and its various sister libraries - SDL_image, SDL_mixer, SDL_ttf, and so on). That means I can use SDL stuff without getting my own code LGPLed.
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Mon Jun 05, 2006 11:49 pm    Post subject: Reply with quote

Crispy wrote:
Actually, for me the best thing about Derelict is that it makes it really easy to dynamically link to LGPL libraries (like SDL and its various sister libraries - SDL_image, SDL_mixer, SDL_ttf, and so on). That means I can use SDL stuff without getting my own code LGPLed.


To be fair, there is no difference when using the other bindings as long as you link to the import library. We often throw the terms "static" and "dynamic" around on the Derelict forums, but that is only in reference to the import libraries. As long as you are using sdl.dll (or .so) it doesn't matter if you are using Derelict or not, you still meet the requirements of the LGPL in terms of dynamic linking.
Back to top
View user's profile Send private message Send e-mail
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Tue Jun 06, 2006 10:02 pm    Post subject: Reply with quote

Right. I was misunderstanding what the Bindings project is. Embarassed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group