SFML community forums

Help => General => Topic started by: Wurstinator on February 06, 2011, 12:51:09 am

Title: SFML does not show windows on x64
Post by: Wurstinator on February 06, 2011, 12:51:09 am
Hi,
I started using Windows 7 64 bit some weeks ago and since then SFML projects won't work. Not only my own projects but also those which I downloaded.
The console windows shows up but after that nothing happens anymore.
Title: SFML does not show windows on x64
Post by: Laurent on February 06, 2011, 01:35:29 am
It's a known bug, it's happening with recent ATI drivers.
Title: SFML does not show windows on x64
Post by: Wurstinator on February 06, 2011, 06:28:28 pm
And what drivers do I have to install?
Title: SFML does not show windows on x64
Post by: Laurent on February 06, 2011, 06:28:52 pm
It should work with Catalyst <= 10.8.
Title: SFML does not show windows on x64
Post by: Contadotempo on February 06, 2011, 08:25:11 pm
That's odd, it works fine here with Catalyst 11.1.
Could the problem be related to the graphics card model? I have an HD4870
Title: SFML does not show windows on x64
Post by: Laurent on February 06, 2011, 08:38:01 pm
I don't know, maybe.
Title: SFML does not show windows on x64
Post by: excrulon on February 06, 2011, 10:12:30 pm
I'm having the same problem after compiling sfml 2.0 on x64. Was thinking it was something I did wrong related to compiling/linking or maybe I didn't have the right x64 extlibs.

I also have a radeon hd 4870. Just tried installing the latest catalyst version and it didn't fix it.

Agh so desperate to start making something with sfml but I keep running into problems getting it setup. :(
Title: SFML does not show windows on x64
Post by: Laurent on February 06, 2011, 10:38:26 pm
Quote
Just tried installing the latest catalyst version and it didn't fix it.

No, you must install an older version.
Title: SFML does not show windows on x64
Post by: excrulon on February 06, 2011, 11:50:09 pm
Uninstalled old catalyst stuff and installed 10.8 and it fixed it! Thank you so much! Been tearing my hair out over this for a while now. Finally get to get going on this!

So does this mean if I distribute software I make with sfml2, people won't be able to run it unless they're using catalyst <= 10.8? Or is this an issue with debug only?
Title: SFML does not show windows on x64
Post by: Laurent on February 07, 2011, 07:28:35 am
Quote
So does this mean if I distribute software I make with sfml2, people won't be able to run it unless they're using catalyst <= 10.8?

Yes. But don't worry, this will be fixed before the first public release of SFML 2.
Title: SFML does not show windows on x64
Post by: Spodi on February 07, 2011, 03:43:15 pm
From what I have heard from others, this only happens with dynamic linking. If you use static linking, it should run fine.
Title: SFML does not show windows on x64
Post by: Wurstinator on February 10, 2011, 11:18:57 pm
Are you also planning to release that fix for SFML 1.6?
Title: SFML does not show windows on x64
Post by: Laurent on February 11, 2011, 08:02:59 am
No, I'm not planning to release anything for SFML 1.6. I know that I should, but I prefer to focus my free time on SFML 2.
Title: SFML does not show windows on x64
Post by: computerquip on February 19, 2011, 10:07:07 am
I just downloaded and compiled the SFML 2 libs and it's to no avail however I don't see this as an issue on the roadmap? Either way, I'm SOL until further ado. One down for shitty ATI drivers.
Title: SFML does not show windows on x64
Post by: Laurent on February 19, 2011, 10:12:07 am
Quote
I just downloaded and compiled the SFML 2 libs and it's to no avail

Yes, it's not fixed yet.

Quote
however I don't see this as an issue on the roadmap?

The roadmap is not completely up-to-date, I'm not using it at 100% right now. This will change after SFML 2.0 is released.
Title: SFML does not show windows on x64
Post by: Wurstinator on March 08, 2011, 01:11:02 am
Hi,
it seems like my computer doesn't want me to uninstall Catalyst so I'll have to wait for your fix :)

