Brief pause in animation every ~1 second

Hi everyone. I’m having an issue where there is a (very) slight pause about once per second when doing animation. It’s almost as if it’s duplicating a frame once per second, or skipping an update()/draw() cycle. I’m not sure what’s happening. Has anyone seen this, or have any suggestions? I’m using Visual Studio and I tried building in both debug and release modes and got the same result either way. I have also tried with/without setting vertical sync, with/without a call to ofSetFrameRate(), and in both windowed and fullscreen modes, all with the same result. Right now I’m doing 3d animation, but I tried stripping my application down to just animating a single line (changing the coordinate of an endpoint over time), and the problem is still there. Any help or suggestions would be greatly appreciated.

I forgot to mention that in my laptop I have both an integrated video adapter and a dedicated NVIDIA GPU, and the “pausing” occurs no matter which adapter I run the application with.

without more information, it’s hard to say, however it might be something in a for loop, where actually it’s not pausing, it’s just that the first or the final part of the animation is duplicated.
How are you animating?

Here is the relevant code:

void ofApp::setup()
{
	ofHideCursor();
	ofSetVerticalSync(true);
	ofSetFrameRate(60);
	ofSetFullscreen(true);
	ofSetWindowShape(1920, 1080);
	light.enable();

	ofSetColor(255, 255, 255);
	ofSetLineWidth(3.0);

	direction = true;

	for (int i = 0; i < 4000; i++)
		randoms.push_back(ofPoint(ofRandom(-1000, 1000), ofRandom(-1000, 1000), ofRandom(-1000, 1000)));
}

//--------------------------------------------------------------
void ofApp::update()
{
	angle += 0.2;
	if (angle > 360)
		angle -= 360;
}

//--------------------------------------------------------------
void ofApp::draw()
{
	ofEnableDepthTest();
	ofBackground(0, 0, 0);

	ofPushMatrix();
	ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2);
	ofRotate(angle, 0, 1, 1);
	ofSetColor(255, 255, 255);
	ofFill();
	ofSetLineWidth(1.0);

	for (int i = 0; i != randoms.size() - 1; i++)
		ofSphere(randoms[i], 5.0);

	ofPopMatrix();
}

I should also mention I’m using Visual Studio Community 2015, not sure if that makes a difference. Most recently I tried targeting x86 instead of x64, with no difference in results. Again, simplifying this code to drawing a single line with a moving endpoint doesn’t help the issue. Thanks again.

I figured out the problem, it was f.lux. Killing f.lux completely solved the issue. Wanted to post in case someone else runs into the same thing.

2 Likes

f.lux as in the screen orangificator?