KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
861 stars 225 forks source link

Calling texture compression via C# #775

Closed ignarmezh closed 11 months ago

ignarmezh commented 11 months ago

Hi! I'm using toktx.exe and ktx.dll for compression textures from .png to .ktx2 via cmd, with commands like: toktx.exe --encode etc1s --genmipmap --assign_oetf linear --assign_primaries none {newFilePath} {pathOfImage} Is it possible to call functions from C#? If i add dll as dependencies. Could you help me how to do it?

MarkCallow commented 11 months ago

@ignarmezh, I assume you mean is it possible to call libktx functions from C# since toktx is an application.*

I know very little about C# but I believe it is a language that manages all memory allocation similar to Java. If that is the case then I expect a native interface module, à la Java's JNI, is needed to enable C# programs to call functions in a native library. There is no such module in this project. If I'm not totally wrong and a module is needed, I'd be happy to accept a contribution to add one.

* Most of what toktx does happens within libktx. The exceptions are scaling and resizing of images and mipmap generation.

I'm converting this to a discussion. If the discussion identifies definitively that something is needed to interface from C#, an issue can be opened to request that something.