Hello SFML community,
I've had an annoying bug in my program since I began it months ago. So, my program randomly "stutters", below is a video demonstrating what I mean:
http://streamable.com/9ajq63Here is my source code, that validates the issue:
#include <SFML/Graphics.hpp>
// This is for multi-graphics cards in a laptop, bug happens with or without this
#ifdef _WIN32
extern "C" {
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
__declspec(
dllexport) unsigned int AmdPowerXpressRequestHighPerformance = 0x1;
}
#endif
int main () {
sf::ContextSettings settings;
settings.antialiasingLevel = 0;
sf::RenderWindow renderWindow(
{ 2560, 1440 },
"FunTitleForForum",
sf::Style::Default,
settings
);
renderWindow.setVerticalSyncEnabled( true );
sf::Texture textureTEMP;
textureTEMP.loadFromFile("../Source/TextureManager/TileMap/atlas_48x.png" );
sf::Sprite spriteTEMP { textureTEMP };
sf::View gameView;
gameView.setSize( renderWindow.getDefaultView().getSize());
renderWindow.setView( gameView );
sf::Event event {};
while ( renderWindow.isOpen()) {
while ( renderWindow.pollEvent( event )) {
if ( event.type == sf::Event::Closed ) {
renderWindow.close();
}
}
if ( sf::Keyboard::isKeyPressed( sf::Keyboard::D )) {
gameView.move( 10, 0 );
} else if ( sf::Keyboard::isKeyPressed( sf::Keyboard::A )) {
gameView.move( -10, 0 );
}
renderWindow.clear();
renderWindow.setView( gameView );
renderWindow.draw( spriteTEMP );
renderWindow.display();
}
return 0;
}
Here is what I have tried (not in any order):
Set all textures to smooth
Implement timestep manually
Use kairos timestep library
Making sure compiler version and sfml version match
Rebuilding sfml
Statically linking sfml instead of dynamically linking
One note is that I have a 144hz screen output, and if you need any more additional info please let me know!