RenderTexture constructor throws
DumpsterDoofus opened this issue · 4 comments
Minimal Working Example
new RenderTexture(100, 100, new ContextSettings());
Running this throws the following:
System.EntryPointNotFoundException: Unable to find an entry point named 'sfRenderTexture_createWithSettings' in DLL 'csfml-graphics'.
at SFML.Graphics.RenderTexture.sfRenderTexture_createWithSettings(UInt32 Width, UInt32 Height, ContextSettings Settings)
at SFML.Graphics.RenderTexture..ctor(UInt32 width, UInt32 height, ContextSettings contextSettings)
at Tiling.Program.Main() in E:\Software\My Software\GraphicsGarbage\Tiling\Program.cs:line 38
Happens when https://github.com/SFML/SFML.Net/blob/2.5/src/SFML.Graphics/RenderTexture.cs#L533 tries to call https://github.com/SFML/CSFML/blob/eb4a9cfe1def386132d45e7366926c731b74f15a/src/SFML/Graphics/RenderTexture.cpp#L57.
More info:
- Package:
SFML.Graphics
2.5.0 - Framework:
netcoreapp3.1
- OS: Windows 10
Why it breaks
https://github.com/SFML/CSFML/releases/tag/2.5 was released on Dec 8, 2018, but with an incorrect method signature (see https://github.com/crumblingstatue/CSFML/blob/eb4a9cfe1def386132d45e7366926c731b74f15a/include/SFML/Graphics/RenderTexture.h#L68).
On Mar 14, 2019 crumblingstatue/CSFML@95ce89c fixed the method signature. However, there hasn't been a new release of CSFML, so SFML.Net is still on CSFML 2.5, which has the incorrect method signature.
Solution: Wait for CSFML 2.6, and update the version?
I too am waiting on when this will be available, mostly so I can set an AA level on a fullscreen RenderTexture.
The main alternative right now is to use the obsolete constructor for RenderTexture. But yes, I believe this is waiting on a new CSFML version to be released which I don't know when thats planned.
The fix for this issue was included in CSFML 2.5.1 https://github.com/SFML/CSFML/releases/tag/2.5.1
SFML.Net currently is still on 2.5.0 so this is likely to be resolved in the next release, when ever that might be.
Correction for above, you can infact get this right now if you install CSFML 2.5.1 in your project. If you're using .Net Core project you might need to add <CSFMLIgnoreAnyCPU>true</CSFMLIgnoreAnyCPU>
to a property group in your project file if it fails to build due to AnyCPU issues.
As the issue has technically been fixed, I'll close it and look into publishing a new SFML.Net NuGet package sometime soon-ish.