More graphics libraries. This time it's image loading.


(David Turnbull) #1

I just pushed a framework for cross platform image loading. Some of the
features...

- Linux and 32-bit compatible.
- Detection of format from raw data, not filename.
- Imports into 8 bit, 16 bit, and HDR channels.
- HDR gamma conversion.
- RGB to greyscale using luminance.
- Optionally loads into unsafe buffers.
- 100% Swift.
- Fast.

I wrote this because I want to load textures for OpenGL. Only the BMP
decoder is implemented right now. The framework for adding decoders is
finished but I don't have a schedule for when more will be done.
Contributions are welcome and I can coordinate to make sure there's no
duplicate effort.

https://github.com/AE9RB/SwiftGL/tree/master/Sources/SwiftGLres

I stopped tagging and started ignoring the package manager since it's not
going to be in the 2.2 release. Let me know if this is a problem for anyone.

-david https://github.com/AE9RB/SwiftGL


(David Turnbull) #2

I've made progress with the image decoders. BMP, GIF, and PNG are working.
I also added an image viewer to the demos. 100% Swift all the way from the
file to OpenGL. Even inflate is Swift.

https://github.com/AE9RB/SwiftGL

-david

···

On Mon, Feb 8, 2016 at 10:42 AM, David Turnbull <dturnbull@gmail.com> wrote:

I just pushed a framework for cross platform image loading. Some of the
features...

- Linux and 32-bit compatible.
- Detection of format from raw data, not filename.
- Imports into 8 bit, 16 bit, and HDR channels.
- HDR gamma conversion.
- RGB to greyscale using luminance.
- Optionally loads into unsafe buffers.
- 100% Swift.
- Fast.


(Jens Alfke) #3

That is excellent! And would be an interesting source of benchmarks too; have you compared them against the typical C libraries?

—Jens

···

On Feb 15, 2016, at 11:39 AM, David Turnbull via swift-users <swift-users@swift.org> wrote:

I've made progress with the image decoders. BMP, GIF, and PNG are working. I also added an image viewer to the demos. 100% Swift all the way from the file to OpenGL. Even inflate is Swift.


(David Turnbull) #4

I don't have any benchmarks to share. I didn't ignore performance
completely, but it was more important to get things actually working. If
someone wants to publish benchmarks or submit performance improvements,
that'd be awesome.

-david https://github.com/AE9RB/SwiftGL

···

On Mon, Feb 15, 2016 at 11:50 AM, Jens Alfke <jens@mooseyard.com> wrote:

On Feb 15, 2016, at 11:39 AM, David Turnbull via swift-users < > swift-users@swift.org> wrote:

I've made progress with the image decoders. BMP, GIF, and PNG are working.
I also added an image viewer to the demos. 100% Swift all the way from the
file to OpenGL. Even inflate is Swift.

That is excellent! And would be an interesting source of benchmarks too;
have you compared them against the typical C libraries?

—Jens


(Volodymyr Boichentsov) #5

cool!

Will be nice add S3 Texture Compression formats.

Best Regards,
Volodymyr Boichentsov

···

On 15 Feb 2016, at 23:10, David Turnbull via swift-users <swift-users@swift.org> wrote:

I don't have any benchmarks to share. I didn't ignore performance completely, but it was more important to get things actually working. If someone wants to publish benchmarks or submit performance improvements, that'd be awesome.

-david https://github.com/AE9RB/SwiftGL

On Mon, Feb 15, 2016 at 11:50 AM, Jens Alfke <jens@mooseyard.com <mailto:jens@mooseyard.com>> wrote:

On Feb 15, 2016, at 11:39 AM, David Turnbull via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

I've made progress with the image decoders. BMP, GIF, and PNG are working. I also added an image viewer to the demos. 100% Swift all the way from the file to OpenGL. Even inflate is Swift.

That is excellent! And would be an interesting source of benchmarks too; have you compared them against the typical C libraries?

—Jens

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(David Turnbull) #6

You can use DXT (S3) files by loading them to NSData and sending the raw
bytes to OpenGL. There's no need to decode a format your video card already
knows.

-david

···

On Mon, Feb 15, 2016 at 3:42 PM, Volodymyr Boichentsov <sakristx@gmail.com> wrote:

cool!

Will be nice add S3 Texture Compression formats.