Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - somehugenerd

Pages: [1]
Window / No Window :/
« on: August 09, 2010, 12:12:08 am »
Sorry to dredge up an old thread, but I just ran into a problem like this myself and figured I'd share the aftermath.  It didn't happen on any of my computers, but happened on a friends, so it took a while to figure out what was going on.

Seems like what happened was that I was setting the video mode manually to a mode which was not supported (for whatever reason) by my friend's computer, but was supported by mine.  Therefore when I tried to run it on mine, no problems, but on his the window didn't show up (even though the program was running properly according to the log output I was printing)

One quick way to see if that might be the problem you're having is to create the sf::RenderWindow with a default mode instead of manually setting the mode.  So like this:

Code: [Select]

sf::RenderWindow App(sf::VideoMode::GetMode(0), "SFML Graphics");

If that works, then for some stupid reason your computer doesn't want to handle 800x600x32 properly.   (1280x1024x32 was the mode I was trying to set on the friend's computer, so it boggled my mind that it didn't work properly)

In order to solve the problem, I logged a list of all the video modes supported on his computer, and just set it manually to one on the list.

Here's the code from the window tutorial that checks video modes:

Code: [Select]

unsigned int VideoModesCount = sf::VideoMode::GetModesCount();
for(unsigned int i = 0; i < VideoModesCount; ++i)
    sf::VideoMode Mode = sf::VideoMode::GetMode(i);

    // Mode is a valid video mode

Now, all the modes you get out of this should be valid, but if you are trying to set a mode manually, you'll want something more like this (also from window tutorial):

Code: [Select]

sf::VideoMode Mode(800, 600, 32);
    // Display an error, or try a different mode or something...

Hope that helps!

Pages: [1]