SFML community forums

Help => Window => Topic started by: HyperMario64 on January 26, 2012, 02:05:02 am

Title: Window Not Opening
Post by: HyperMario64 on January 26, 2012, 02:05:02 am
Hello, I'm not sure what's wrong with this code because no window is opening up for me. xD

I'm also trying to open this up as a GUI application in SFML 1.6 & Code Blocks 10.05 if that helps. :)

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

    sf::Image SceneImage;
    if (!SceneImage.LoadFromFile("Image.png"))
    {
        return EXIT_FAILURE;
    }

    sf::Sprite Scene(SceneImage);
    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if ((Event.Type == sf::Event::Closed) ||
               ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)))
            {
                App.Close();
                break;
            }
        }

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

        App.Draw(Scene);

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

    return EXIT_SUCCESS;
}
Title: Window Not Opening
Post by: RedIrony on January 26, 2012, 02:43:44 am
Does it return anything? Or just it just sit there?
Title: Window Not Opening
Post by: HyperMario64 on January 26, 2012, 03:32:16 am
It just sits there...>.<
Title: Window Not Opening
Post by: Tex Killer on January 26, 2012, 06:01:06 am
Do you use an ATI card?
Title: Window Not Opening
Post by: HyperMario64 on January 26, 2012, 06:10:38 am
Nope, AMD Radeon HD. :3
Title: Window Not Opening
Post by: Tex Killer on January 26, 2012, 06:26:21 am
AMD is a processor maker.

Radeon HD is an ATI video card.

SFML 1.6 have a problem with ATI cards, so I think you would have to change to SFML 2.0
Title: Window Not Opening
Post by: HyperMario64 on January 26, 2012, 06:46:54 am
Oh, thanks for the info. <3

I was using 1.6 instead of 2.0 because I was nervous about potential instability issues...x.x

But...can I do a simple upgrade or do I have to uninstall 1.6 then install 2.0?
Title: Window Not Opening
Post by: binary1248 on January 26, 2012, 10:12:30 am
Quote from: "Tex Killer"
AMD is a processor maker.

Radeon HD is an ATI video card.

SFML 1.6 have a problem with ATI cards, so I think you would have to change to SFML 2.0


I don't know in which alternate timeline you live but in this one ATI got acquired by AMD in 2007 (5 years ago) see: here (http://en.wikipedia.org/wiki/AMD_Graphics_Product_Group#Graphics_products). As such all ATI graphics products are now marketed under the AMD brand name. They are still however the same card and are probably designed and manufactured by the same people doing so by ATI. Saying AMD doesn't manufacture graphics products is like saying GM doesn't manufacture automobiles in Europe, which hopefully everyone here knows isn't true. And by the way, AMD produces way more things besides processors. The correct term for them would be chip manufacturer.

My two cents
Title: Window Not Opening
Post by: Tex Killer on January 26, 2012, 05:30:21 pm
Quote from: "binary1248"
Quote from: "Tex Killer"
AMD is a processor maker.

Radeon HD is an ATI video card.

SFML 1.6 have a problem with ATI cards, so I think you would have to change to SFML 2.0


I don't know in which alternate timeline you live but in this one ATI got acquired by AMD in 2007 (5 years ago) see: here (http://en.wikipedia.org/wiki/AMD_Graphics_Product_Group#Graphics_products). As such all ATI graphics products are now marketed under the AMD brand name. They are still however the same card and are probably designed and manufactured by the same people doing so by ATI. Saying AMD doesn't manufacture graphics products is like saying GM doesn't manufacture automobiles in Europe, which hopefully everyone here knows isn't true. And by the way, AMD produces way more things besides processors. The correct term for them would be chip manufacturer.

My two cents


Ok, thanks for clarifying, and sorry for the missinformation.

But regardless of that, his video board should still crash SFML 1.6.

HyperMario64, Laurent will change the naming convention for SFML 2.0 soon, meaning all public functions and variable member are goint to be renamed. If you want to, just finish this project on another computer that doesn't have an ATI/AMD video card, then start the next with SFML 2.0.

Maybe a virtual computer helps as well.
Title: Window Not Opening
Post by: ARandomFurry on January 30, 2012, 03:52:15 am
This ATI graphics issue is very well known, very common, and has absolutely no workaround that a moderate programmer can do. Why is this?

