4
\$\begingroup\$

I am using SDL2 and SDL2 Image to render png images.

When I rotate the textures, they turn out very ugly, like this:

enter image description here

This is the code responsible for the rotation and alpha mod.

SDL_Rect srcRect;
SDL_Rect destRect;
srcRect.x = width * currentFrame;
srcRect.y = height * currentRow;
srcRect.w = destRect.w = width;
srcRect.h = destRect.h = height;
destRect.x = x;
destRect.y = y;

SDL_SetTextureAlphaMod(m_textureMap[id], alpha);
SDL_RenderCopyEx(pRenderer, m_textureMap[id], &srcRect, &destRect, 10.0, 0, flip);

Do I need to set a blendmode too?

\$\endgroup\$
2
  • \$\begingroup\$ I don't think SDL2's simplistic graphics primitives support anti-aliasing. You might need to look into SDL2_gfx instead. Not sure if that's true, though. \$\endgroup\$ Commented Feb 1, 2015 at 11:19
  • \$\begingroup\$ That could be, I am using png images though, not primitives \$\endgroup\$
    – bottleboot
    Commented Feb 1, 2015 at 13:34

1 Answer 1

6
\$\begingroup\$

So it seems I was missing this in my Game class, which makes sense:

SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" );

https://wiki.libsdl.org/SDL_HINT_RENDER_SCALE_QUALITY

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .