SFML community forums
Bindings - other languages => DotNet => Topic started by: Lignum on January 29, 2015, 03:47:46 pm
-
Hi!
Up until now I've been using OpenTK for rendering where I've been storing my textures in zip archives. This worked perfectly fine until I decided to switch to SFML.Net.
This is my code:
var tex
= new Texture
(loader
.GetResourceAsStream(filename
)); I'm using .NET 4.5's ZipArchive internally. loader is just a small interface I made for it.
With this I'm getting a NotSupportedException: "This stream from ZipArchiveEntry does not support seeking."
So I tried this:
byte[] data
= loader
.GetResourceAsByteArray(filename
); // the array starts with "?PNG", so this is probably not the issue...var tex
= new Texture
(new MemoryStream
(data
)); This one throws a LoadingFailedException: "Failed to load texture from memory."
Using zip files makes everything nice and simple so I'd hate to get rid of it. Is there any other way to do this?
Thanks in advance,
- Lignum
-
I think you'll find that PhysFs (http://icculus.org/physfs/) does what you want.
-
I'm going to take a wild guess and say this will fix it http://stackoverflow.com/questions/8741474/returning-a-stream-from-file-openread
-
I think you'll find that PhysFs (http://icculus.org/physfs/) does what you want.
Ah, yes it does. Thanks, I'll take a look at that at some point.
I'm going to take a wild guess and say this will fix it http://stackoverflow.com/questions/8741474/returning-a-stream-from-file-openread
With your solution it outputted an error saying that 8-bit images weren't supported. I updated the concerned images and it works now! Thanks for your help.