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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Dude234

Pages: [1]
1
DotNet / Re: Drop .NET Framework in favor of .NET Core?
« on: August 22, 2018, 10:57:03 pm »
It would be great if SFML.NET would advance to SFML.CORE at some point.
Why? Cross-platform, open source, and as claimed: more performance and modern design.

I was searching for libraries which are media / game frameworks and already use Core.
But it seems to be too early for such hopes? If SFML jumps early on this train, that would be great.

So the one thing I can bring into this disscussion is, if you want to keep sfml c# alive and more active, changing to core may be a good oppurtunity? Because people will look for something like this: libraries which are going to use CORE.

Since I live with a highly  outdated version of SFML.NET anway for quite some time now, I do not care so much about a updated one anymore, stuff mostly works. But I would be very hyped for SFML.CORE. That are my two cents.

2
DotNet / Re: Async corrupts Font ?
« on: July 24, 2018, 03:35:48 pm »
[DllImport("opengl32.dll")]
public static extern void glFlush(); //no error when called
public static extern void Test(); //causes error (no entry point found), so I assume the dll is loaded and glFlush is a valid call

I think I got the dllimport working and can call glFlush() now. But nothing happens (beside a small stall). This does not repair the Font.

I don't know how it relates to my problem. My wild guess is, that the memory of the Font gets overwritten or used by another Thread. Then letters disappear.

I actually nailed it down to this (version 2.2): I need to re-create the Font after the async begins and when the async ends. Somehow, both events corrupt the Font object. This is my current observation and I tested a fair amount of it.

Yes, its quite sad, that SFML.NET does not get so much attention and maintenance. I still like it a lot.

And thanks for the link, I got it up and running (sfml.net 2.4 and csfml 2.4) in a test project. But I would like to stick with 2.2 for now.

3
DotNet / Re: Async corrupts Font ?
« on: July 24, 2018, 01:59:58 pm »
You mean something like OpenTK.Graphics.ES11.GL.Flush()? I'm afraid this will not work (Access Violation).

(I completly reverted back to 2.2 for now).
I would still appreciate a guide to use sfmlnet 2.3 with csfml 2.3 though. Thanks!

I made a workaround which recreates the Font everytime the DisplayedString is updated when a Task finishes. This is not optimal and even dangerous since the Font is heavy and memory can spike.
(Adding GC.Collect() helps to keep memory on a normal level but comes with some CPU load).

Alternatively I could avoid threading alltogether and just load a chunk per frame.

4
DotNet / Re: Async corrupts Font ?
« on: July 24, 2018, 11:47:57 am »
This current setup (csfml 2.3 from website and built sfmlnet 2.3) is super unstable.
Maybe I have combined them the wrong way. This doesnt play together.

I need to Dispose objects before closing the window. But more problematic, sfml objects throw Overflow Exceptions when they get null referenced? And the font corruption exists also as far as I can tell in my bugged code.

Is there a way to to make 2.3 work? Do I need to revert to stable 2.2 and forget about threading?

5
DotNet / Re: Async corrupts Font ?
« on: July 24, 2018, 11:12:06 am »
Okay, nevermind about integrating csfml 2.3. I think I got it working.

You can use the version on the website (csfml 2.3) with the built version of sfmlnet 2.3, right?

Now I got some serious Stackoverflow Exceptions happening.
But I cannot say what is causing it for now, need to further investigate.

6
DotNet / Re: Async corrupts Font ?
« on: July 24, 2018, 11:01:33 am »
Thanks for responding so fast :)

I built 2.3 with the solution provided on the official github.
https://github.com/SFML/SFML.Net/releases

And I am using csfml 2.2 currently :-\ not the best idea ...

I tried combine the csfml 2.3 from the website with the built 2.3, but that did not work.
How can I make csfml and sfml.net 2.3 work?

7
DotNet / Async corrupts Font ?
« on: July 24, 2018, 10:19:41 am »
(Using: SFML.NET 2.3)

I'm writing a resource loading screen. And I successfully implemented loading with async/await.
Next step is to display the progression. This is done with SFML.Text.

When starting the async, somehow the Font gets corrupted once. The outcome are missing letters in the Font data. The Font is NOT touched in the async chain!

If I recreate the Font after the async has fired its Tasking, everything seems to be fine. 
There are not multiple Tasks in parallel, but only one at a time.

To me, this looks like the .net threading takes memory that is used by the Font?
I do not claim to have a deep understanding of what is happening here.

Here is my code in very reduced form. I test loading with a lot of 5MB bmps currently.
I'm glad if you guys have some ideas on SFML objects and threading. Are they safe ;D

Font font;
Text text;

ctor(){
font = new Font(); //path
text = new Text();
LoadResourcesAsync();
}

async void LoadResourcesAsync() {
await Load();
}

async Task Load(){
foreach
await Task.Run(() => ); //load stuff and report progress via event
}

void Draw(RenderTarget target) {
text.DisplayedString = currentFile; // or percentage (currentFile is updated via event)
target.Draw(text);
}
 

8
DotNet / Re: Changing Texture does not affect Sprite ?
« on: June 30, 2018, 07:37:45 pm »
Alright. I got it working! ;D It needed to be the same size as stated in the docs. Sorry!

Quote
No additional check is performed on the size of the image, passing an invalid combination of image size and offset will lead to an undefined behavior. This function does nothing if the texture was not previously created.

9
DotNet / Re: Changing Texture does not affect Sprite ?
« on: June 30, 2018, 07:34:10 pm »
Yes, that was a C# fail on my side and it's quite a limitation.

Sure there are workarounds to re-assign the texture of all concerning instances, when the change is needed.
But that does not seem to be straightforward for now.

The next idea would be to change the members of the texture instance instead, updating its data.
So we are editing the texture instance itself, all other objects, which are referencing it would display the changes!

The only access we get is: Texture.Update().

Image img1 = new Image("img1.png");

Image img2 = new Image("img2.png");

Texture tex = new Texture(img1);

Sprite spr = new Sprite(tex);

tex.Update(img2);
 

I expected the texture to change, since the instance is updated.
But the first image is still shown.

10
DotNet / Changing Texture does not affect Sprite ?
« on: June 30, 2018, 03:56:03 pm »
Sprite spr = new Sprite();

Texture tex = new Texture("tex1.png");

spr.Texture = tex; // does not matter if inside constructor or prop

tex = new Texture("tex2.png");
 

I expected that changing the texture itself would also change the texture of the Sprite,
because I expected that the texture is referenced and not copied.
I really hope I do this wrong.

Pages: [1]
anything