Sdl Gpu

A library for high-performance, modern 2D graphics with SDL written in C.
Alternatives To Sdl Gpu
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
2 days ago1July 11, 2022287bsd-2-clauseC++
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
4 days ago91otherC++
Lightweight and modular C++11 graphics middleware for games and data visualization
a month ago28mitCommon Lisp
A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
Sdl Gpu1,017
a year ago71mitC
A library for high-performance, modern 2D graphics with SDL written in C.
C Ray680
7 days ago17mitC
c-ray is a small, simple path tracer written in C
a month ago3April 11, 201737otherC++
C++ bindings/wrapper for SDL2
2 months ago6mitC
A lightweight game development environment where games can be written in Wren
3 years agomitC++
Clustered Forward/Deferred renderer with Physically Based Shading, Image Based Lighting and a whole lot of OpenGL.
17 days ago10bsd-2-clauseC
Cross-Platform GUI Toolkit (stable)
2 months ago12gpl-2.0C++
FreeRCT aims to be a free and open source game which captures the look, feel and gameplay of the popular games RollerCoaster Tycoon 1 and 2.
Alternatives To Sdl Gpu
Select To Compare

Alternative Project Comparisons

SDL_gpu, a library for making hardware-accelerated 2D graphics easy. by Jonathan Dearborn

Travis-ci Status Appveyor Status

SDL_gpu is licensed under the terms of the MIT License. See LICENSE.txt for details of the usage license granted to you for this code.


  • High performance (it automatically collects and submits batches instead of separate draw commands for each sprite and redundant state changes)
  • Shader API
  • Arbitrary geometry rendering (triangles)
  • Can be integrated with explicit OpenGL calls (mixed 2D and 3D)
  • Full blend state control
  • Built-in primitive shapes (points, lines, tris, rects, ellipses, polygons, even arcs)
  • Uses a style familiar to SDL 1.2 users
  • Compatible with either SDL 1.2 or 2.0
  • Loads BMP, TGA, and PNG files via stb-image
  • Rotates and scales about the center of images, making reasoning about the resulting corner coordinates more obvious (adjustable via anchor settings)


SDL_gpu is free and open source! You can help either by contributing a pull request, filling out a bug report, sending an email, or give me a chance to put more time into it by donating:


Anything you can do to help is really appreciated!


SDL_gpu is hosted on Github (grimfang4/sdl-gpu). You can check out the latest version of the source code with Git:

git clone sdl-gpu


SDL 1.2 or SDL 2.0 (
A rendering backend
	Currently implemented:
		OpenGL 1.1, 2.0, 3.0, 4.0
		OpenGL ES 1.1, 2.0, 3.0


Automated Windows build status and prebuilt library files can be found at the Appveyor page:

Appveyor Status

Automated build status for Linux and MacOS can be found at the project page on Travis CI:

Build Status

SDL_gpu uses CMake ( to coordinate the library build process. CMake is available as a GUI program or on the command line.

For Linux/UNIX systems, run CMake in the base directory:

cmake -G "Unix Makefiles"
sudo make install

For Linux/UNIX systems, changing the default installation directory can be done like so:

cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr

For Windows systems, you can use cmake-gui and select appropriate options in there (warning: cmake-gui is messy!).


Add the include for SDL_gpu.h to your sources. Link to SDL2_gpu (libSDL2_gpu.a) or SDL_gpu (if you use the old SDL 1.2).


Documentation is automatically generated with Doxygen (

Pre-generated documentation can be found on the page:


SDL_gpu can be used to replace the SDL_Render subsystem of SDL2. SDL_gpu uses GPU_Target to represent a render target (a render destination, e.g. the screen) instead of an SDL_Renderer object. SDL_gpu also uses GPU_Image as a texture container (a render source) instead of SDL_Texture.

Here is a list of most of the comparable functions:

SDL_CreateWindow() : Either use GPU_SetInitWindow() or replace with GPU_Init()
SDL_CreateRenderer() : GPU_Init()
SDL_LoadBMP() : GPU_LoadImage() or GPU_LoadSurface()
SDL_CreateTextureFromSurface() : GPU_CopyImageFromSurface()
SDL_SetRenderDrawColor() : Pass color into rendering function (e.g. GPU_ClearRGBA(), GPU_Line())
SDL_RenderClear() : GPU_Clear(), GPU_ClearRGBA()
SDL_QueryTexture() : image->w, image->h
SDL_RenderCopy() : GPU_Blit() or GPU_BlitRect()
SDL_RenderPresent() : GPU_Flip()
SDL_DestroyTexture() : GPU_FreeImage()
SDL_DestroyRenderer() : GPU_FreeTarget() (but don't free the screen target yourself)

SDL_RenderDrawPoint() : GPU_Pixel()
SDL_RenderDrawLine() : GPU_Line()
SDL_RenderDrawRect() : GPU_Rectangle()
SDL_RenderFillRect() : GPU_RectangleFilled()
SDL_RenderCopyEx() : GPU_BlitRotate() or GPU_BlitScale() or GPU_BlitTransform()
SDL_SetRenderDrawBlendMode() : GPU_SetShapeBlendMode()
SDL_SetTextureBlendMode() : GPU_SetBlendMode()
SDL_SetTextureColorMod() : GPU_SetRGBA() or GPU_SetColor()
SDL_SetTextureAlphaMod() : GPU_SetRGBA() or GPU_SetColor()
SDL_UpdateTexture() : GPU_UpdateImage() or GPU_UpdateImageBytes()
SDL_RenderSetClipRect() : GPU_SetClip() or GPU_SetClipRect()
SDL_RenderReadPixels() : GPU_CopySurfaceFromTarget() or GPU_CopySurfaceFromImage()
SDL_RenderSetViewport() : GPU_SetViewport()
SDL_SetRenderTarget() : GPU_LoadTarget()

Some SDL functions use a rectangular region passed as an SDL_Rect. SDL_gpu uses floating point coordinates for subpixel precision, so you may have to use GPU_Rect for some SDL_gpu functions.

Popular Sdl Projects
Popular Graphics Projects
Popular Graphics Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
2d Graphics