Giter Club home page Giter Club logo

ktx2.net's Introduction

Ktx2.NET

C# bindings for KTX-Software.

Available as nuget package under Ktx2.NET.

If you are missing a function feel free to create an issue and I'll add it.

ktx2.net's People

Contributors

boybaykiller avatar

Stargazers

Ivan Panayotov avatar

Watchers

 avatar

ktx2.net's Issues

Feedback

Hi!

I finally had the time to test out the bindings. Unfortunately, I got into an issue. I want to assign the original byte array texture to a ktx2 one. Here is what I tried to do:

byte[] d3dtxTextureDataArray = textureData.SelectMany(b => b).ToArray();

fixed (byte* ptr = d3dtxTextureDataArray)
{
texture.PData = ptr;
texture.DataSize = (uint)d3dtxTextureDataArray.Length;
}

//...

fixed (Texture* ptr = &texture)
{
Ktx2.WriteToNamedFile(ptr, newKTX2Path);
}

I am almost certain I did something wrong, I get an exception when trying to save to a file (presumingly it doesn't allocate memory correctly): An unhandled exception of type 'System.AccessViolationException' occurred in Ktx2.NET.dll: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

The file is created on the system, but there is no data inside it. I tried looking up the in the Khronos documentation, but in their samples they use ktxTexture_SetImageFromMemory.

Other than that so far it has been clean. I was also wondering if IsSRGB and ktx2ktx2 can be added as well (I could use it to transform to ktx1 and then transcode to rgba8).

Thanks!

Request: Add some additional functions and features

Hi! I am working on a texture converter, which extracts texture data from proprietary game files to DDS. However, some of the formats like ETC1, ETC2, ATC, ASTC, PVRTC etc. have to be stored in a KTX/KTX2 container and I would like to use this wrapper.

However, it doesn't support some functions equivalent to DirectXTexNet's ones which I use

It would be great to have some of these:
WriteToMemory/WriteToFile
LoadFromFile
ComputePitch/Slice
BitsPerPixel
IsPremultipliedAlpha

KTX1 writer and loader would be great as well, but I understand this is primarily for KTX2 and Khronos has decided to deprecate version 1 (which unfortunately supports ATC compressed textures natively).

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.