Any plans already when it's going to be released? I wanted to continue my project next month, so, just asking.
Title: SFML does not show windows on x64
Post by: Laurent on March 08, 2011, 07:29:25 am
Quote
Any plans already when it's going to be released?

No, sorry.
Title: SFML does not show windows on x64
Post by: devlin on March 08, 2011, 08:14:26 am
Quote from: "Wurstinator"
I wanted to continue my project next month, so, just asking.

Have you tried to use static libs rather than shared (DLLs)?
Title: SFML does not show windows on x64
Post by: Wurstinator on March 08, 2011, 12:50:51 pm
@ devlin: No, since I didn't have time to work on my project in the last time.
To be honest, I don't even know how to use static libraries.

/edit:
It seems that someone has found a workaround: http://mars-game.sourceforge.net/?p=768#more-768
Title: SFML does not show windows on x64
Post by: PhoeniXYZ on March 29, 2011, 12:58:37 am
Being new to SFML I encountered this bug directly in the first example (create a RenderWindow), only an empty console window.
But I can confirm that the window appears when using the static libraries (HD4870 with Catalyst 11.2 on Win7 x64) so that might be a workaround.
Title: SFML does not show windows on x64
Post by: scorcher24 on March 29, 2011, 02:51:07 am
I have this issue too.
I also get these linker errors with the latest build from glew.
But I have set my own lib of glew as input in cmake, since my project is a .dll and relies on a fix I made inside glew. Since there is no preprocessor switch I know whch tells glew that it is used as .dll I am wondering what can cause this. Any Idea?

I also got the ATI Bug, but well, I will wait for a fix.
I really would like to integrate sfml into my (large) project and get rid of sdl since sfml has more to offer.

Unfortunately, I rely on SFML2 since I need to use an OpenGL 3.x core profile.

edit:
I reverted my Drivers to 11.1. It went slightly better, the Application actually entered my code. Before, it hung when loading the ati-dlls. But now window was shown either.
I made the window to be shown after calling sf::RenderWindow::SetFramelimit(100).

Here is the code:
Code: [Select]

    sf::ContextSettings context;
    context.AntialiasingLevel = m_settings.getFsaa();
    context.DepthBits         = m_settings.getDepth();
    context.MajorVersion      = 3;
    context.MinorVersion      = 3;
    context.StencilBits       = 24;

    m_window.Create(sf::VideoMode(static_cast<unsigned int>(m_settings.width), static_cast<unsigned int>(m_settings.height),
                    m_settings.getDepth()), m_settings.caption, flags, context);
    m_window.EnableVerticalSync(m_settings.vsync);
    m_window.Show(true);
    m_window.SetFramerateLimit(m_fps_limit);

Vertical Sync was false in this case. When Vertical Sync is true, it does also show without SetFrameLimit.
Hope this helps you debugging your code.

Next Problem:
My renderer is telling me this:
Quote

[NLWindowGL] OpenGL Vendor String: ATI Technologies Inc.
[NLWindowGL] OpenGL Version: 3.3.10428 Compatibility Profile Context
[NLWindowGL] OpenGL Renderer: ATI Radeon HD 4800 Series

Any chance to get a Core Profile?
I won't use any sfml function to render sprites or so, I have my own classes  in place.
Title: SFML does not show windows on x64
Post by: Laurent on March 29, 2011, 07:45:57 am
Quote
Any chance to get a Core Profile?

Not yet.
Title: SFML does not show windows on x64
Post by: scorcher24 on March 29, 2011, 01:55:54 pm
I have changed your code to get a core profile instead of compability :twisted:  8).

Now I only need to resolve the crash when I exit my client app.
Any idea what causes this?
When I exit my App, I end up crashing here:

Code: [Select]

> msvcr90d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x0315dd29)  Line 2103 C++


It happens when sf::RenderWindow is destroyed. I found that fix with TerminateProcess, but does not help in my case since sfml runs in a .dll.
Title: SFML does not show windows on x64
Post by: Laurent on March 29, 2011, 02:00:06 pm
Can you show a complete code that reproduces this problem?
Title: SFML does not show windows on x64
Post by: scorcher24 on March 29, 2011, 02:09:57 pm
Uhm, sure, while there is nothing too fancy about it:

Code: [Select]

class NLWindowGL
{
   __declspec(dllexport) bool create(/*...*/);
private:
   sf::RenderWindow m_window;
};


const long NLWindowGL::NIGHTLIGHT_VIDEO_FLAG = sf::Style::Default;

bool NLWindowGL::create(const NLWindowSettings& s)
{
// Copy settings
m_settings = s;

    // Prepare Flags
long flags = NLWindowGL::NIGHTLIGHT_VIDEO_FLAG;
    if (m_settings.fullscreen)
    {
        flags |= sf::Style::Fullscreen;
    }

    sf::ContextSettings context;
    context.AntialiasingLevel = m_settings.getFsaa();
    context.DepthBits           = m_settings.getDepth();
    context.MajorVersion      = 3;
    context.MinorVersion      = 3;
    context.StencilBits          = 24;

    m_window.Create(sf::VideoMode(static_cast<unsigned int>(m_settings.width), static_cast<unsigned int>(m_settings.height),
                    m_settings.getDepth()), m_settings.caption, flags, context);
   
    m_window.Show(true);

    if ( m_settings.vsync )
    {
        m_window.EnableVerticalSync(m_settings.vsync);
    }
    else
    {
        m_window.SetFramerateLimit(m_fps_limit);
    }    
   

if ( glGetError() != GL_NO_ERROR )
throw NLException("[NLWindowGL] Error after Context Creation");

// Init Glew
int glew_result = glewInit();
if ( glew_result != GLEW_NO_ERROR )
{
std::stringstream ss;
ss << std::string("[NLWindowGL] glewInit failed:") << (char*)glewGetErrorString(glew_result);
NLError(ss.str());
throw NLException(ss.str());
}

    // OpenGL Error Check
    {
   GLenum e = glGetError();
   if ( e != GL_NO_ERROR ){
   throw NLException("[NLWindowGL] GLerror after glewInit while glewInit returned OK");
   }
    }

    // Choose perspective
    if (m_settings.mode == NightLight::OpenGL)
    {
        this->initOpenGL(m_settings.width, m_settings.height);
    }

// Dump infos about renderDevice to the log.
    this->dumpInfos();

return true;
}


You find the whole code in a repository here:
http://code.google.com/p/nightlight2d/source/browse/trunk/NightLightDLL/NLWindowGL.cpp

I used SDL before and want to replace it with SFML to drop another library with a license I do not like too much.
edit:
I also tried to create the Window on the Heap, but that does not change anything.

edit2:
To be more complete:
NLWindowGL is capsulated by NLWindow, which is a impl-idiom. It just forwards all calls to NLWindowGL.
The impl is created on the heap and is deleted when the program exits.
Title: SFML does not show windows on x64
Post by: Laurent on March 29, 2011, 02:32:33 pm
Something complete and minimal would be really cool. I can't test this incomplete piece of code, nor your whole project.

First try to create a window and destroy it, nothing more. If it crashes then you have your minimal code -- 2 lines ;)
If it doesn't crash, there's something in your code that messes things up, and you need to find what.

I can only think about one thing that could make it crash: do you destroy your window during main() or at global exit?
Title: SFML does not show windows on x64
Post by: scorcher24 on March 29, 2011, 02:51:32 pm
It is destroyed at global exit via the destructor of a class.

edit:
When I do a dirty "delete this" in the event-pump when I actually exit, the problem does not occur. Well, I need to find a solution for this.
Title: SFML does not show windows on x64
Post by: Laurent on March 29, 2011, 03:13:14 pm
That's the problem. ATI doesn't like destructions at global exit when you're inside a DLL. With a clean design you should never have to destroy this kind of object at global scope.
Title: SFML does not show windows on x64
Post by: scorcher24 on March 29, 2011, 08:45:39 pm
Solved the Problem.

And the Problem the OP was talking about seems to be fixed in the newest release of drivers which was a few minutes ago.
Installed 11.3 and SFML opens a Window now. At least in my slightly modified Version of the latest SFML2, would be interesting to hear reports from others too.
Title: SFML does not show windows on x64
Post by: Floomi on March 29, 2011, 11:58:13 pm
I have the OP's problem in an app that doesn't open any GL windows, only the default console. It uses sf::Image, dynamically linked.

I upgraded to the Catalyst drivers pushed out by Windows Update and it stopped working.
I upgraded to the latest Catalyst drivers - released today - on AMD's website and it still doesn't work.
The workaround posted above, using 10.4's atigktxx.dll, works for me.

SFML 1.7 on Win7 x64 here. I can try to get a minimal code sample if it helps.

edit:\ Minimal code sample follows:

Code: [Select]

#include <iostream>

#include <SFML/Graphics.hpp>

int main(int argc, char **argv)
{
std::cout << "Main entry." << std::endl;

sf::Image img;
img.LoadFromFile("test.bmp");

std::cout << "Image loaded." << std::endl;

int i;
std::cin >> i;
return 0;
}


This prints nothing (not even "Main entry.") and hangs. Linking against sfml-graphics only with SFML_DYNAMIC defined.
Title: SFML does not show windows on x64
Post by: Laurent on March 30, 2011, 07:39:26 am
There won't be any fix for this bug in the 1.x branch (which is already stopped at 1.6). And it's already fixed in SFML 2.
Title: SFML does not show windows on x64
Post by: Floomi on March 30, 2011, 10:43:17 am
Looks like I'm either merging the patch and recompiling from source then, or hoping someone else does.
Title: SFML does not show windows on x64
Post by: Laurent on March 30, 2011, 10:50:57 am
Merging the patch won't be easy, the corresopnding internal code has changed a lot between 1.6 and 2.0.
Title: SFML does not show windows on x64
Post by: Floomi on March 30, 2011, 11:20:38 am
And I guess the difference in API between 1.6 and 2.0 is fairly large too? So my choices are:
- Ship with an old version of the driver dll
- Do the merge from hell
- Upgrade to SFML 2.0 and rewrite my code accordingly.

I love SFML, it's been very good to me and I'm honestly very grateful for the work you've put in. But it sucks that your stable branch has a known crash bug that affects ~30% of your userbase which isn't going to be fixed.

At the very least it's worth putting a warning on the download page saying "if you want your app to work with ATI cards, use SFML 2". Or then promote SFML2 as the stable version and ditch 1.6 altogether ;)
Title: SFML does not show windows on x64
Post by: Laurent on March 30, 2011, 11:41:05 am
I know, it's really bad... But you can also blame ATI. They already had this annoying bug which caused a crash at exit, but now they also introduced this new bug that makes it freeze at startup; they should learn what "regression tests" means.

Unfortunately I don't have the time to both maintain 1.6 and work on 2.0, so I try to release SFML 2.0 as soon as possible and hopefully the old and buggy 1.6 will be forgotten quickly :)
Title: SFML does not show windows on x64
Post by: Viruses on December 18, 2011, 05:56:28 am
I had the exact same problem and the atigktxx.dll worked for me too but,this has only happened 2 times, sometimes when i run the application this blue thing fills my screen and tells me the computer is shutting down to protect from damage. I scanned the DLL and it had no threat but i don't know why that shutting down thing happens. Also, i didnt build 2.0 SFML i downloaded from a website but when i try to run application in SFML 2.0 it gives me an error "Undefined reference to _imp__.....  And some random stuff appears where i put the dots.Please help!