Results 1 to 7 of 7

Thread: OpenGL and SDL?

  1. #1
    PGDCE Developer
    Join Date
    Jun 2010
    Location
    California, USA
    Posts
    25

    OpenGL and SDL?

    If I am understanding this correctly, SDL is a layer (library) on top of OpenGL?

    Is there any reason to use SDL instead of just using the OpenGL glut library directly?

  2. #2
    PGDCE Developer
    Join Date
    Jun 2010
    Location
    California, USA
    Posts
    25
    Well, after some more research, I have found dglOpenGL header. It is used by Vampire Image Library in some of their demos. And I have read up on SDL. So now I guess my question should be.

    Should I use only SDL? or should I mix SDL with Delphi's OpenGL.pas or mix it with dglOpenGL.pas or some other library like glut?

    The only thing that concerns me is that when I looked at the demos for SDL I was getting far Worse framerates than with the dglOpenGL or OpenGL. It would be worth it to mention that I am looking at a desktop only solution and do not plan to support mobile devices.

  3. #3
    I've done SDL with dglOpenGL.pas. Worked great. OpenGL will allow you to render your graphics fast and SDL will take care of all the other aspects like input, sound, threading, timing etc.

    SDL alone can give you low framerates because it doesn't use hardware acceleration for rendering (correct me if i'm wrong). Stay away from GLUT! it's outdated.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  4. #4
    PGDCE Developer
    Join Date
    Jun 2010
    Location
    California, USA
    Posts
    25
    Awesome, thanks for the pointers. I am working on a simple test of dglOpenGL.pas and SDL at the moment. I am using SDL to create the Window (PaintSurface) and setup the OpenGL Attributes using SDL_GL_SetAttribute. I am also looking at NeHe.GameDev.Net for some references to setup a clean project and OpenGL settings.

  5. #5
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    you might have a look at the Kambi VRML game engine as an alternative to SDL. there are a few goodies in their that you can use without having to use the engine. the source is highly commented.

  6. #6
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    I find that it is like SDL was meant to be supplemented by OpenGl. Simply put, if you use SDL for resource loading and etc while using OpenGl to render it all you'll find a staggering performance increase. If you need help, look into my newer revisions of Prometheus_Video since it uses SDL for loading resources and Opengl to render them etc. It has a few downsides at the moment though but all seems to work 100%
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  7. #7
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    SDL is great for learning how to make games. Especially when you are just starting out. People who want to jump right into 3D probably won't do very well considering they won't even know what to do with all that graphics knowledge since they don't yet know how to make a game out of it yet.

    SDL is meant to be able to do most things well and it's a good stepping stone or even building block to bigger and better games. The nice thing about it is that even though you may move onto 3D later on using OpenGL (or even Direct3D) you can still continue to use much of it as it's still a very powerful API for games development. Especially if you want to make games for multiple platforms.

    OpenGL on the other hand is your 3D graphics that you can use on top of SDL or by it's own and with other input, audio, window management, music playback and other libraries. If you have started out with SDL and are moving onto OpenGL for the faster graphics features then you might as well keep SDL around as it does the rest quite well and does make things a bit easier for you when wanting to setup windows, textures and the like.
    Jason McMillen
    Pascal Game Development
    Co-Founder





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •