Rendering to Texture Target and Clipping



After a couple of hours of googling, I have not found a definitive answer to the following:

Does SDL_RenderSetClipRect work when the target is NOT the ‘screen’ buffer(s) but instead another SDL hardware texture?

If so, I can’t get it to work… That’s probably just me :slight_smile:




Yes, it works fine for me. But prior to SDL 2.0.4 there was a bug which caused it to misbehave in those circumstances.


Thanks for info.

SDL ver 2.0.9 here. So, I guess something else is going on… Probably me… Time to take the code apart again (groan):



Somebody has reported a possibly related issue with SDL 2.0.9 so it’s not impossible that it’s genuine. Reading the history of bug #2700 shows how intertwined all these top-left-origin versus bottom-left-origin issues are. What backend are you using: the previous problems have all been specific to OpenGL(ES)?


SDL self-reports renderer chosen as “opengl” (OSX/MacOS). After a few hours of frustration with SDL_Clip_Rect I wrote some code to clip textures manually. After reading the bug report, I got curious and added a bool to switch between SDL’s clip and mine. At a whim, I just flicked to the SDL clip, and it seems to be working! Not aware of any change in my sequence of calls to SDL (once that clip toggle is switched.)

However, for now, I’m assuming this is MY fault/bug and not SDL’s. I’ll come back to this and mess around a bit later… If I get a concrete, reliable case of clip-fail, I’ll get back on the forum and if necessary make a bug report.