[SDL] SDL_PollEvent() with an offscreen render target
andreas at falkenhahn.com
Tue Sep 9 09:27:23 PDT 2014
On 20.08.2014 at 07:10 Sam Lantinga wrote:
> Can you report it as a bug in bugzilla so it doesn't get lost in e-mail?
> On Mon, Aug 18, 2014 at 1:47 PM, Andreas Falkenhahn <andreas at falkenhahn.com> wrote:
> Thanks. Have you seen my other mail titled "Refresh trouble with SDL_WINDOWEVENT_EXPOSED"?
> This could also be a bug. And there's also a very short test case attached ;)
> On 17.08.2014 at 23:35 Sam Lantinga wrote:
>> This is fixed, thanks!
>> On Fri, Aug 15, 2014 at 6:39 AM, Andreas Falkenhahn <andreas at falkenhahn.com> wrote:
>> is SDL_PollEvent() only supposed to be used with the window being the current
>> render target?
>> I've noticed that in case an offscreen texture is the current render target
>> SDL_PollEvent() can do quite some strange things to the renderer. For example,
>> if the user resizes the window while an offscreen texture is the current
>> render target, the window's viewport dimensions will *not* be adapted automatically.
>> Instead, SDL probably adapts some parameters concerning the offscreen rendering
>> to the texture but IMHO it doesn't really make sense to take updated window
>> dimensions and apply them to the offscreen texture... they should be applied to
>> the window instead.
>> This behaviour can cause quite some confusion because in that case you'd have
>> to call SDL_RenderSetViewport() manually although this is normally done automatically
>> by the event handler on window resize.
>> I am attaching a small demo program which shows the issue. You can see that
>> the viewport coordinates aren't adapted correctly in case SDL_PollEvent() is
>> called while an offscreen texture is selected as the render target (SDL_RenderCopy
>> in line 101 is supposed to scale the offscreen texture to the window dimensions
>> but it doesn't do it because the viewport coordinates haven't been updated.)
>> If SDL_PollEvent() can't deal with render targets other than the window I
>> think this should be mentioned both in the docs of SDL_PollEvent() and SDL_SetRenderTarget().
>> Best regards,
>> Andreas Falkenhahn mailto:andreas at falkenhahn.com
>> SDL mailing list
>> SDL at lists.libsdl.org
> Best regards,
> Andreas Falkenhahn mailto:andreas at falkenhahn.com
> SDL mailing list
> SDL at lists.libsdl.org
Andreas Falkenhahn mailto:andreas at falkenhahn.com
More information about the SDL