Scaling the renderer of the window

Hi,
a have a small question. Is it possible to set the area of the renderer
to the size of the window?
I have a window which is resizeable. When I change the size, the
rendering area is the same like before.

Best regards

This is what you need: http://wiki.libsdl.org/SDL_RenderSetViewport

This is something that might interest you:
http://wiki.libsdl.org/SDL_RenderSetLogicalSizeOn 2 March 2014 17:31, Daniel Knobe <daniel.knobe at googlemail.com> wrote:

Hi,
a have a small question. Is it possible to set the area of the renderer to
the size of the window?
I have a window which is resizeable. When I change the size, the rendering
area is the same like before.

Best regards


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I have some more informations. There seems to be an issue. There is an
inconsistent behaviour between linux and windows.
I did the following quick hack to check if this stuff works (yes, I know
thats really dirty :wink: ):

void Renderer::refresh()
{
SDL_SetRenderTarget(mRenderer, NULL);

 // We have a resizeable window
 // Resize renderer if needed
 // TODO: We should catch the resize event to make this stuff obsolet
 SDL_Rect renderRect;
 int windowX;
 int windowY;
 SDL_RenderGetViewport(mRenderer, &renderRect);
 SDL_GetWindowSize(mWindow, &windowX, &windowY);
 if (renderRect.w != windowX || renderRect.h != windowY)
 {
     renderRect.w = windowX;
     renderRect.h = windowY;
     SDL_RenderSetViewport(mRenderer, &renderRect);
 }

 SDL_RenderCopy(mRenderer, mRenderTarget, NULL, NULL);
 SDL_RenderPresent(mRenderer);
 SDL_SetRenderTarget(mRenderer, mRenderTarget);

}

mRenderTarget is a texture (with SDL_TEXTUREACCESS_TARGET) where I blit
the content in.
After that I scale it over the whole screen (or I try it^^). On Linux
this quick hack works great. Under windows it result to black borders
where I increase the size of the window.
GPU: Intel HD Graphics 3000
CPU: i3-2328M
Driver: 9.17.10.3062 (date: 8.3.13)> This is what you need:http://wiki.libsdl.org/SDL_RenderSetViewport

This is something that might interest you:
http://wiki.libsdl.org/SDL_RenderSetLogicalSize

On 2 March 2014 17:31, Daniel Knobe <daniel.knobe at googlemail.com http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org> wrote:

/ Hi,
/>/ a have a small question. Is it possible to set the area of the renderer to
/>/ the size of the window?
/>/ I have a window which is resizeable. When I change the size, the rendering
/>/ area is the same like before.
/>/
/>/ Best regards
/>/ _______________________________________________
/>/ SDL mailing list
/>/ SDL at lists.libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
/>/ http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
/>

There are also some error messages:
SDL_RenderCopy -> Reset(): INVALIDCALL
SDL_SetRenderTarget -> GetSurfaceLevel(): INVALIDCALLAm 04.03.2014 18:40, schrieb Daniel Knobe:

I have some more informations. There seems to be an issue. There is an
inconsistent behaviour between linux and windows.
I did the following quick hack to check if this stuff works (yes, I
know thats really dirty :wink: ):

void Renderer::refresh()
{
SDL_SetRenderTarget(mRenderer, NULL);

// We have a resizeable window
// Resize renderer if needed
// TODO: We should catch the resize event to make this stuff obsolet
SDL_Rect renderRect;
int windowX;
int windowY;
SDL_RenderGetViewport(mRenderer, &renderRect);
SDL_GetWindowSize(mWindow, &windowX, &windowY);
if (renderRect.w != windowX || renderRect.h != windowY)
{
    renderRect.w = windowX;
    renderRect.h = windowY;
    SDL_RenderSetViewport(mRenderer, &renderRect);
}

SDL_RenderCopy(mRenderer, mRenderTarget, NULL, NULL);
SDL_RenderPresent(mRenderer);
SDL_SetRenderTarget(mRenderer, mRenderTarget);

}

mRenderTarget is a texture (with SDL_TEXTUREACCESS_TARGET) where I
blit the content in.
After that I scale it over the whole screen (or I try it^^). On Linux
this quick hack works great. Under windows it result to black borders
where I increase the size of the window.
GPU: Intel HD Graphics 3000
CPU: i3-2328M
Driver: 9.17.10.3062 (date: 8.3.13)

This is what you need:http://wiki.libsdl.org/SDL_RenderSetViewport

This is something that might interest you:
http://wiki.libsdl.org/SDL_RenderSetLogicalSize

On 2 March 2014 17:31, Daniel Knobe <daniel.knobe at googlemail.com http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org> wrote:

/ Hi,
/>/ a have a small question. Is it possible to set the area of the renderer to
/>/ the size of the window?
/>/ I have a window which is resizeable. When I change the size, the rendering
/>/ area is the same like before.
/>/
/>/ Best regards
/>/ _______________________________________________
/>/ SDL mailing list
/>/ SDL at lists.libsdl.org http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
/>/ http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
/>


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org