A library for high-performance, modern 2D graphics with SDL written in C.

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.

FEATURES

  • 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)

HELP OUT

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:

paypal

Anything you can do to help is really appreciated!

LATEST SOURCE

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

git clone https://github.com/grimfang4/sdl-gpu.git sdl-gpu

DEPENDENCIES

SDL 1.2 or SDL 2.0 (www.libsdl.org)
A rendering backend
	Currently implemented:
		OpenGL 1.1, 2.0, 3.0, 4.0
		OpenGL ES 1.1, 2.0, 3.0

BUILDING

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 (www.cmake.org) 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"
make
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!).

INCLUDING / LINKING

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).

FULL DOCUMENTATION

Documentation is automatically generated with Doxygen (http://sourceforge.net/projects/doxygen).

Pre-generated documentation can be found on the Github.io page: https://grimfang4.github.io/sdl-gpu/

CONVERSION

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.

Owner
Comments
  • What else would be good for v0.12.0?

    What else would be good for v0.12.0?

    There are already a lot of good changes and new features in 0.11.0 that will be released as 0.12.0, but here are some more possibilities:

    Direct VBO support GLES 3 renderer GL 4 renderer

  • GPU_CopyImage Target Memory Leak

    GPU_CopyImage Target Memory Leak

    After copying an image with GPU_CopyImage and then changing its target, such as with GPU_LoadTarget, there is a memory leak. gpu_copy_image_pixels_only creates a target for the newly copied image but does not free it. The user is not told that the copied image has a target that needs to be freed before creating a new one.

  • is there win32/x86 support? (couldn't find any info anywhere)

    is there win32/x86 support? (couldn't find any info anywhere)

    Hi,

    It has been a big hassle to make it work on windows (with visual studio 2019) , hell I didn't even make it work, I just found a project that used sdl_gpu with an sln file in the repository and am testing that, but I saw there is only x64 compiler options, so I was wondering is it due sdl_gpu not supporting x86?

    thank you

  • Cygwin support

    Cygwin support

    I'm trying to build the library on Cygwin:

    mkdir build-cygwin
    cd build-cygwin
    cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(PREFIX)" -DSDL_gpu_DEFAULT_BUILD_DEMOS=OFF ..
    make
    

    This fails with errors about CALLBACK macro not being defined. It's defined in bundled GLEW/gl.h only if both _WIN32 and __CYGWIN__ macros are present, so I added this switch to cmake commandline:

     -DCMAKE_C_FLAGS="-D_WIN32"
    

    The library now compiles, but linking step fails:

    [  9%] Linking C shared library cygSDL2_gpu.dll
    cd /cygdrive/c/Users/User/.../sdl-gpu/build-cygwin/src && /usr/bin/cmake.exe -E cmake_link_script CMakeFiles/SDL_gpu_shared.dir/link.txt --verbose=1
    /usr/bin/cc  -D_WIN32   -shared -Wl,--enable-auto-import -o cygSDL2_gpu.dll -Wl,--out-implib,libSDL2_gpu.dll.a -Wl,--major-image-version,0,--minor-image-version,0 CMakeFiles/SDL_gpu_shared.dir/externals/glew/glew.c.o 
    [skipped]
    CMakeFiles/SDL_gpu_shared.dir/externals/stb_image_write/stb_image_write.c.o /cygdrive/c/Users/User/.../libroot/cygwin/lib/libSDL2.dll.a -Wl,-Bstatic -lm -Wl,-Bdynamic -lGL 
    CMakeFiles/SDL_gpu_shared.dir/externals/glew/glew.c.o:glew.c:(.text+0x4ff): undefined reference to `__imp_wglGetProcAddress'
    CMakeFiles/SDL_gpu_shared.dir/externals/glew/glew.c.o:glew.c:(.text+0x4ff): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_wglGetProcAddress'
    CMakeFiles/SDL_gpu_shared.dir/externals/glew/glew.c.o:glew.c:(.text+0x537): undefined reference to `__imp_wglGetProcAddress'
    CMakeFiles/SDL_gpu_shared.dir/externals/glew/glew.c.o:glew.c:(.text+0x537): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_wglGetProcAddress'
    

    I've tried adding -lopengl32 to linker flags, but this didn't change anything. Any pointers are appreciated! I'm trying to link against native OpenGL, not the Cygwin's X11 OpenGL.

  • GPU_Init - transparent window background?

    GPU_Init - transparent window background?

    Is there a way to have a transparent main opengl window background that one can see what is behind the window? I checked the flags for GPU_Init but didn't found something regarding this.

    I'm using Ubuntu 20.04 and have a project which currently already creates a native transparent xlib/xwindow opengl enabled and use SDL_CreateWindowFrom to be able to use SDL2 with it but now I want to integrate sdl-gpu. So I see two possibilities:

    1. Passing gl context of this xwindow to sdl-gpu which should be used by this library.
    2. Let do transparent background via GPU_Init / sdl-gpu without xwindow (should be preferred).

    I would like to use option two because currently I have to manage events in XPending/XNextEvent but I would prefer to use SDLs SDL_PollEvent How can I manage this with sdl-gpu?

  • Differentiate naming of static and shared libraries

    Differentiate naming of static and shared libraries

    I'm building my project for 'Release' in vs2015. I'm using the libs generated from building SDL_gpu_shared for 'Release.' Using the latest SDL_gpu commit, building my project for 'Release' gets a lot of unresolved external errors for OpenGL functions. I must link opengl32.lib for my project to build. This is not the case when using the May 14th commit 7c3d8fa612465a452fe9baf4463db0fb422746c7. I do not need to link opengl32.lib in my project for the older commit. I'm not sure if this is desired behavior, but I wanted to let you know of the change.

  • Fix camera matrix multiplication order (again?)

    Fix camera matrix multiplication order (again?)

    Commit https://github.com/grimfang4/sdl-gpu/commit/d4a4b39e7defb2ff9728373d5f204d1dbe486a90 breaks our existing code, because the "fixed" order in that PR fails to scale the translate component of our MV matrices. So after the transforms we end up with a MVP matrix that looks something like this:

    | | | | | | ---- | ---- | ---- | ---- | | tiny | 0 | 0 | 0 | | 0 | tiny | 0 | 0 | | 0 | 0 | tiny | 0 | | huge | huge | 0 | 1 |

    ... meaning all of our content is presumably rendered perfectly, but hundreds of screen-widths away.

    The issue doesn't occur in the old version, or when we reverse the order of the matrix multiplication, as in this PR. Not sure if the old version was causing bugs, but we certainly get a blank screen on the latest master without the change in this PR.

  • Added Polygon2, patched get_complete_color_mod

    Added Polygon2, patched get_complete_color_mod

    Added GPU_Polygon2 function which draws optionally open polygons using line strips. Patched get_complete_color_mod to allow image = NULL.

    Please accept my humble contribution.

  • Unable to initialize a renderer on an external window

    Unable to initialize a renderer on an external window

    SDL2 allows you to call SDL_CreateWindowFrom() on an existing GUI object's window handle, and then create a renderer on it. This technique doesn't appear to migrate well to SDL_GPU.

    • Create a Windows form
    • Create a control on it and obtain its HWND
    • Create an SDL_Window on that HWND with SDL_CreateWindowFrom.
    • Call SDL_GetWindowID on this window and GPU_SetInitWindow on the result
    • Call GPU_Init

    Expected: A working renderer Observed: GPU_Init fails. Could not initialize.

    A bit of digging reveals that this happens because GLEW could not retrieve the version string, because SDL_GPU failed to initialize the first GL context before calling glewInit. After doing this manually on my end, GPU_Init now throws an access violation in the call to applyTargetCamera because GPU_GetContextTarget returns null.

    As near as I can tell, this is returning null because earlier on, in the call to MakeCurrent, target->context->context is null and so the required initialization never takes place. I haven't been able to determine yet what's missing that's causing target->context->context to be null at this point.

  • Drawing a circle show a ellipse when draw the circle in a image target and blit it to another target

    Drawing a circle show a ellipse when draw the circle in a image target and blit it to another target

    image

    ~/sdl-gpu/tests/render-target/main.c:

    #include "SDL.h"
    #include "SDL_gpu.h"
    #include <math.h>
    #include "compat.h"
    #include "common.h"
    #include "demo-font.h"
    
    
    int main(int argc, char* argv[])
    {
    	GPU_Target* screen;
    
    	screen = initialize_demo(argc, argv, 800, 600);
    	if(screen == NULL)
    		return 1;
    
    	{
    		GPU_Image* image2;
    		GPU_Image* image3;
    		SDL_Surface* font_surface;
    		DemoFont* font;
    		GPU_Image* mode1image;
    		GPU_Image* mode2image;
    		SDL_Color circleColor = { 255, 0, 0, 128 };
    		SDL_Color circleColor2 = { 0, 0, 255, 128 };
    		Uint32 startTime;
    		long frameCount;
    		const Uint8* keystates;
    		int mode;
    		int x;
    		int y;
    		Uint8 done;
    		SDL_Event event;
    
    		image2 = GPU_LoadImage("data/test2.bmp");
    		if (image2 == NULL)
    			return 2;
    
    		image3 = GPU_LoadImage("data/test.bmp");
    		if (image3 == NULL)
    			return 3;
    
    		font_surface = GPU_LoadSurface("data/comic14.png");
    		font = FONT_Alloc(font_surface);
    		if(font == NULL)
            {
                GPU_LogError("Failed to load font.\n");
                return 4;
            }
    		GPU_SetRGB(font->image, 255, 0, 0);
    		SDL_FreeSurface(font_surface);
    
    		mode1image = GPU_CreateImage(300, 300, GPU_FORMAT_RGBA);
    		if (mode1image == NULL)
    			return 5;
    
    		mode2image = GPU_CreateImage(400, 400, GPU_FORMAT_RGBA);
    		if (mode2image == NULL)
    			return 6;
    
    		GPU_LoadTarget(mode1image);
    		GPU_LoadTarget(mode2image);
    
            int height = 400;
    		GPU_Image* light = GPU_CreateImage(height, height, GPU_FORMAT_RGBA);
            GPU_SetBlending(light, true);
    		GPU_LoadTarget(light);
            GPU_ClearRGBA(light->target, 0, 0, 0, 128);
    
            float centerX = height / 2.0f;
            float centerY = height / 2.0f;
            float radius = height/ 2.0f;
            SDL_Color color = {255,255,0, 128};
            GPU_CircleFilled(light->target, centerX, centerY, radius, color);
    
    		startTime = SDL_GetTicks();
    		frameCount = 0;
    
    		keystates = SDL_GetKeyState(NULL);
    
    		mode = 0;
    		x = 0;
    		y = 0;
    
    		done = 0;
    		while (!done)
    		{
    			while (SDL_PollEvent(&event))
    			{
    				if (event.type == SDL_QUIT)
    					done = 1;
    				else if (event.type == SDL_KEYDOWN)
    				{
    					if (event.key.keysym.sym == SDLK_ESCAPE)
    						done = 1;
    					else if (event.key.keysym.sym == SDLK_SPACE)
    					{
    						mode++;
    						if (mode > 1)
    							mode = 0;
    					}
    					else if (event.key.keysym.sym == SDLK_f)
    						GPU_SetFullscreen(!GPU_GetFullscreen(), 0);
    					else if (event.key.keysym.sym == SDLK_g)
    						GPU_SetFullscreen(!GPU_GetFullscreen(), 1);
    					else if (event.key.keysym.sym == SDLK_1)
    						GPU_UnsetVirtualResolution(screen);
    					else if (event.key.keysym.sym == SDLK_2)
    						GPU_SetVirtualResolution(screen, 1200, 800);
    				}
    			}
    
    			if (keystates[KEY_UP])
    				y -= 1;
    			else if (keystates[KEY_DOWN])
    				y += 1;
    			if (keystates[KEY_LEFT])
    				x -= 1;
    			else if (keystates[KEY_RIGHT])
    				x += 1;
    
    			GPU_Clear(screen);
    
    			if (mode == 0)
    			{
    				GPU_Target* mode1target = mode1image->target;
    				SDL_Color red = { 255, 0, 0, 255 };
    
    				GPU_ClearRGBA(mode1target, 0, 255, 0, 255);
    				GPU_Blit(image3, NULL, mode1target, image3->w / 2, image3->h / 2);
    
    
    				//GPU_BlitScale(image2, NULL, mode1target, mode1target->w/2, mode1target->h/2, 0.7f, 0.7f);
    				//GPU_BlitScale(image2, NULL, mode1target, x, y, 0.7f, 0.7f);
    
    				GPU_BlitTransform(image2, NULL, mode1target, x, y, 360 * sin(SDL_GetTicks() / 1000.0f), 0.7f*sin(SDL_GetTicks() / 2000.0f), 0.7f*sin(SDL_GetTicks() / 2000.0f));
    
    				//GPU_Line(mode1target, 0, 0, mode1target->w, mode1target->h, red);
    				//GPU_CircleFilled(mode1target, 70, 70, 20, circleColor);
    
                    GPU_Rect srcRect = GPU_MakeRect(0, 0, light->w, light->h);
                    GPU_Rect destRect = GPU_MakeRect(0, 0, light->w, light->h);
                    GPU_BlitRect(light, &srcRect, mode1target, &destRect);
    
    				GPU_Blit(mode1image, NULL, screen, mode1image->w / 2 + 50, mode1image->h / 2 + 50);
    				GPU_BlitScale(mode1image, NULL, screen, mode1image->w * 2 + 50, mode1image->h / 2 + 50, 0.7f, 0.7f);
    
    				GPU_CircleFilled(screen, 50 + 70, 50 + 70, 20, circleColor2);
    
    				GPU_Blit(image2, NULL, screen, screen->w - image3->w - image2->w / 2, screen->h - image2->h / 2);
    				GPU_Blit(image3, NULL, screen, screen->w - image3->w / 2, screen->h - image3->h / 2);
    			}
    			else if (mode == 1)
    			{
    				GPU_Target* mode2target = mode2image->target;
    				SDL_Color red = { 255, 0, 0, 255 };
    				SDL_Color blue = { 0, 0, 255, 255 };
    
    				GPU_ClearRGBA(mode2target, 255, 255, 255, 255);
    
    
    				GPU_Line(mode2target, 0, 0, mode2target->w, mode2target->h, red);
    				GPU_Line(mode2target, 0, mode2target->h, mode2target->w, 0, red);
    				GPU_TriFilled(mode2target, mode2target->w / 2, mode2target->h / 2 + 10, mode2target->w / 2 - 10, mode2target->h / 2 + 20, mode2target->w / 2 + 10, mode2target->h / 2 + 20, red);
    
    				GPU_Blit(image2, NULL, mode2target, x, y);
    
    
    
    				GPU_Line(screen, 0, 0, screen->w, screen->h, blue);
    				GPU_Line(screen, 0, screen->h, screen->w, 0, blue);
    
    				GPU_Blit(mode2image, NULL, screen, mode2image->w / 2, mode2image->h / 2);
    			}
    
    			FONT_Draw(font, screen, 20, 20, "Testing");
    
    			GPU_Flip(screen);
    
    			frameCount++;
    			if (frameCount % 500 == 0)
    			{
    				printf("Average FPS: %.2f\n", 1000.0f*frameCount / (SDL_GetTicks() - startTime));
    				printf("x,y: (%d, %d)\n", x, y);
    			}
    		}
    
    		printf("Average FPS: %.2f\n", 1000.0f*frameCount / (SDL_GetTicks() - startTime));
    
    		FONT_Free(font);
    		GPU_FreeImage(mode2image);
    		GPU_FreeImage(mode1image);
    	}
    
    	GPU_Quit();
    
    	return 0;
    }
    
  • Expose texture handles with a function

    Expose texture handles with a function

    Since SDL_gpu does my image loading, I was wondering if a convenient GetHandle function could be added to get a texture handle without me depending on an IMAGE_DATA structure cast.

  • Feature request: PrimitiveBatch with subbuffers

    Feature request: PrimitiveBatch with subbuffers

    I'm not sure how much work it would be to add this feature but it's something I had on my mind.

    The way PrimitiveBatch currently works is by taking a single pointer to an interleaved buffer.

    I would like if PrimitiveBatch also had a way to take multiple pointers to distinct subbuffers of packed data instead (implemented with glBufferSubData).

    If this is the current PrimitiveBatch API

    DECLSPEC void SDLCALL
    GPU_PrimitiveBatch(
        GPU_Image* image,
        GPU_Target* target,
        GPU_PrimitiveEnum primitive_type,
        unsigned int num_vertices,
        float* values,
        unsigned int num_indices,
        unsigned int* indices,
        GPU_BatchFlagEnum flags);
    

    This is what I imagine this new API could look like

    typedef struct GPU_SubBuffers {
           float *x_values;
           float *y_values;
           float *z_values;
           float *s_values;
           float *t_values;
           float *r_values;
           float *g_values;
           float *b_values;
           float *a_values;
           uint8_t *r8_values;
           uint8_t *g8_values;
           uint8_t *b8_values;
           uint8_t *a8_values;
    } GPU_SubBuffers;
    
    DECLSPEC void SDLCALL
    GPU_PrimitiveBatchSub(
        GPU_Image* image,
        GPU_Target* target,
        GPU_PrimitiveEnum primitive_type,
        unsigned int num_vertices,
        const GPU_SubBuffers *values,
        unsigned int num_indices,
        unsigned int* indices,
        GPU_BatchFlagEnum flags);
    
  • Image stops rendering in window after closing another

    Image stops rendering in window after closing another

    I'm running into an issue where one window stops showing blitted images after closing another one. What's strange is that this only happens when the first opened window is closed that the second's images disappear, and not the other way around.

    To close windows, I'm calling SDL_DestroyWindow and GPU_FreeTarget on the target. And I've made sure to call GPU_MakeCurrent on the correct window before loading each GPU_Image. The loaded matrix appears to be unaffected at this point. Images are rendered with GPU_BlitRectX, and it appears that the parameters I'm passing are unchanged.

    (Also the secondary window is opened using SDL_CreateWindow and GPU_CreateTargetFromWindow, although I've tried opening both this way after creating a dummy window with GPU_InitRenderer, but the problem persists.)

    I'm out of ideas. Would anyone have any clue what might be causing this? Thank you.

  • Floating point FBO in SDL_gpu

    Floating point FBO in SDL_gpu

    I was wondering whether SDL_gpu supports floating point framebuffer objects.

    I'm working on a remake of an older game in C/C++ and I used SDL_gpu to be able to utilize shaders. However, when I draw using the shader of my choice (ntsc-adaptive from libretro), everything seems to have a pink tint to it (left - shader off, right - shader on):

    off-on

    I learned that this might be a side effect of not utilizing a floating point FBO. Does SDL_gpu support this in some way? When calling GPU_CreateImage I can pick the format, but whatever SDL_gpu format I use, it all seems to be of internal format GL_RGBA/type GL_UNSIGNED_BYTE under the hood (and I'm assuming I need GL_RGBA32F/GL_FLOAT).

  • Building from source fails with `Undefined symbols for architecture x86_64` on macOS 10.15.7

    Building from source fails with `Undefined symbols for architecture x86_64` on macOS 10.15.7

    [ 34%] Linking C shared library ../SDL_gpu/lib/SDL2_gpu.framework/SDL2_gpu
    Undefined symbols for architecture x86_64:
      "_SDL_GL_SwapBuffers", referenced from:
          _Flip in renderer_OpenGL_1_BASE.c.o
          _Flip in renderer_OpenGL_1.c.o
          _Flip in renderer_OpenGL_2.c.o
          _Flip in renderer_OpenGL_3.c.o
          _Flip in renderer_OpenGL_4.c.o
      "_SDL_GetVideoSurface", referenced from:
          _GPU_GetFullscreen in SDL_gpu.c.o
          _SetFullscreen in renderer_OpenGL_1_BASE.c.o
          _get_window_id in renderer_OpenGL_1_BASE.c.o
          _get_window in renderer_OpenGL_1_BASE.c.o
          _resize_window in renderer_OpenGL_1_BASE.c.o
          _SetFullscreen in renderer_OpenGL_1.c.o
          _get_window_id in renderer_OpenGL_1.c.o
          ...
      "_SDL_SetPalette", referenced from:
          _gpu_copy_raw_surface_data in SDL_gpu.c.o
      "_SDL_SetVideoMode", referenced from:
          _Init in renderer_OpenGL_1_BASE.c.o
          _resize_window in renderer_OpenGL_1_BASE.c.o
          _Init in renderer_OpenGL_1.c.o
          _resize_window in renderer_OpenGL_1.c.o
          _Init in renderer_OpenGL_2.c.o
          _resize_window in renderer_OpenGL_2.c.o
          _Init in renderer_OpenGL_3.c.o
          ...
      "_SDL_WM_ToggleFullScreen", referenced from:
          _SetFullscreen in renderer_OpenGL_1_BASE.c.o
          _SetFullscreen in renderer_OpenGL_1.c.o
          _SetFullscreen in renderer_OpenGL_2.c.o
          _SetFullscreen in renderer_OpenGL_3.c.o
          _SetFullscreen in renderer_OpenGL_4.c.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [SDL_gpu/lib/SDL2_gpu.framework/Versions/A/SDL2_gpu] Error 1
    make[1]: *** [src/CMakeFiles/SDL_gpu_shared.dir/all] Error 2
    make: *** [all] Error 2
    
    $ uname -mp
    x86_64 i386
    
  • Example rendering ffmpeg decoded frames with sdl_gpu?

    Example rendering ffmpeg decoded frames with sdl_gpu?

    There's an example code here that uses SDL_UpdateYUVTexture to render video frames generated by ffmpeg. But there's no example doing the same using SDL_GPU.

    I tried GPU_UpdateImageBytes. Although it generally works (having an issue where video becomes grayscale), the performance feels slower than using SDL_UpdateYUVTexture. I got frame skips and sound stopped playing after a while for a 720p video. Same video plays fine on my platform with SDL_UpdateYUVTexture.

    One thing I noticed is that, with SDL_CreateTexture, I can specify a STREAMING flag. But there's no place to do that with GPU_CreateImage. Could that be the reason for the difference in performance?

    Appreciate any help on this. Basically I want a comparable example as done in the test code but using sdl_gpu.

Related tags
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal
Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal

Low Level Graphics Library (LLGL) Documentation NOTE: This repository receives bug fixes only, but no major updates. Pull requests may still be accept

Jun 19, 2022
A Sudoku solver made in C++ using SDL for graphics.

sudoku_solver A Sudoku solver made in C++ using SDL for graphics. What is a Sudoku puzzle? Sudoku puzzles have been around for a very long time, origi

Nov 12, 2021
A terminal-based graphics library for both 2D and 3D graphics.
A terminal-based graphics library for both 2D and 3D graphics.

TermGL A terminal-based graphics library for both 2D and 3D graphics. Written in C, created for terminals supporting ANSI escape codes. Table of Conte

Jun 19, 2022
kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics

kaun kaun is a replacement for löve's built-in love.graphics module intended for 3D graphics. It is a Lua module you can require from a shared library

Apr 5, 2021
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.
This repo contains the DirectX Graphics samples that demonstrate how to build graphics intensive applications on Windows.

DirectX-Graphics-Samples This repo contains the DirectX 12 Graphics samples that demonstrate how to build graphics intensive applications for Windows

Jun 17, 2022
A modern cross-platform low-level graphics library and rendering framework
A modern cross-platform low-level graphics library and rendering framework

Diligent Engine A Modern Cross-Platform Low-Level 3D Graphics Library Diligent Engine is a lightweight cross-platform graphics API abstraction library

Jun 17, 2022
Remake of Fireboy and Watergirl in a C++ OpenGL&SDL framework

Fireboy and Watergirl After receiving an assignment to make a 2D grid-based game we decided to make a rmake of the popular game 'Fireboy and Watergirl

Dec 2, 2021
Yet another Chip-8 interpreter, this time written in C++ using GLFW and OpenGL as its graphics library 💻
Yet another Chip-8 interpreter, this time written in C++ using GLFW and OpenGL as its graphics library 💻

Yet another Chip-8 interpreter, but this time with a beautiful interface ??

Jun 4, 2022
⚡High-performance rendering for python
⚡High-performance rendering for python

ZenGL ZenGL is a minimalist Python module providing exactly one way to render scenes with OpenGL. pip install zengl Documentation zengl on Github zen

Jun 18, 2022
Metal-cpp is a low-overhead C++ interface for Metal that helps developers add Metal functionality to graphics apps, games, and game engines that are written in C++.

About metal-cpp is a low overhead and header only C++ interface for Metal that helps developers add Metal functionality to graphics applications that

Jun 15, 2022
Vire is a C++ voxel rendering engine. It is written in C++14 and uses OpenGL for graphics.

Vire Vire is a C++ voxel rendering engine. It is written in C++14 and uses OpenGL for graphics. Downloads If you'd just like to just download and try,

May 15, 2022
SoL (for Speed of Light, or sun in Spanish) is a Physically-based rendering library written in modern C++

SoL (for Speed of Light, or sun in Spanish) is a small rendering library written in C++20. Its goal is to strike a good balance between performance and usability, and allow easy experimentation for rendering researchers.

May 19, 2022
Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
Cross-platform, graphics API agnostic,

bgfx - Cross-platform rendering library GitHub Discussions Discord Chat What is it? Cross-platform, graphics API agnostic, "Bring Your Own Engine/Fram

Jun 22, 2022
3D engine from scratch (without OpenGL or any other 3D graphics library)
3D engine from scratch (without OpenGL or any other 3D graphics library)

Simple 3d engine based on SFML library. I tried to make this engine powerful and easy to understand.

Jun 4, 2022
A small cross-platform graphics library made in C
A small cross-platform graphics library made in C

minigfx Small graphics library made in C Intended to be: Simple to understand Intuitive Fun to use Features Cross platform: Windows and Linux. To see

Jul 18, 2021
modified Mesa 3D graphics library for Termux

Mesa - The 3D Graphics Library This repo contains the mesa 3d graphics library modified for zink to work on termux Source This repository lives at htt

Feb 25, 2022
Android studio native project template using cross platform raylib graphics library.

rayturbo Android studio native project template using cross platform raylib graphics library. https://www.raylib.com/ This project use Android Studio

Mar 5, 2022
Pathway is an Android library that provides new functionalities around the graphics Path API.

Pathway is an Android library that provides new functionalities around the graphics Path API.

Jun 4, 2022