SDL 2.0 with multi screen and openGL

Hi All,
hope you can help me out with a few issues I’m having while trying to learn SDL 2.0. Right now I’m running openGL on dual monitors ( using Linux and GLX ). One screen is high frame rate, the second low frame rate ( mostly instrument readings). So in GLX I set up 2 displays and all works fine. I want to migrate to using SDL 2.0 but can’t find answers to 2 questions either in the API or using google ( I’m sure I’m searching wrong !) So

  1. In GLX I can set each screen to draw to screen 0 or 1 ( or any screen ), I can’t seem to find this parameter? I can see a way of offsetting windows, so if running my screen in (dualview ect ) I can offset window 2 by x. But I’m running screens separately and can’t seem to find a way to just say draw to display 0 or 1? Can someone tell me how I set a parameter to say what screen to draw to?
  2. In GLX I need to set a context using glXMakeCurrent, when I load in a model I set this to display 0, however vertex data ect is shared between display heads but textures aren’t. So I need to load in a model to screen 0, then reload just the textures to screen 1 if I want to share a model between heads. I’ve been doing some background reading on graphics API’s and Ogre3d seems to say that textures ect are shared. Is this also the case with SDL 2? Or do I need to load in textures separately?

Thanks for the help.

2013/4/10 tony67

**
Hi All,
hope you can help me out with a few issues I’m having while trying to
learn SDL 2.0. Right now I’m running openGL on dual monitors ( using Linux
and GLX ). One screen is high frame rate, the second low frame rate (
mostly instrument readings). So in GLX I set up 2 displays and all works
fine. I want to migrate to using SDL 2.0 but can’t find answers to 2
questions either in the API or using google ( I’m sure I’m searching wrong
!) So

  1. In GLX I can set each screen to draw to screen 0 or 1 ( or any screen
    ), I can’t seem to find this parameter? I can see a way of offsetting
    windows, so if running my screen in (dualview ect ) I can offset window 2
    by x. But I’m running screens separately and can’t seem to find a way to
    just say draw to display 0 or 1? Can someone tell me how I set a parameter
    to say what screen to draw to?

How many video devices do you get with
http://wiki.libsdl.org/moin.fcg/SDL_GetNumVideoDisplays ?

  1. In GLX I need to set a context using glXMakeCurrent, when I load in a
    model I set this to display 0, however vertex data ect is shared between
    display heads but textures aren’t. So I need to load in a model to screen
    0, then reload just the textures to screen 1 if I want to share a model
    between heads. I’ve been doing some background reading on graphics API’s
    and Ogre3d seems to say that textures ect are shared. Is this also the case
    with SDL 2? Or do I need to load in textures separately?

Thanks for the help.

If you manage your textures using OpenGL, SDL has nothing to do with it.
This S.O. question hints that sharing texture between contexts is possible,
but enabling that functionality is platform dependent:


Gabriel.

Hi Tony,

I recently was involved in a project that I needed to use a dual monitor
setup with SDL and OpenGL.

I wrote my own C++ framework, which roughly corresponds to the SDL C
interface, and to open two fullscreen windows, I did the following:

int displays = sdl->NumVideoDisplays(); std::cout <<
“Cineclick/SDL Application” << std::endl; std::cout <<
"Number of displays: " << displays << std::endl;
SDL_Rect bounds[2]; for(int d=0; d < displays; d++)
{ if ( d >= 2 ) break;
sdl->DisplayBounds( d, &bounds[d] );
std::cout << “Display” << d << “: (” << bounds[d].x << ‘,’ <<
bounds[d].y << "), " << bounds[d].w << “x” << bounds[d].h <<
std::endl; } game = sdl->CreateWindow(
“Cineclick”, bounds[0].x, bounds[0].y, bounds[0].w, bounds[0].h,
SDL_WINDOW_FULLSCREEN ); main = sdl->CreateWindow(
“Cineclick”, bounds[1].x, bounds[1].y, bounds[1].w, bounds[1].h,
SDL_WINDOW_FULLSCREEN ); main->Grab( true );

On windows, I found that I could not set both as SDL_WINDOW_FULLSCREEN, but
it worked fine in Ubuntu at least.

For the second part of your question, Gabriel gave a good explanation and
link - give those a read :)On Wed, Apr 10, 2013 at 5:25 AM, tony67 wrote:

