Is it possible to create split windows with separate controls in Cinder?

…window through the createWindows() creates only a clone of the first window

This isn’t true. Your application will call the ::draw function once per window, so if you’re not checking which is the current window, you’ll draw the same thing into each one. Once multiple windows are involved, my preference is to remove the overridden App::draw virtual method and use signals instead.

// Written inline so not guaranteed to compile
void YourApp::setup ( )
{
    auto mainWindow = getWindow();
    auto secondWindow = createWindow( ... );

    mainWindow->getSignalDraw().connect ( [=] { drawMainWindow(); } );
    secondWindow->getSignalDraw().connect ( [=] { drawSecondWindow(); } );  
}

void YourApp::drawMainWindow ( )
{
    // getWindow[X]() here refers to mainWindow from above;
    gl::setMatricesWindow ( getWindowSize() ); 
    gl::clear ( Colorf ( 1, 0, 0 ) );
}

void YourApp::drawSecondWindow ( )
{
    // getWindow[X]() here refers to secondWindow from above;
    gl::setMatricesWindow ( getWindowSize() ); 
    gl::clear ( Colorf ( 0, 1, 0 ) );
}

The same goes for mouse/keyboard/touch events as well, you just need to connect to the appropriate signals.

1 Like