I'm having an issue using multiple windows with SFML. At the moment all of my graphics in the program are rendered with modern OpenGL, but I want to create a separate window that I use as sort of a console for my main window. Because of this my main window is a
sf::Window
and my addition window I create is a
sf::RenderWindow
The problem however is that when I attempt to display both windows, my main window no longer clears the background color to blue, and my renderwindow also does not draw a simple circle. I attempted messing around with
setActive()
but nothing seems to be working. Here's what I'm talking about:
What the program normally looks like
black background when console window drawn, circle also does not render to console window
What I'm doing:
console window declaration: (Exact same context settings, but this is a renderwindow as opposed to window
ConsoleWindow.create(sf::VideoMode(400,200),
"Console",
sf::Style::Default,
sf::ContextSettings(32, 8, 0, 3, 3)
);
console window render
ParentWindow->setActive(false);
ConsoleWindow.draw(circle);
ConsoleWindow.display();
ParentWindow->setActive(true);
Just before the main loop starts, I call
window.setActive(true)
During the main loop(very simplified form):
//handle events
//...
//call GL clear color to dark blue
//compute matricies
//enable vertex attrib arrays
//draw arrays instanced
//disable vertex attrib arrays
window.display(); //window to draw OpenGL to
console_window.render(); //calls console render code as seen above
Any ideas as to how I can get these two windows to render in harmony?