just in case if you need it, here is a short code that will reproduce the problem. I think it only occur if you are creating a 2nd window from another thread.
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
void ThreadFunction()
{
// Create the main window
sf::ContextSettings Settings;
Settings.DepthBits = 24; // Request a 24 bits depth buffer
Settings.StencilBits = 8; // Request a 8 bits stencil buffer
Settings.AntialiasingLevel = 0; // Request 2 levels of antialiasing
Settings.MajorVersion = 3;
Settings.MinorVersion = 3;
sf::Window App(sf::VideoMode(1024, 768, 32), "SFML OpenGL", sf::Style::Close, Settings);
Settings = App.GetSettings();
std::cout << "DepthBits " << Settings.DepthBits << "\n";
std::cout << "StencilBits " << Settings.StencilBits << "\n";
std::cout << "Antialiasing Level " << Settings.AntialiasingLevel << "\n";
std::cout << "Opengl Version " << Settings.MajorVersion << "." << Settings.MinorVersion << "\n";
// Set color and depth clear value
glClearDepth(1.f);
glClearColor(0.176f, 0.196f, 0.667f, 0.0f);
// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
// Escape key : exit
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
// Resize event : adjust viewport
if (Event.Type == sf::Event::Resized)
glViewport(0, 0, Event.Size.Width, Event.Size.Height);
}
// Set the active window before using OpenGL commands
// It's useless here because active window is always the same,
// but don't forget it if you use multiple windows or controls
//App.SetActive(true);
// Clear color and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Finally, display rendered frame on screen
App.Display();
//App.SetActive(false);
}
std::cin.get();
}
int main()
{
{
sf::ContextSettings Settings;
Settings.DepthBits = 24; // Request a 24 bits depth buffer
Settings.StencilBits = 8; // Request a 8 bits stencil buffer
Settings.AntialiasingLevel = 0; // Request 2 levels of antialiasing
Settings.MajorVersion = 3;
Settings.MinorVersion = 3;
sf::Window dummy_win(sf::VideoMode(0, 0, 32), "dummy window", sf::Style::Close, Settings);
dummy_win.Close();
}
sf::Thread thread(&ThreadFunction);
thread.Launch();
return EXIT_SUCCESS;
}