SDL 2 IOS 8 Screen resolution problem

I ran the iOS keyboard demo (which uses SDL_Render) and I still can?t reproduce the issue ? do you have a minimal test case available?

Using raw OpenGL (ES) is preferable if you need the level of control it gives compared to the SDL_Render API, but if you don?t then SDL_Render should be fine.On Nov 12, 2014, at 6:29 PM, doctoreamer wrote:

I’m not using raw OpenGL, I’m rendering using SDL_Textures and functions like SDL_RenderCopy() instead. Multitasking is not an issue when I’m using official SDL, even though my code does nothing to handle events like SDL_APP_DIDENTERBACKGROUND. I realise that I probably should handle these events anyway, but thought it might be interesting to point out the difference in behaviour.

Is using raw OpenGL much preferable to the SDL rendering methods when building iOS applications?

Thanks alot for your responses!


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

I reproduced the issue with this code:

Code:

#include “SDL.h”
#include
#include “SDL_image.h”

int main(int argc, char* args[])
{
// Initiate SDL
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
std::cout << "SDL_Init ERROR: " << SDL_GetError() << std::endl;
}

// Create window
SDL_SetHint(SDL_HINT_ORIENTATIONS, "LandscapeLeft LandescapeRight");    
SDL_DisplayMode displayMode;
SDL_GetCurrentDisplayMode(0, &displayMode);
SDL_Window* window = NULL;
window = SDL_CreateWindow(NULL, 0, 0, displayMode.w, displayMode.h,
        SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
if (window == NULL)
{
    std::cout << "SDL_CreateWindow ERROR: " << SDL_GetError() << std::endl;
}

// Create renderer
SDL_Renderer* renderer = NULL;
renderer = SDL_CreateRenderer(window, -1, 0);
if (renderer == NULL)
{
    std::cout << "SDL_CreateRenderer ERROR: " << SDL_GetError() << std::endl;
}
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
SDL_RenderSetLogicalSize(renderer, 480, 320);

// Load texture
SDL_Texture* texture = NULL;
std::string filePath = "Textures/MenuSystem/MainMenuBackground.png";
SDL_Surface* surface = IMG_Load(filePath.c_str());
if (surface == NULL)
{
    std::cout << "ERROR IN: FileUtility::loadTexture() - IMG_Load ERROR: " << filePath.c_str() <<  " - " << IMG_GetError() << std::endl;
}
else
{
    texture = SDL_CreateTextureFromSurface(renderer, surface);
    if (texture == NULL)
    {
        std::cout << "ERROR IN: FileUtility::loadTexture() - SDL_CreateTextureFromSurface ERROR: " << filePath.c_str() << " - " << IMG_GetError() << std::endl;
    }
    SDL_FreeSurface(surface);
}

// Run loop
bool isRunning = true;
while (isRunning)
{
    SDL_Event event;
    while (SDL_PollEvent(&event))
    {
        if (event.type == SDL_QUIT)
        {
            isRunning = false;
        }
    }

    SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
    SDL_RenderClear(renderer);
    SDL_SetRenderDrawColor(renderer, 0xFF, 0, 0, 0xFF);
    SDL_RenderCopy(renderer, texture, NULL, NULL);
    SDL_RenderPresent(renderer);
}

// Destroy renderer
SDL_DestroyRenderer(renderer);

// Destroy window
SDL_DestroyWindow(window);

// Quit SDL
SDL_Quit();

return 0;

}

Alex Szpakowski wrote:> I ran the iOS keyboard demo (which uses SDL_Render) and I still can?t reproduce the issue ? do you have a minimal test case available?

Using raw OpenGL (ES) is preferable if you need the level of control it gives compared to the SDL_Render API, but if you don?t then SDL_Render should be fine.


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

Thanks for the test code! My latest commit to the iOS-improvements branch of my repository should fix the issue, I think.On Nov 18, 2014, at 4:14 PM, doctoreamer wrote:

I reproduced the issue with this code: […]


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

I tried running the program I posted here with your new commit. The issue now happens as soon as I run the app and not only when switching applications.

Alex Szpakowski wrote:> Thanks for the test code! My latest commit to the iOS-improvements branch of my repository should fix the issue, I think.


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

By the way, I’m doing my testing on a iPhone 4s.

By the way, I’m testing on a iPhone 4s device.

I can?t reproduce it with my branch with my latest commits. When using a simulated iPhone 4s / iOS 8.1, my test image (since I don?t have access to your images) always fills the whole screen, and when using a physical iPad 2 with iOS 8.1 it?s letterboxed to the 480/320 aspect ratio as expected and fills the whole screen aside from that.On Nov 21, 2014, at 7:27 PM, doctoreamer wrote:

I tried running the program I posted here with your new commit. The issue now happens as soon as I run the app and not only when switching applications.


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