HeadlinesBriefing favicon HeadlinesBriefing.com

SDL_gp: High-performance 2D graphics for SDL3

Hacker News •
×

A new project, SDL_gp, offers a minimal, high-performance 2D graphics painter specifically for SDL3. This library is a port of sokol_gp, adapted for SDL3's lower-level approach. Unlike sokol_gp, which manages resources internally, SDL_gp provides a straightforward resource management system.

The project includes samples to demonstrate its capabilities, such as drawing primitive shapes like rectangles and sprites, and handling blend modes. A basic example illustrates how to draw a red filled rectangle by acquiring a command buffer, beginning a frame, clearing the screen, setting the color, and then drawing the rectangle before flushing and submitting the command buffer.

SDL_gp offers a comprehensive API for error handling, image and shader creation/management, pipeline setup, and various painter functions. These include setting projection, managing transformations, defining viewports and clipping rectangles, and drawing primitives like points, lines, and triangles. The library aims to simplify 2D graphics rendering within the SDL3 environment.