SDL_RenderTextureRotated no longer displays texture
Hi there,
i am learning SDL3 right now and i am working myself through the example directory. So far everything worked except the 08-rotating-textures example.
I first thought it is an error in my code but even after compiling the example file (it compiles fine without issues), i just don't see anything but a black screen.
Sometimes, randomly, i see the SDL image flash for a frame or two, but usually the screen is just black.
The 06-textures example worked flawless.
I am testing this on a Linux with KDE/Wayland. I tested the X11 Fallback mode with export SDL_VIDEODRIVER=x11 does get into affect (i can see it running on X11 then), but the result is the same, the window stays black. Even the random flashes of the SDL logo are no longer there.
In amdgpu_top i can see the Graphics Pipe going up by 30%, so the GPU is working and doing something, it just doesn't get displayed. Using 3.2.16 built from source (via Portage/Gentoo)
Update: When enforcing Software Rendering with export SDL_RENDER_DRIVER=software I can see the logo rotating fine. vulkan and opengl both result in a black window.
It works in the browser fine too.
For what it's worth, this works fine here on Windows, using both the OpenGL and Vulkan drivers... ?
Yes, I am learning SDL3 and followed Mike Shah's SDL3 Tutorial series, but in Episode 20 he shows how to flip the sprite but it doesn't work like Vamp898 told us. I am using CachyOS Arch Linux and KDE/Wayland. Will there be a fix for OpenGL/Vulkan in the next update? Thanks Vamp898 for letting us know; cause I followed what Mike Shah wrote and should work.
I tried this tutorial on Linux X11 and Wayland and it works fine here: https://lazyfoo.net/tutorials/SDL3/06-rotation-and-flipping/index.php
Does it work for you once you fix the arrow.png loading path?
Doesn't work!
Well I tried this arrow example and it compiled fine; I see the arrow but when I try press the # keys or arrow keys to flip, it blanks out, don't see it same as with Mike Shah's SDL3 Episode 20 sprite flip example.
I think the problem is with the KWIN compositor. KWin developers need to update their compositor code to correctly process the OpenGL or Vulkan rendering commands and buffers generated by applications that use these standard transformation features. The best long-term fix is for the KDE/KWin people to patch their compositor. Not sure if you can do a workaround, by detecting whether the app is running KDE/Wayland and then use a fallback method.
I am using KDE Plasma 6.5(Wayland) (latest) desktop.
Fwiw the renderer-rotating-textures example works fine for me with KDE Plasma 6.4.5 on Wayland, both with opengl and vulkan. The rotation and flipping example from lazyfoo works too.
Which Linux distro you using? I am using CachyOS (Arch Linux latest version) and SDL3 version 3.2.26-1.1 from Arch repos. I tried sprite batch with SDL_RenderGeometry and was able to flip, scale, and rotate fine. But it is nice this simple function works too, I think it is good we know about this glitch.
Because i am no longer using KDE and hence no longer KWin (I switched to LabWC quite a few months ago), i tested again with LabWC.
Nothing changed, the issue persists in LabWC as it did in KWin
I am using Gentoo with SDL 3.2.26
// Update --> It works with SDL built from GIT Master but, this example now uses png instead of bmp // Update 2 --> It works with PNG and BMP
So with current master, this is fixed for me, i can no longer reproduce it. With 3.2.26, i still can
Do you use an AMD graphics card? I use a Radeon 7800xt. I just thought maybe that might be another reason. I also posted this on KDE Discuss forums to bring it to KDE's attention. I also install SDL3 3.2.26 from Arch repos, I didn't git clone and compile.
Yes, Renoir, the one built in my CPU (Ryzen 7 5700G)
Well I git cloned the latest sdl3 and tried it again, still doesn't work. I hope it gets fixed SDL_RenderTextureRotated() for use with KDE Plasma KWIN compositor.
Gemini AI tells me this:
The glitch is specifically at the intersection of these technologies. Neither SDL3 nor KWin (in its current state) has implemented the necessary code change or workaround to reliably pass these transformation matrices through the rendering pipeline on your platform.
It is convenient to have this function, but it seems unstable at the moment. Another way that works is using SDL_RenderGeometry() but it is a bit complex.
I tested it with the current GIT Master in KWin and it works for me. Tested again with stable and broken again.
Can you show us how exactly you tested it with master
Oops I forgot to do this before loading the spritetest program and it works with SDL 3.3.3 from github. I forgot this: LD_LIBRARY_PATH=~/sdl3/lib:$LD_LIBRARY_PATH ./spritetest instead of just ./spritetest Now, I wonder when SDL 3.3.3 will be moved to stable. Thanks for helping and letting us know about this glitch.
Try building your examples with -Wl,-rpath,<path-to-directory-containing-llibSDL3.so.0>.
rpath on wikipedia
Gemini AI tells me this: The glitch is specifically at the intersection of these technologies. Neither SDL3 nor KWin (in its current state) has implemented the necessary code change or workaround to reliably pass these transformation matrices through the rendering pipeline on your platform.
BTW, this is complete bunk.
@alextopic SDL uses the (what I think is best) odd/even number system for releases.
So 3.0, 3.2, 3.4 are stable versions while those in between are developer versions.
So you're looking for the 3.4 release, which I am waiting for too as it brings a lot of very comfortable feature