PDA

View Full Version : OpenGL and SDL?



gasdeveloper
28-02-2011, 02:18 PM
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?

gasdeveloper
28-02-2011, 03:54 PM
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.

chronozphere
28-02-2011, 06:33 PM
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.

gasdeveloper
28-02-2011, 06:48 PM
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.

Carver413
01-03-2011, 02:13 PM
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.

code_glitch
01-03-2011, 04:01 PM
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% ;)

WILL
02-03-2011, 04:25 AM
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.