Fullscreen combined with ofSetBackgroundAuto(false) results in crashes

#1

Hi!

As the title says, I’m trying to get fullscreen working with ofSetBackgroundAuto(false) but the program just crashes everytime.

The code is exactly the same as in this example from the ofBook.
When I turn on fullscreen using one of these methods:

  • ofSetupOpenGL(1024, 768, OF_FULLSCREEN); in main()
  • ofSetFullscreen(true); in ofApp::setup()
void ofApp::setup()
{
	// ofApp
	ofSetFullscreen(true);
	ofSetBackgroundAuto(false);
	ofEnableAlphaBlending(); //<-- Alpha blending is not causing the error, I checked it

	// ...
}
  • or by setting it during runtime
void ofApp::keyPressed(int key)
{
	switch (key)
	{
	case 'f':
		ofToggleFullscreen();
		break;
	}
}

the program crashes immediately and I have to press Escape to exit it not to crash the whole computer.

When I don’t use either fullscreen or ofSetBackgroundAuto(false) everything works as it’s supposed to (but without either alpha or fullscreen, of course). You can see how the program looks before going fullscreen in the second link (ofBook example) and this is how the crash looks (couldn’t make a screenshot):


Yup, nothing interesting.

I even tried calling ofSetBackgroundAuto(false) during runtime (with fullscreen already on)

void ofApp::keyPressed(int key)
{
	switch (key)
	{
	case 'f':
		ofToggleFullscreen();
		break;
	case 'b':
		ofSetBackgroundAuto(false); // <-- Here
		break;
	}
}

but it crashed as well.

I’m working on Windows 10 in Visual Studio 2019, openFrameworks 0.10.1.



I think that’s everything I know ¯\_(ツ)_/¯

#2

Hmm. I don’t know. It doesn’t seem to crash mine, running Windows 7.

I do notice that calling ofSetBackgroundAuto(false); seems to massively increase my game’s rate of calling Update() for some reason, instead of the usual steady 60 Hz.

I call ofSetupOpenGL(900, 600, OF_FULLSCREEN); as the first thing I do in main() in main.cpp. If I don’t do that, my program exits before it does anything.

1 Like
#3

Hm, maybe I’ll try running it on a different machine (but with Windows 10 too, unfortunately).

I hope someone else will try as well :S

#4

I tried using the same sample program you referenced, and adding the two lines you mentioned:

ofSetupOpenGL(1024, 768, OF_FULLSCREEN); in main()
ofSetFullscreen(true); in ofApp::setup()

And it runs no problem on my computer.

#5

Including ofSetBackgroundAuto(false)? This is how my code looks:

void ofApp::setup()
{
	// ofApp
	ofSetFullscreen(true);
	ofSetBackgroundAuto(false);
	ofEnableAlphaBlending();

	// Initializing stuff
}

The rest is the same as on GitHub. And main() doesn’t matter (you can use either ofSetupOpenGL(1024, 768, OF_WINDOW) or ofSetupOpenGL(1024, 768, OF_FULLSCREEN)).

#6

Ok, I set my example project’s code to your post right above, and it seemed to make no difference. It still runs fine on my Win 7 computer.

1 Like
#7

OK, so just to make sure (because I’m not sure if I explained everything correctly), it runs on fullscreen and when you move your mouse cursor to the left everything gets blurry, right?

#8

I got it! It turns out that it really is just a problem with my PC.

In the past I had a problem with two games and some program not running correctly because they were running using integrated graphics card, not Nvidia. I don’t know why, some games/programs use Nvidia by default, some don’t.
So now I just have to figure out how to make all programs/games use Nvidia by default.

Thanks for all the help and testing!

Edit: OK, setting “preferred graphics procesor” to “high-performance NVIDIA processor” in NVIDIA Control Panel does the trick (why couldn’t I think of it earlier…):

1 Like