| Summary: | SDL_RenderDrawLine: Non-axis-aligned lines are not scaled | ||
|---|---|---|---|
| Product: | SDL | Reporter: | graspee |
| Component: | render | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | graspee |
| Version: | 2.0.3 | ||
| Hardware: | x86 | ||
| OS: | Windows 7 | ||
If you draw the screen at 3x the logical screen size then the axis-aligned lines vary between 3 pixels thick (expected) and 2 pixels thick (bug), while the non-aligned lines are still 1 pixel (bug). I'm getting vague memories of this being somehow related to a bug in opengl though and it being mentioned somewhere before where someone said not to bother drawing lines in opengl because it had problems (this was outside of sdl I think). This bug is happening in directx mode. Despite using environmental variable and sdl hints I am unable to get my application to use opengl or software renderer to test them. This is a general limitation of the way logical size was implemented. We're considering moving to a render target implementation that would take care of this, but it's still under discussion. If this behavior is a problem for your application, the recommended solution is to render to a render target, and then copy the render target to the screen before the present. |
Create a scaled window, e.g. here I'm creating a logical window of 640x400 but then opening a physical window that is twice that size. ///////////////////////////////////////////////////////////// window = SDL_CreateWindow("name", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640*2, 400*2, 0); renderer = SDL_CreateRenderer(window, -1,0); SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest"); SDL_RenderSetLogicalSize(renderer, 640, 400); ///////////////////////////////////////////////////////////// Now, using SDL_RenderDrawLine to draw axis-aligned lines, (i.e. perfectly horizontal or vertical ones), the lines will be 2 pixels thick as expected. Drawing non-axis-aligned lines however, the lines will be only 1 pixel thick which is not the expected behaviour, and I would be so bold as to say is a bug.