SFML community forums

Help => Window => Topic started by: nowindow123 on January 29, 2010, 12:50:49 pm

Title: No Window :/
Post by: nowindow123 on January 29, 2010, 12:50:49 pm
Hello,
i can't see the Game Window, only in the Taskbar it's showed that it's created on Ubuntu.
I'm using GCC and Code::Blocks.
This is the Code:
Code: [Select]
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


Thank you for your help.
Title: No Window :/
Post by: Laurent on January 29, 2010, 12:52:29 pm
Which version of SFML are you using? Do you have any error message in the console?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 01:18:47 pm
Yes, there's one Warning in the Console: "warning: GDB: Failed to set controlling terminal: Operation not permitted" and i'm using SFML 1.5

Thanks for your reply
Title: No Window :/
Post by: Laurent on January 29, 2010, 01:22:19 pm
This one is related to the debugger. What if you don't run your program in debug mode?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 01:34:45 pm
In Release Mode there's no Error and no Window :/
Title: No Window :/
Post by: Laurent on January 29, 2010, 01:45:12 pm
What about the precompiled samples from the SFML SDK? Did you try to run them?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 01:55:50 pm
They don't work(same  error, no window), except the wxwidgets and the qt example.
Title: No Window :/
Post by: Laurent on January 29, 2010, 02:16:22 pm
What is your OS / graphics card? Are your graphics drivers up-to-date?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 02:19:18 pm
Operating System is Ubuntu 9.10 (Karmic Koala).


Edit: I just updated the Graphics-Driver ;)
Edit 2: I've got an NVIDIA Gefore 7600 GT
Title: No Window :/
Post by: Laurent on January 29, 2010, 02:30:21 pm
Did the driver update change anything?

Have you tried to run glxgears?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 02:40:10 pm
The driver update did not change anything, glxgears works without problems.

I made a picture of the problem: (http://img718.imageshack.us/img718/1622/testx.png) The Program is active and in the Taskbar( also in the right corner on the screen panel ) but there's no window ;)
Title: No Window :/
Post by: Laurent on January 29, 2010, 02:45:17 pm
Do you use Compiz, or any other OpenGL-based window manager?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 03:02:11 pm
I used Compiz and just tried it without Compiz(deinstalling), now it looks like this (http://img682.imageshack.us/img682/7429/test2mx.png)
Edit: I don't know about any other Window-Manager ;)
Title: No Window :/
Post by: Laurent on January 29, 2010, 03:32:41 pm
Did you restart your computer after deinstalling Compiz? :D
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 03:39:08 pm
Yes :/
Title: No Window :/
Post by: Laurent on January 29, 2010, 03:45:22 pm
What about the SDK samples without Compiz?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 03:50:46 pm
Don't work, too (Same Problem) ;)
Title: No Window :/
Post by: Laurent on January 29, 2010, 04:05:48 pm
Is it the 32 or 64-bits version of the OS?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 04:12:32 pm
32 bits  =)
Title: No Window :/
Post by: Laurent on January 29, 2010, 04:18:13 pm
And you installed the 32-bits version of SFML, right?
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 04:19:44 pm
Yes ;)
Title: No Window :/
Post by: Laurent on January 29, 2010, 04:24:16 pm
No more idea in stock, sorry :D
Title: No Window :/
Post by: nowindow123 on January 29, 2010, 04:24:56 pm
Okay, i will look what i can do ;)
Thanks, anyway
Title: Similar problem
Post by: hermitC on March 03, 2010, 02:12:41 am
I'm using SFML since a halft year now, everything worked fine so far.

Yesterday I continued working on my game project. It has DLL and LIB configurations as well as debug and release configs (speak 4 different configurations). The last time (some weeks ago) I ran it everything worked. Now it does no longer show the graphical window. The console window pops up and the program freezes without showing the graphical window.

A quick assembler code step through showed that the code does not even enter the main function body. It loops endless somewhere in ntdll.dll - no debugging possible here.

This is true for all configurations linking to DLLs (release and debug). Configurations with static linking work. After some tests I found out that linking to sfml-window[-d].dll lets the program freeze. Running a program linked only to the System DLL works correctly.

Does anybody have the same problem? Sounds like a driver problem. I've updated my GC drivers (NVIDIA GeForce Go 7300) shortly, that did not solve the problem. Google does not have an answer either.
Title: No Window :/
Post by: hermitC on March 03, 2010, 02:57:25 am
Forget it. Switched to SFML 1.5 and recompiled everything - now it works.

Switching could not be easier. Great lib!
Title: No Window :/
Post by: somehugenerd 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);
if(!Mode.IsValid())
{
    // Display an error, or try a different mode or something...
}


Hope that helps!