Hi,
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_Falkenhahn
-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.c
Type: application/octet-stream
Size: 3067 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20140815/f6a00ea9/attachment.obj