PDA

View Full Version : How it works



Crisp_N_Dry
04-01-2005, 12:19 AM
I've just taken up learning SDL, which I'm pleased to say is going extremely well due to how well designed it is. What I want to know is how it works. I'm confused as to what libraries it uses. The name suggest DirectX but the help files mention OpenGl. And since it is multi platform I guess DirectX is out of the question. Or does it use various different libraries depending on platfrom (This would make the most sense). I'm also interested to know, can it out perform DirectDraw on 2D operations? I'm talking pure 2D, not 2D emulation using 3D acceleration. If it can even do this, I don't even know if it is doing pure 2D at all. From first glance I'd say it is but perhaps one of you guys can shed some light.

{MSX}
04-01-2005, 07:47 AM
I've just taken up learning SDL, which I'm pleased to say is going extremely well due to how well designed it is. What I want to know is how it works. I'm confused as to what libraries it uses. The name suggest DirectX but the help files mention OpenGl. And since it is multi platform I guess DirectX is out of the question. Or does it use various different libraries depending on platfrom (This would make the most sense). I'm also interested to know, can it out perform DirectDraw on 2D operations? I'm talking pure 2D, not 2D emulation using 3D acceleration. If it can even do this, I don't even know if it is doing pure 2D at all. From first glance I'd say it is but perhaps one of you guys can shed some light.

SDL is a media layer as DirectX is. It covers 2d, 3d, sound, network, etc, etc and it is cross platform.
afaik, for 2D it uses whatever tecnology is present on the system: directdraw, software, 2d opengl, etc. If i'm correct, future version could start using opengl for 2d in all environments. For 3D, instead of reinventing the wheel, they plugged-in OpenGL, so the 3D part of SDL relies completely on Opengl. Also, instead of making another "layer" to hide the implementation, they did no layer at all. You can just use OpenGL directly. This is an important point. SDL take care of preparing you the window, handling input events etc, then you can call opengl api seamlessy for rendering.
I've always found this a cool feature.

Please correct me if i'm wrong.

bye :P

savage
04-01-2005, 10:19 AM
Pretty much everything MSX said is correct. Just for your own info. SDL currently access DirectX 5 on Win32 and can also access GDI if you set an environment variable. So theoretically you could get your 2D game to run on quite old hw. On Un*x and the like is can either use X11 or the new Direct Video standard ( I think ) and as mentioned on all platforms for 3D it lets you use OpenGL. If using it with OpenGL then treat SDL like you would Glut, which is basically as a window and input manager.

{MSX}
04-01-2005, 11:07 AM
On Un*x and the like is can either use X11 or the new Direct Video standard ( I think ).
Can you give more info about this Direct Video ? Is there a site or something ?

savage
04-01-2005, 01:31 PM
Sorry I used the wrong term. DGA is the acronym and is stands for Direct Graphics Access. I could not find a site, I believe it is part of xfree86.org. My understanding is that DGA draws directly to the framebuffer, but may require root permissions.