Scaling questions

I couldn’t come up with a good title for this question.
Here’s the gist of it:
I’m making a game with SDL2. The pixel art is at a very low resolution (around 16 * 16 per asset) and I scale it to a larger screen (about 730 * 360) for visibility.
I used SDL_RenderSetLogicalSize to scale the whole screen, but the results aren’t satisfactory, here’s why:
I guess setting the logical size makes SDL scale the image, then render it to the screen. However, I want SDL to render to the screen, then scale the rendered texture, allowing me to do per-pixel rendering.


Any sane person would think: “Why would anyone ever want to create something as ugly as figure 2?”
The answer is simple. Fig. 3, while it may be more “Aesthetically pleasing” is not what I want. I believe the fact that it’s taking advantage of a higher resolution will already make a game look more modern and less authentic, and yes, the method of scaling I’m trying to achieve can create good results. For instance, look at some gameplay footage of celeste. I also want to be able to “tween” and transform images by their actual resolution, not by their scaled resolution.
Sorry for the rant, but I would really appreciate support. Thanks in advance.

1 Like

You could probably just create a 730 * 360 render target texture (pass SDL_TEXTUREACCESS_TARGET to SDL_CreateTexture) and render your game to that texture rather than the screen (see SDL_SetRenderTarget). When you finish the frame you could just render that render target texture to the screen.

3 Likes

Thanks! I created a screen sized texture, set it to the render target, changed the scale/rotation, rendercopied my image, reset the render target, set the scale to 320 * 180, rendercopied the target texture, and renderpresented and it gave the result I was looking for.

2 Likes