Please bear with me, this is my first post.
I have been having issues with how slow my window polls events. My could main function is as follows:
#include <iostream>
2
3 #include <SFML/Graphics.hpp>
4
5
6 int main(){
7 sf::ContextSettings settings;
8 settings.depthBits = 24;
9 settings.stencilBits = 8;
10 settings.antialiasingLevel = 4;
11 settings.majorVersion = 4;
12 settings.minorVersion = 6;
13
14 sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!", sf::Style::Default, settings);
15 sf::CircleShape shape(100.f);
16 shape.setFillColor(sf::Color::Green);
17
18 std::cout<<"OpenGL version: "<<settings.majorVersion<<"."<<settings.minorVersion<<std::endl;
19
20 while(window.isOpen()){
21 ¦ sf::Event event;
22 ¦ while(window.pollEvent(event)){
23 ¦ ¦ switch(event.type){
24 ¦ ¦ ¦ case sf::Event::Closed:
25 ¦ ¦ ¦ ¦ window.close();
26 ¦ ¦ ¦ ¦ break;
27 ¦ ¦ ¦ case sf::Event::KeyPressed:
28 ¦ ¦ ¦ ¦ if(event.key.code==sf::Keyboard::Escape){
29 ¦ ¦ ¦ ¦ ¦ window.close();
30 ¦ ¦ ¦ ¦ ¦ std::cout<<"closing window: Esc pressed\n";
31 ¦ ¦ ¦ ¦ }
32 ¦ ¦ ¦ ¦ break;
33 ¦ ¦ ¦ default:
34 ¦ ¦ ¦ ¦ break;
35 ¦ ¦ }
36 ¦ ¦
37 ¦ }
38 ¦ window.clear();
39 ¦ window.draw(shape);
40 ¦ window.display();
41 }
42 return 0;
43 }
It seems to take a while to read the event type (usually I press the ```esc``` key just to close the window). When I comment out lines 39 and 40, the event is read rather quickly and closes the window. If they are commented out, it seems to take a rather large time (>10s) before it seems to recognize that the window should be closed.
I run on windows 10 using wsl2 from the Ubuntu 20.04 LTS environment. Is it possible the issue is related to WSL2?
In the terminal, I see the following output:
Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 4.6 ; depth bits = 24 ; stencil bits = 8 ; AA level = 4 ; core = false ; debug = false ; sRGB = false
Created: version = 0.0 ; depth bits = 24 ; stencil bits = 8 ; AA level = 0 ; core = false ; debug = false ; sRGB = false
Setting vertical sync not supported
sfml-graphics requires support for OpenGL 1.1 or greater
Ensure that hardware acceleration is enabled if available
OpenGL version: 4.6
I am not sure if it is related to the current problem or not but thought it might be helpful to include as well. I have an Intel(R) i7-6700HQ CPU and NVIDIA GeForce GTX 1060.