How can I send image to 2nd monitor when running in TTY!?
Hello!
I'm trying to find a way to launch my SDL program on a 2nd monitor/display when running with kmsdrm in TTY.
It's all fine when I'm using just one display but I now need to push the program to show up on the secondary screen, which in my case is a Oculus Rift CV1.
I can get it to show up there but only if I unplug my regular and primary monitor first. But of course that's not a good actual solution.
I am using
Raspberry Pi4b
Ubuntu 22.04 64bit
SDL 2.0.20
I have tried using display bounds and that works when on the Desktop but not with TTY.
SDL_Rect displayBounds[2];
for( int i = 0; i < nDisplays; i++ ) {
SDL_GetDisplayBounds( i, &displayBounds[i] );
}
int place_x = displayBounds[ 1 ].x + 100;
int place_y = displayBounds[ 1 ].y + 100;
printf("Bounds [0]: %d %d\n", displayBounds[0].x, displayBounds[0].y);
printf("Bounds [1]: %d %d\n", displayBounds[1].x, displayBounds[1].y);
sdl_window = SDL_CreateWindow(
"Chiaki", /// const char* title
place_x, ///SDL_WINDOWPOS_UNDEFINED, /// int x: initial x position
place_y, ///SDL_WINDOWPOS_UNDEFINED, /// int y: initial y position
screen_width, /// int w: width, in pixels
screen_height, /// int h: height, in pixels
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
);
Does anyone know if this is possible to do with SDL?
Cheers!
Does using SDL_SetHint(SDL_HINT_KMSDRM_DEVICE_INDEX, "1"); (or whatever is the correct index for your display) work for you?
You can grab the pre-release snapshot supporting this hint from: https://www.libsdl.org/tmp/SDL-2.0.zip