Slow FPS in Fullscreen / Scaling |
foundtimegames
|
Hello folks. I'm having some trouble...
My 2D game is hard-coded at 960x540. The fullscreen resolution is 1366x768, and I'm using SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear") and SDL_RenderSetLogicalSize(renderer, 960,540) to do the scaling. In windowed mode, I get 60+ FPS. When scaling for fullscreen, I get ~20FPS. I suspect that SDL is scaling all of the textures every frame while in fullscreen, which would explain the FPS decrease. I read here that Ryan Gordon had a similar problem with Postal 1. He fixed it by using OpenGL, drawing all of the non-scaled images to a memory buffer, and then scaling that buffer. I don't think I can use OpenGL without overhauling all of my draw functions. Also, I tried using the opengl renderer driver in SDL, but I get the "No hardware accelerated renderers available" error, and it causes SDL_GetWindowSurface() and SDL_CreateTextureFromSurface() to fail and/or cause segmentation faults. Is it possible to fix my problem by using a similar approach to Ryan's, but strictly with SDL2 and a software renderer? Maybe by drawing everything to a single texture, and then scaling up that single texture? Thank you in advance! |
|||||||||||
|
Follow-up |