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

Author Topic: All sprites displayed as white squares after migrating for SFML.NET 2.1 to 2.2  (Read 4905 times)

0 Members and 1 Guest are viewing this topic.

Tigrou

  • Newbie
  • *
  • Posts: 15
    • View Profile
I have a perfectly working application made with SFML.Net 2.1. I have decided to migrate to 2.2.

However, after the migration I have noticed the following : ALL sprites are now displayed as white rectangles (no more textures)

I have reduce program to the bare minimum and problem still occurs :

public static void Main()
{
        RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");
       
        window.Closed += OnClosed;
        Sprite spr = new Sprite(new Texture(@"test.png"));     
                       
        while (window.IsOpen)
        {
                window.DispatchEvents();                                                       
                window.Clear();                                
                window.Draw(spr);
                window.Display();
        }
}
   

Issue is not related to test.png file : if it was not there it would throw an exception.

Compiling the exact same program under SFML 2.1 (expect minor changes like window.Open vs window.Open()) => it works perfectly (sprites are displayed as they should).

At runtime, the following errors are sometimes shown when using SFML 2.2 :

Code: [Select]
OpenGL Warning: SHCRGL_GUEST_FN_WRITE_READ (36) failed with ffffffdb ffffffea   

Code: [Select]
Unhandled Exception: System.AccessViolationException: Attempted to read or write
 protected memory. This is often an indication that other memory is corrupt.
   at SFML.Graphics.Sprite.sfRenderWindow_drawSprite(IntPtr CPointer, IntPtr Spr
ite, MarshalData& states)
   at SFML.Graphics.Sprite.Draw(RenderTarget target, RenderStates states)
   at SFML.Graphics.RenderWindow.Draw(Drawable drawable)
   at Test.Program.Main() in Program.cs:line 22
   

I use SFML.Net 2.2 32-bit version from here : http://www.sfml-dev.org/download/sfml.net/ + CSFML 2.2 from here : http://www.sfml-dev.org/download/csfml/



Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
You can try the latest SFML.Net from repository, it should be in sync with the recently released CSFML 2.4.
Laurent Gomila - SFML developer

Tigrou

  • Newbie
  • *
  • Posts: 15
    • View Profile
Thanks for your help. I did the following :

1) I downloaded latest C# source code from SFML.Net github repository and compiled it (32-bit / release). I copied dll's from SFML.Net-master\lib\x86 folder to my project and referenced those assemblies.

2) I downloaded CSFML 2.4 package from here  : http://www.sfml-dev.org/download/csfml/ (32-bit C++)
I copied dll's to the same folder as my project binary executable.

Now, when I start the application it fails on the first line :

RenderWindow window = new RenderWindow(new VideoMode(800, 600), "SFML window");



System.DllNotFoundException: Unable to load DLL 'csfml-graphics-2': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)
   at SFML.Graphics.RenderWindow.sfRenderWindow_createUnicode(VideoMode Mode, IntPtr Title, Styles Style, ContextSettings& Params)
   at SFML.Graphics.RenderWindow..ctor(VideoMode mode, String title, Styles style, ContextSettings settings)
   at SFML.Graphics.RenderWindow..ctor(VideoMode mode, String title)
   at Test.Program.Main()

As explained above, "csfml-graphics-2.dll" exists in project executable.
It seems some incompatible binding between DLL's.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Too bad... there's no one to properly maintain these bindings, so you'll have to dig a little deeper or wait until someone else does it.
Laurent Gomila - SFML developer

Tigrou

  • Newbie
  • *
  • Posts: 15
    • View Profile
Some feed back : the dev machine i'm using (a macbook laptop) use WinXP (under VirtualBox) :

- SFML 2.1 : works perfectly
- SFML 2.2 : white squares for all sprites (no textures)
- SFML 2.4 : crash at load : Unable to load DLL 'csfml-graphics-2'  Invalid access to memory location

Under VirtualBox + Win7 , or Win7 native (no virtualization), all SFML versions works perfectly.

It seems Windows XP compatibility was broken between 2.1 and 2.2.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
This is indeed possible, and even intended :)
Laurent Gomila - SFML developer