Render clipping rectangle issue |
Christopho
|
Hi,
I have the same issue. In fullscreen desktop, using render clipping rectangle causes misaligned pixels. I have a desktop resolution of 1366x768. My game draws on a renderer of 320x240. Therefore, in fullscreen desktop, the rendering is scaled to 1024x768, with a factor of 3.2. There are two black columns of 171 pixels each on the left and the right of the screen. Everything is okay so far. The problem is that I cannot use SDL_RenderSetClipRect(). SDL_RenderSetClipRect() uses unscaled coordinates while being relative to the window. So okay, to end up at the position of my renderer, I have to add (171 / 3.2) pixels. With unscaled coordinates, this is not an integer number: 53.4375. SDL_RenderGetViewport() gives integer numbers: 53. I don't how to make it right. The result is that when I use SDL_RenderSetClipRect(), in fullscreen desktop mode, whatever I draw on the renderer is slightly shifted to the left, of less than one pixel. |
|||||||||||
|