Skip to content

sdl2-compat SDL_RenderSetScale not compatible with SDL2 #425

@LordOfTrident

Description

@LordOfTrident

In my game, I draw a menu background, and then a menu overlay with a scale up/down animation using SDL_RenderSetScale:

	Rect viewport = Rect_new(CANVAS_X, CANVAS_Y, CANVAS_W, CANVAS_H);
	setViewport(viewport);

	SDL_SetRenderDrawColor(core.ren, 0, 0, 0, state.darken);
	SDL_RenderFillRect(core.ren, NULL);

	setViewport(Rect_lerpSize(viewport, state.scale));
	SDL_RenderSetScale(core.ren, state.scale, state.scale);
        ...

setViewport directly calls SDL_RenderSetViewport with the global renderer.

On original SDL2, this code worked fine. The menu background got rendered with regular scale and then the overlay with a scaling animation. With sdl2-compat, it seems to apply the SDL_RenderSetScale call to everything rendered in that frame, instead of only the subsequent render calls.

Expected outcome (with original SDL2):

demo.mp4

What I get with sdl2-compat:

2025-03-23.16-08-47.mp4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions