7
« on: March 29, 2010, 05:39:54 pm »
I have been using SFML2 to implement an interactive slide show as part of an image management prototype. I have encountered a few difficulties. I plan back down to SFML 1.5 and defer some of my planned visual effects in hopes of gaining stability and portability across Windows versions. However, as I do so, I would like to document my problems.
My environment:
OS: XP SP2
IDE: Visual Studio 2005 SP2
The main application GUI is C#. My image analysis and management library is in unmanaged C++. The managed<->unmanaged transition is made via a thin wrapper that creates a DLL used by the C# GUI. SFML is used within the unmanaged C++ domain, contained by the wrapper. To avoid naming collisions (my project is pretty big and has a lot of stuff in it), I link with the DLL versions of SFML. Because the slide show is just a feature, it may not be called and SFML functions may not be executed every time the program runs.
The Issues:
(1) I found that I had to put the following line in my main constructor within the C++, otherwise the SFML destructors would crash on exit if I did not call any other SFML functions.
// HACK - This following line is to avoid a crash when the SFML dll exits
sf::Context context;
(2) When using a RenderImage, sometimes the images are drawn vertically inverted. This is particularly odd because I cannot seem to anticipate whether it will be flipped. However, the behavior is repeatable to the extent that I can set the "FlipY" parameter to compensate once I have seen it flip in a given usage.
(3) In some cases, the first time I use a RenderImage, it is drawn onto my RenderWindow as all black. I am using the RenderImage to accomplish a clipping path on a rotated sprite. I clear() the RenderImage with a transparent color, draw the rotated sprite into the RenderImage, Display() the RenderImage, create a Sprite using the RenderImage, draw the RenderImage Sprite into the RenderWindow. After the first such use, it appears to behave normally.
(4) RenderImages appear to behave differently on different versions of Windows (or at least on different machines I have at my disposal). When it fails, most commonly it displays as black, however I have seen it display as the Sprite color.
(5) I played around with sounds and music and encountered a crash when I tried to LoadFromFile. However, I have not spent any time determining the details of this failure.
I suspect that many of these problems originate from my use of SFML within a DLL, combined with the fact that SFML is not always called upon.
I like SFML and find it pretty easy to use. I hope that these comments are not taken as overt criticism of the library, rather I am just trying to document behaviors that appear to be bugs.
Thanks