I've looked into compiling SFML statically but it fails, i've tried rebuilding SFML statically, but it still fails, I've tried using the workarounds explained elsewhere, which kinda works, but still fails. Note; the workaround fails more often than not when using sf::String.

Please is there a possible fix, or an easy way to link against SFML statically that actually works? Just adding -s after the -lsfml-XXX doesn't want to work.

There are probably around one-hundred (100) topics showing this same error, yet no one can answer their questions or provide a way to fix their problems.

This is all assuming SFML 1.6 as it says that's the 'current' version, Once SFML 2.0 is considered current most will use 1.6
Title: Window Not Opening
Post by: binary1248 on January 30, 2012, 04:36:24 am
Quote from: "Ignatus"
I've looked into compiling SFML statically but it fails, i've tried rebuilding SFML statically, but it still fails, I've tried using the workarounds explained elsewhere, which kinda works, but still fails.
...
Please is there a possible fix, or an easy way to link against SFML statically that actually works? Just adding -s after the -lsfml-XXX doesn't want to work.


Wow, dude... if you think all you need to do is add -s after the -lsfml-XXX without successfully building as a static library you have a lot to learn. I'd look into why it fails building in the first place before trying to use it somewhere else. Saying it fails and not describing how it fails isn't going to help much. Everybody can get SFML to compile statically no matter whether they are a beginner or an advanced programmer. They just need to spend enough time figuring out how to. Static linking is in fact even easier to achieve and use than dynamic linking.

Quote from: "Ignatus"

There are probably around one-hundred (100) topics showing this same error, yet no one can answer their questions or provide a way to fix their problems.


Then those 100 topic starters obviously don't know how to do a bit of research before asking the exact same question. The answer is on these forums, and no there is no way to prevent it, just to work around it. Static link or don't use the default font. There is no fix to it, not yet at least. It's that simple.

The ATI/AMD driver implementation on windows obviously displays "non-standard" behavior. Whether the crash is a result of programmer error/false assumptions on the side of SFML or really just a glitchy driver implementation, nobody knows. I put my money on the former. Wgl is known to be poorly documented, so I can't really blame Laurent. I do know however that there are many other open source games out there that use Wgl/OpenGL in almost exactly the same way as SFML and they don't crash on exit on ATI/AMD cards which further supports my previous statement.

Unless you can come up with a fix for this, I would recommend sticking to the workarounds and hope that Laurent fixes it sometime in the foreseeable future. And just so that you know, this issue is also present in SFML 2.0, so upgrading won't make it magically disappear.
Title: Window Not Opening
Post by: ARandomFurry on January 31, 2012, 03:57:16 pm
Yes i realize that just adding -s won't do it, but at least the tutorial should show me how, yet it doesn't. Also i blame the 100 topic starters for this problem (ATI graphics + SFML) but none of the replies that people give hold any relevance to a solution. Even Laurent (sp?) has been unable to provide a clear method to work around it, other than saying 'Statically Link It".

Sorry to the OP, but thus far you're just butting your head into a wall asking this question as no one can seem to answer it correctly and/or fully
Title: Window Not Opening
Post by: HyperMario64 on February 03, 2012, 06:27:13 am
That's fine. xD

I'll find another way for the time being.

Thanks for the help. ;3
Title: Window Not Opening
Post by: Laurent on February 03, 2012, 08:06:33 am
Quote
Even Laurent (sp?) has been unable to provide a clear method to work around it, other than saying 'Statically Link It".

Maybe I keep saying this because this is the easiest workaround? And I think it's clear enough, what do you want me to add?

So what's your problem with static linking (sorry I didn't read the full thread)?
Title: Window Not Opening
Post by: ZenonSeth on February 05, 2012, 04:08:02 pm
I ran into this problem a while ago, and one solution was to download an older version of atigktxx.dll, and put it in the same folder of the executable.
I recently updated my ATI graphics driver to the newest, and they seem to have fixed this, as my program runs without problems.

But, I just want to make sure I got this: SFML 2.0 does not have this window creation issue?
Title: Window Not Opening
Post by: MaZy on February 25, 2012, 10:10:40 pm
I have this problem, too. Long time before I did then my own build with cmake and vs2010. But still I have no window. Didn't understand. But I wanted again start to programming with a engine.. I haven't any other comparable engines for games (just something big for 3d games like unity3d, cryengine 3)

Is there any tutorial how I should and configure cmake for sfml 2?? Maybe I just did something wrong..

edit: It's ok.. had to just change one thing. Something liek SetText to SetTextA