Question

I assume that SDL 2 uses OpenGL rendering in the background (or perhaps DirectX if on Windows) and this decision is made by SDl itself.

I have seen tutorials which show the use of OpenGL directly in SDL and wondered what benefit, if any would you get from using OpenGL direct? Are there things which SDL would not be able to achieve natively?

Was it helpful?

Solution

If you completely rely on SDL functionality for graphic purposes, you only have access to simple image and buffer functions.

Accelerated 2D render API: Supports easy rotation, scaling and alpha blending, all accelerated using modern 3D APIs

But what SDL also does is providing an OpenGL context. This means you also have full access to OpenGL functionality including 3D objects, shaders, etc.

You can use SDL simply to create your context and provide you with sound, input, and file i/o, and use OpenGL to bring color to the screen, or use the SDL video API to draw sprites and images.

OTHER TIPS

http://wiki.libsdl.org/MigrationGuide

Simple 2D rendering API that can use Direct3D, OpenGL, OpenGL ES, or software rendering behind the scenes

SDL2 just give you easy start with 2D graphics (and other matters) but you can't do "real 3D" only with SDL. (or i don't know about something?)

I don't know what SDL do "behind the scenes" but if you use directly OpenGL (or other API like Direct3D) you have full control over the code and rendering process and you aren't limited to SDL graphics API.

I use SDL only for creating window, graphics context and using input devices like mouse.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top