# (Resolved) Dual screen rendering on the N3DS? (SDL3)

**URL:** <https://discourse.libsdl.org/t/resolved-dual-screen-rendering-on-the-n3ds-sdl3/55549>\
**Category:** Game Development\
**Created:** [November 15, 2024, 11:22pm UTC](https://discourse.libsdl.org/t/resolved-dual-screen-rendering-on-the-n3ds-sdl3/55549 "2024-11-15T23:22:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KylerEastridge](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/kylereastridge/32/5609_2.png) [@KylerEastridge](https://discourse.libsdl.org/u/KylerEastridge)\
**Post date:** [November 15, 2024, 11:22pm UTC](https://discourse.libsdl.org/t/resolved-dual-screen-rendering-on-the-n3ds-sdl3/55549/1 "2024-11-15T23:22:05Z")

</div>

Hello! I’ve been messing around with trying to get SDL3 to render on both the top and bottom screen, but I can’t find out how to get it to render on even just the bottom screen.  
Looking at the video driver, it looks like it is possible, and looks like I should just be able to create a top and bottom screen using

```auto
    mTopWindow = SDL_CreateWindow("Top Screen", GSP_SCREEN_HEIGHT_TOP, GSP_SCREEN_WIDTH, 0);
    mBottomWindow = SDL_CreateWindow("Bottom Screen", GSP_SCREEN_HEIGHT_BOTTOM, GSP_SCREEN_WIDTH, 0);

```

(Error checking and other fluff removed)  
However, no matter what I try, it doesn’t want to work. I’ve tried moving the window positions, taking them out of fullscreen, trying to set the displayID of the window, etc.

Does anyone know what I am doing wrong here, or how to properly create a top and bottom screen window, or if I should I even be making two windows for this?

Ideally, I’d like to render to both the left and right upper screen as well (Stereoscopic).

Thanks!

---

<div class="post-metadata">

**Author:** ![KylerEastridge](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/kylereastridge/32/5609_2.png) [@KylerEastridge](https://discourse.libsdl.org/u/KylerEastridge)\
**Post date:** [November 16, 2024, 8:49am UTC](https://discourse.libsdl.org/t/resolved-dual-screen-rendering-on-the-n3ds-sdl3/55549/2 "2024-11-16T08:49:08Z")

</div>

For anyone reading this looking for an answer, I solved the first part:  
The trick is to create the window _with_ properties, not setting properties after the fact. Here is example code:

```cpp
    int num_displays;
    SDL_DisplayID *displays = SDL_GetDisplays(&num_displays);

    for (int i = 0; i < num_displays; i++) {
        SDL_Rect rect;
        if (!SDL_GetDisplayBounds(displays[i], &rect))
            continue;

        const char *name = SDL_GetDisplayName(displays[i]);

        SDL_Window **targetWindow = nullptr;
        SDL_Renderer **targetRenderer = nullptr;

        if (strcmp(name, "N3DS top screen") == 0)
        {
            targetWindow = &mTopWindow;
            targetRenderer = &mTopRenderer;
        }
        else if (strcmp(name, "N3DS bottom screen") == 0)
        {
            targetWindow = &mBottomWindow;
            targetRenderer = &mBottomRenderer;
        }
        else
            continue;

        if (targetWindow && targetRenderer)
        {
            SDL_PropertiesID props = SDL_CreateProperties();
            if (!props)
                throw std::runtime_error("Failed to create screen properties: " + std::string(SDL_GetError()));

            // Set properties
            SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, name);
            SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, rect.x);
            SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, rect.y);
            SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, rect.w);
            SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, rect.h);
            SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN, true);

            *targetWindow = SDL_CreateWindowWithProperties(props);
            if (!*targetWindow)
                throw std::runtime_error("Failed to create window: " + std::string(SDL_GetError()));

            *targetRenderer = SDL_CreateRenderer(*targetWindow, nullptr);
            if (!*targetRenderer)
                throw std::runtime_error("Failed to create renderer: " + std::string(SDL_GetError()));
        }
    }

    SDL_free(displays);

```

Still haven’t figured out how to do stereoscopy yet. I’m not seeing anything in the code that says it is supported, I might have to make a patch and see if I can get that submitted.

---

<div class="post-metadata">

**Author:** ![KylerEastridge](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/kylereastridge/32/5609_2.png) [@KylerEastridge](https://discourse.libsdl.org/u/KylerEastridge)\
**Post date:** [November 16, 2024, 9:54pm UTC](https://discourse.libsdl.org/t/resolved-dual-screen-rendering-on-the-n3ds-sdl3/55549/3 "2024-11-16T21:54:51Z")

</div>

Apparently stereoscopy rendering isn’t part of the of the SDL codebase yet. I’ve added a PR here for anyone looking for that functionality: [(N3DS) Add support for 3D stereoscopy rendering by FelixWolf · Pull Request #11480 · libsdl-org/SDL · GitHub](https://github.com/libsdl-org/SDL/pull/11480)
