I know that SDL 1.2 does software rendering (CPU) and not hardware rendering (GPU). My question is, how do I use SDL but with hardware rendering? How do I not use its rendering API (software) and rather a hardware rendering API like OpenGL?
SDL supports OpenGL outright. There is a guide in the SDL documentation on how to use OpenGL (This is mainly a SDL tutorial, not an OpenGL one [it uses a lot of deprecated functionality]).
You probably also want to change the
SDL_GL_SetAttribute( SDL_GL_RED/GREEN/BLUE_SIZE, 5 ); from
8 bits per pixel, and also add an alpha channel (
After that, you can start using OpenGL like you normally do. Here's a good tutorial - you only need to replace the
glutSomething functions with their SDL equivalents.
Note that if you use OpenGL with SDL, you can't blit onto the screen surface anymore (it works if you use the right flags, but even then it's deprecated functionality). But you can still use
SDL_image to load images and use the
SDL_Surface data to create textures.