| Summary: | the viewport clips render coordinates rather than scaling them | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Adam M. <adam> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Windows 7 | ||
|
Description
Adam M.
2014-05-10 22:59:42 UTC
There's a possibility that it's related to using NULL for the rectangle vs. not. In fact, if I use a hollow rectangle it's also clipped, except when I pass NULL for the rectangle, in which case it's properly scaled to the viewport. I confirmed that this happens for points, lines, rectangles, and filled rectangles. None of those functions scale to the viewport (except the rectangle-based ones when NULL is passed for the rectangle). Is the viewport just completely broken? The SDL viewport doesn't work like a 3D viewport - it's just a view into the current framebuffer, and you can use the clip rectangle to clip within that. There is a separate scale that you can set to scale drawing into the viewport, and SDL_SetLogicalScale() uses these in combination to achieve what you're looking for. I agree this is confusing and I'm marking it for review with SDL 2.1. This isn't fresh in my mind anymore, but when you do the review you may want to consider the behavior when using NULL for the rectangle versus passing in a rectangle. I don't know if that's an inconsistency or whether the documentation just needs updating. I do wonder about the differences between the clip rect and the viewport if they do pretty much the same thing. Yep, definitely. I'm seriously considering removing all the viewport/logical scale craziness and always using a target texture for that case. |