**
Hi All,
hope you can help me out with a few issues I’m having while trying to
learn SDL 2.0. Right now I’m running openGL on dual monitors ( using Linux
and GLX ). One screen is high frame rate, the second low frame rate (
mostly instrument readings). So in GLX I set up 2 displays and all works
fine. I want to migrate to using SDL 2.0 but can’t find answers to 2
questions either in the API or using google ( I’m sure I’m searching wrong
!) So

  1. In GLX I can set each screen to draw to screen 0 or 1 ( or any screen
    ), I can’t seem to find this parameter? I can see a way of offsetting
    windows, so if running my screen in (dualview ect ) I can offset window 2
    by x. But I’m running screens separately and can’t seem to find a way to
    just say draw to display 0 or 1? Can someone tell me how I set a parameter
    to say what screen to draw to?
  2. In GLX I need to set a context using glXMakeCurrent, when I load in a
    model I set this to display 0, however vertex data ect is shared between
    display heads but textures aren’t. So I need to load in a model to screen
    0, then reload just the textures to screen 1 if I want to share a model
    between heads. I’ve been doing some background reading on graphics API’s
    and Ogre3d seems to say that textures ect are shared. Is this also the case
    with SDL 2? Or do I need to load in textures separately?

Thanks for the help.


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

However, you should completely ignore anything that says Cineclick.On Wed, Apr 10, 2013 at 2:22 PM, Alex Barry <@Alex_Barry> wrote:

Hi Tony,

I recently was involved in a project that I needed to use a dual monitor
setup with SDL and OpenGL.

I wrote my own C++ framework, which roughly corresponds to the SDL C
interface, and to open two fullscreen windows, I did the following:

int displays = sdl->NumVideoDisplays(); std::cout << “Cineclick/SDL Application” << std::endl; std::cout << "Number of displays: " << displays << std::endl; SDL_Rect bounds[2]; for(int d=0; d < displays; d++) { if ( d >= 2 ) break; sdl->DisplayBounds( d, &bounds[d] ); std::cout << “Display” << d << “: (” << bounds[d].x << ‘,’ << bounds[d].y << "), " << bounds[d].w << “x” << bounds[d].h << std::endl; } game = sdl->CreateWindow( “Cineclick”, bounds[0].x, bounds[0].y, bounds[0].w, bounds[0].h, SDL_WINDOW_FULLSCREEN ); main = sdl->CreateWindow( “Cineclick”, bounds[1].x, bounds[1].y, bounds[1].w, bounds[1].h, SDL_WINDOW_FULLSCREEN ); main->Grab( true );

On windows, I found that I could not set both as SDL_WINDOW_FULLSCREEN,
but it worked fine in Ubuntu at least.

For the second part of your question, Gabriel gave a good explanation and
link - give those a read :slight_smile:

On Wed, Apr 10, 2013 at 5:25 AM, tony67 wrote:

**
Hi All,
hope you can help me out with a few issues I’m having while trying to
learn SDL 2.0. Right now I’m running openGL on dual monitors ( using Linux
and GLX ). One screen is high frame rate, the second low frame rate (
mostly instrument readings). So in GLX I set up 2 displays and all works
fine. I want to migrate to using SDL 2.0 but can’t find answers to 2
questions either in the API or using google ( I’m sure I’m searching wrong
!) So

  1. In GLX I can set each screen to draw to screen 0 or 1 ( or any screen
    ), I can’t seem to find this parameter? I can see a way of offsetting
    windows, so if running my screen in (dualview ect ) I can offset window 2
    by x. But I’m running screens separately and can’t seem to find a way to
    just say draw to display 0 or 1? Can someone tell me how I set a parameter
    to say what screen to draw to?
  2. In GLX I need to set a context using glXMakeCurrent, when I load in a
    model I set this to display 0, however vertex data ect is shared between
    display heads but textures aren’t. So I need to load in a model to screen
    0, then reload just the textures to screen 1 if I want to share a model
    between heads. I’ve been doing some background reading on graphics API’s
    and Ogre3d seems to say that textures ect are shared. Is this also the case
    with SDL 2? Or do I need to load in textures separately?

Thanks for the help.


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

Hi Thank you both.
I though that’s how I might have to set up ( using offsett ) but though I better find out from people with experience. I also suspected the same with textures, but the link and tips from it might save me some issues. I’ll see if I can get the texture share working with linux
Thanks