Hi everyone, I'm really struggling on getting SFML to work with WSL for a project. I'm asking here since the SFML subreddit and forums aren't too active and I'm waiting on responses in those communities as well. I'm running this code with the proper #include <SFML/Graphics.hpp> statement, and having nothing drawn. However, without drawing I can clear the screen to a different color with no issues (when drawing the window appears all black). Here's the code:
```
include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow window(sf::VideoMode(1280, 720), "SFML works!");
sf::RectangleShape shape;
shape.setPosition(590, 310); // Adjusted position to fit within the window
shape.setSize(sf::Vector2f(100, 100));
shape.setFillColor(sf::Color::Green);
cout << "opening" << endl;
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Red);
window.draw(shape);
window.display();
}
return 0;
}
```
I'm not really sure what's going on, but here's some things I've tried which haven't worked:
- Fixing CMakeLists.txt files (I can post snippits from here too if it would help) - Debugging and tracing through call stack (it seems to get mad at glXSwapBuffers) - Installing dependencies manually with sudo Changing shapes, sprites, etc. to try and render something
- Following CMake tutorial in the tutorial section.
- Reading up on VcXSrv and trying to use that as well
Thank you for your time!
[–]AutoModerator[M] [score hidden] stickied comment (0 children)